src/share/vm/opto/library_call.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File hotspot Cdiff src/share/vm/opto/library_call.cpp

src/share/vm/opto/library_call.cpp

Print this page
rev 7387 : 8063137: Never-taken branches should be pruned when GWT LambdaForms are shared
Reviewed-by: ?

*** 39,48 **** --- 39,49 ---- #include "opto/idealKit.hpp" #include "opto/mathexactnode.hpp" #include "opto/movenode.hpp" #include "opto/mulnode.hpp" #include "opto/narrowptrnode.hpp" + #include "opto/opaquenode.hpp" #include "opto/parse.hpp" #include "opto/runtime.hpp" #include "opto/subnode.hpp" #include "prims/nativeLookup.hpp" #include "runtime/sharedRuntime.hpp"
*** 285,294 **** --- 286,297 ---- bool inline_encodeISOArray(); bool inline_updateCRC32(); bool inline_updateBytesCRC32(); bool inline_updateByteBufferCRC32(); bool inline_multiplyToLen(); + + bool inline_profileBranch(); }; //---------------------------make_vm_intrinsic---------------------------- CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
*** 898,907 **** --- 901,913 ---- case vmIntrinsics::_updateBytesCRC32: return inline_updateBytesCRC32(); case vmIntrinsics::_updateByteBufferCRC32: return inline_updateByteBufferCRC32(); + case vmIntrinsics::_profileBranch: + return inline_profileBranch(); + default: // If you get here, it may be that someone has added a new intrinsic // to the list in vmSymbols.hpp without implementing it here. #ifndef PRODUCT if ((PrintMiscellaneous && (Verbose || WizardMode)) || PrintOpto) {
*** 5805,5809 **** --- 5811,5848 ---- Node* bool_instof = _gvn.transform(new BoolNode(cmp_instof, BoolTest::ne)); Node* instof_false = generate_guard(bool_instof, NULL, PROB_MIN); return instof_false; // even if it is NULL } + + bool LibraryCallKit::inline_profileBranch() { + Node* counts = argument(1); + const TypeAryPtr* ary = NULL; + ciArray* aobj = NULL; + if (counts->is_Con() + && (ary = counts->bottom_type()->isa_aryptr()) != NULL + && (aobj = ary->const_oop()->as_array()) != NULL) { + assert(aobj->length() == 2, ""); + jint taken = aobj->element_value(1).as_int(); + jint not_taken = aobj->element_value(0).as_int(); + + if (C->log() != NULL) { + C->log()->elem("profile_branch taken='%d' not_taken='%d'", + taken, not_taken); + } + + if (taken + not_taken == 0) { + // According to profile, never executed. + uncommon_trap_exact(Deoptimization::Reason_intrinsic, + Deoptimization::Action_reinterpret); + return true; + } + // Stop profiling + Node* opq = _gvn.transform(new Opaque4Node(argument(0), taken, not_taken)); + C->record_for_igvn(opq); + set_result(opq); + return true; + } else { + // Continue profiling + return false; + } + }
src/share/vm/opto/library_call.cpp
Index Unified diffs Context diffs Sdiffs Patch New Old Previous File Next File