933 if (!match_found) {
934 *base = root->x();
935 *index = root->y();
936 *log2_scale = 0;
937 }
938
939 // If the value is pinned then it will be always be computed so
940 // there's no profit to reshaping the expression.
941 return !root->is_pinned();
942 }
943
944
945 void Canonicalizer::do_UnsafeRawOp(UnsafeRawOp* x) {
946 Instruction* base = NULL;
947 Instruction* index = NULL;
948 int log2_scale;
949
950 if (match(x, &base, &index, &log2_scale)) {
951 x->set_base(base);
952 x->set_index(index);
953 x->set_log2_scale(log2_scale);
954 if (PrintUnsafeOptimization) {
955 tty->print_cr("Canonicalizer: UnsafeRawOp id %d: base = id %d, index = id %d, log2_scale = %d",
956 x->id(), x->base()->id(), x->index()->id(), x->log2_scale());
957 }
958 }
959 }
960
961 void Canonicalizer::do_RoundFP(RoundFP* x) {}
962 void Canonicalizer::do_UnsafeGetRaw(UnsafeGetRaw* x) { if (OptimizeUnsafes) do_UnsafeRawOp(x); }
963 void Canonicalizer::do_UnsafePutRaw(UnsafePutRaw* x) { if (OptimizeUnsafes) do_UnsafeRawOp(x); }
964 void Canonicalizer::do_UnsafeGetObject(UnsafeGetObject* x) {}
965 void Canonicalizer::do_UnsafePutObject(UnsafePutObject* x) {}
966 void Canonicalizer::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) {}
967 void Canonicalizer::do_UnsafePrefetchRead (UnsafePrefetchRead* x) {}
968 void Canonicalizer::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {}
969 void Canonicalizer::do_ProfileCall(ProfileCall* x) {}
970 void Canonicalizer::do_ProfileReturnType(ProfileReturnType* x) {}
971 void Canonicalizer::do_ProfileInvoke(ProfileInvoke* x) {}
972 void Canonicalizer::do_RuntimeCall(RuntimeCall* x) {}
|
933 if (!match_found) {
934 *base = root->x();
935 *index = root->y();
936 *log2_scale = 0;
937 }
938
939 // If the value is pinned then it will be always be computed so
940 // there's no profit to reshaping the expression.
941 return !root->is_pinned();
942 }
943
944
945 void Canonicalizer::do_UnsafeRawOp(UnsafeRawOp* x) {
946 Instruction* base = NULL;
947 Instruction* index = NULL;
948 int log2_scale;
949
950 if (match(x, &base, &index, &log2_scale)) {
951 x->set_base(base);
952 x->set_index(index);
953 if (index != NULL) {
954 // If index is pinned, do not scale again
955 if (index->is_pinned()) {
956 log2_scale = 0;
957 } else {
958 // If there is a scale, pin the index so it won't be scaled again
959 if (log2_scale != 0) {
960 index->pin();
961 }
962 }
963 }
964 x->set_log2_scale(log2_scale);
965 if (PrintUnsafeOptimization) {
966 tty->print_cr("Canonicalizer: UnsafeRawOp id %d: base = id %d, index = id %d, log2_scale = %d",
967 x->id(), x->base()->id(), x->index()->id(), x->log2_scale());
968 }
969 }
970 }
971
972 void Canonicalizer::do_RoundFP(RoundFP* x) {}
973 void Canonicalizer::do_UnsafeGetRaw(UnsafeGetRaw* x) { if (OptimizeUnsafes) do_UnsafeRawOp(x); }
974 void Canonicalizer::do_UnsafePutRaw(UnsafePutRaw* x) { if (OptimizeUnsafes) do_UnsafeRawOp(x); }
975 void Canonicalizer::do_UnsafeGetObject(UnsafeGetObject* x) {}
976 void Canonicalizer::do_UnsafePutObject(UnsafePutObject* x) {}
977 void Canonicalizer::do_UnsafeGetAndSetObject(UnsafeGetAndSetObject* x) {}
978 void Canonicalizer::do_UnsafePrefetchRead (UnsafePrefetchRead* x) {}
979 void Canonicalizer::do_UnsafePrefetchWrite(UnsafePrefetchWrite* x) {}
980 void Canonicalizer::do_ProfileCall(ProfileCall* x) {}
981 void Canonicalizer::do_ProfileReturnType(ProfileReturnType* x) {}
982 void Canonicalizer::do_ProfileInvoke(ProfileInvoke* x) {}
983 void Canonicalizer::do_RuntimeCall(RuntimeCall* x) {}
|