--- old/src/share/vm/opto/parse2.cpp 2015-01-28 11:51:29.000000000 +0300 +++ new/src/share/vm/opto/parse2.cpp 2015-01-28 11:51:29.000000000 +0300 @@ -765,36 +765,19 @@ } static bool has_injected_profile(BoolTest::mask btest, Node* test, int& taken, int& not_taken) { - ProfileBooleanNode* profile = NULL; - if (btest != BoolTest::eq && btest != BoolTest::ne) { // Only ::eq and ::ne are supported for profile injection. return false; } - - if (test->is_Cmp()) { - Node* n = test->in(1); - switch (n->Opcode()) { - case Op_ProfileBoolean: - profile = (ProfileBooleanNode*) n; - break; - case Op_AndI: - // Look for the following shape: AndI (ProfileBoolean) (ConI 1)) - const TypeInt* t = NULL; - if (n->in(1)->Opcode() == Op_ProfileBoolean && - n->in(2)->is_Con() && - (t = n->in(2)->bottom_type()->isa_int()) != NULL && - t->get_con() == 1) { - profile = (ProfileBooleanNode*) n->in(1); - } - break; - } - } - if (profile != NULL) { + if (test->is_Cmp() && + test->in(1)->Opcode() == Op_ProfileBoolean) { + ProfileBooleanNode* profile = (ProfileBooleanNode*)test->in(1); int false_cnt = profile->false_count(); int true_cnt = profile->true_count(); // Counts matching depends on the actual test operation (::eq or ::ne). + // No need to scale the counts because profile injection was designed + // to feed exact counts into VM. taken = (btest == BoolTest::eq) ? false_cnt : true_cnt; not_taken = (btest == BoolTest::eq) ? true_cnt : false_cnt;