< prev index next >

src/share/vm/opto/runtime.cpp

Print this page




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/systemDictionary.hpp"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "code/compiledIC.hpp"
  30 #include "code/icBuffer.hpp"
  31 #include "code/nmethod.hpp"
  32 #include "code/pcDesc.hpp"
  33 #include "code/scopeDesc.hpp"
  34 #include "code/vtableStubs.hpp"
  35 #include "compiler/compileBroker.hpp"
  36 #include "compiler/oopMap.hpp"

  37 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
  38 #include "gc/g1/heapRegion.hpp"
  39 #include "gc/shared/barrierSet.hpp"
  40 #include "gc/shared/collectedHeap.hpp"
  41 #include "gc/shared/gcLocker.inline.hpp"
  42 #include "interpreter/bytecode.hpp"
  43 #include "interpreter/interpreter.hpp"
  44 #include "interpreter/linkResolver.hpp"
  45 #include "memory/oopFactory.hpp"
  46 #include "oops/objArrayKlass.hpp"
  47 #include "oops/oop.inline.hpp"
  48 #include "opto/ad.hpp"
  49 #include "opto/addnode.hpp"
  50 #include "opto/callnode.hpp"
  51 #include "opto/cfgnode.hpp"
  52 #include "opto/graphKit.hpp"
  53 #include "opto/machnode.hpp"
  54 #include "opto/matcher.hpp"
  55 #include "opto/memnode.hpp"
  56 #include "opto/mulnode.hpp"


  74 // For debugging purposes:
  75 //  To force FullGCALot inside a runtime function, add the following two lines
  76 //
  77 //  Universe::release_fullgc_alot_dummy();
  78 //  MarkSweep::invoke(0, "Debugging");
  79 //
  80 // At command line specify the parameters: -XX:+FullGCALot -XX:FullGCALotStart=100000000
  81 
  82 
  83 
  84 
  85 // Compiled code entry points
  86 address OptoRuntime::_new_instance_Java                           = NULL;
  87 address OptoRuntime::_new_array_Java                              = NULL;
  88 address OptoRuntime::_new_array_nozero_Java                       = NULL;
  89 address OptoRuntime::_multianewarray2_Java                        = NULL;
  90 address OptoRuntime::_multianewarray3_Java                        = NULL;
  91 address OptoRuntime::_multianewarray4_Java                        = NULL;
  92 address OptoRuntime::_multianewarray5_Java                        = NULL;
  93 address OptoRuntime::_multianewarrayN_Java                        = NULL;

  94 address OptoRuntime::_g1_wb_pre_Java                              = NULL;
  95 address OptoRuntime::_g1_wb_post_Java                             = NULL;
  96 address OptoRuntime::_vtable_must_compile_Java                    = NULL;
  97 address OptoRuntime::_complete_monitor_locking_Java               = NULL;
  98 address OptoRuntime::_monitor_notify_Java                         = NULL;
  99 address OptoRuntime::_monitor_notifyAll_Java                      = NULL;
 100 address OptoRuntime::_rethrow_Java                                = NULL;
 101 
 102 address OptoRuntime::_slow_arraycopy_Java                         = NULL;
 103 address OptoRuntime::_register_finalizer_Java                     = NULL;
 104 
 105 # ifdef ENABLE_ZAP_DEAD_LOCALS
 106 address OptoRuntime::_zap_dead_Java_locals_Java                   = NULL;
 107 address OptoRuntime::_zap_dead_native_locals_Java                 = NULL;
 108 # endif
 109 
 110 ExceptionBlob* OptoRuntime::_exception_blob;
 111 
 112 // This should be called in an assertion at the start of OptoRuntime routines
 113 // which are entered from compiled code (all of them)


 125 #define gen(env, var, type_func_gen, c_func, fancy_jump, pass_tls, save_arg_regs, return_pc) \
 126   var = generate_stub(env, type_func_gen, CAST_FROM_FN_PTR(address, c_func), #var, fancy_jump, pass_tls, save_arg_regs, return_pc); \
 127   if (var == NULL) { return false; }
 128 
 129 bool OptoRuntime::generate(ciEnv* env) {
 130 
 131   generate_exception_blob();
 132 
 133   // Note: tls: Means fetching the return oop out of the thread-local storage
 134   //
 135   //   variable/name                       type-function-gen              , runtime method                  ,fncy_jp, tls,save_args,retpc
 136   // -------------------------------------------------------------------------------------------------------------------------------
 137   gen(env, _new_instance_Java              , new_instance_Type            , new_instance_C                  ,    0 , true , false, false);
 138   gen(env, _new_array_Java                 , new_array_Type               , new_array_C                     ,    0 , true , false, false);
 139   gen(env, _new_array_nozero_Java          , new_array_Type               , new_array_nozero_C              ,    0 , true , false, false);
 140   gen(env, _multianewarray2_Java           , multianewarray2_Type         , multianewarray2_C               ,    0 , true , false, false);
 141   gen(env, _multianewarray3_Java           , multianewarray3_Type         , multianewarray3_C               ,    0 , true , false, false);
 142   gen(env, _multianewarray4_Java           , multianewarray4_Type         , multianewarray4_C               ,    0 , true , false, false);
 143   gen(env, _multianewarray5_Java           , multianewarray5_Type         , multianewarray5_C               ,    0 , true , false, false);
 144   gen(env, _multianewarrayN_Java           , multianewarrayN_Type         , multianewarrayN_C               ,    0 , true , false, false);

 145   gen(env, _g1_wb_pre_Java                 , g1_wb_pre_Type               , SharedRuntime::g1_wb_pre        ,    0 , false, false, false);
 146   gen(env, _g1_wb_post_Java                , g1_wb_post_Type              , SharedRuntime::g1_wb_post       ,    0 , false, false, false);
 147   gen(env, _complete_monitor_locking_Java  , complete_monitor_enter_Type  , SharedRuntime::complete_monitor_locking_C, 0, false, false, false);
 148   gen(env, _monitor_notify_Java            , monitor_notify_Type          , monitor_notify_C                ,    0 , false, false, false);
 149   gen(env, _monitor_notifyAll_Java         , monitor_notify_Type          , monitor_notifyAll_C             ,    0 , false, false, false);
 150   gen(env, _rethrow_Java                   , rethrow_Type                 , rethrow_C                       ,    2 , true , false, true );
 151 
 152   gen(env, _slow_arraycopy_Java            , slow_arraycopy_Type          , SharedRuntime::slow_arraycopy_C ,    0 , false, false, false);
 153   gen(env, _register_finalizer_Java        , register_finalizer_Type      , register_finalizer              ,    0 , false, false, false);
 154 
 155 # ifdef ENABLE_ZAP_DEAD_LOCALS
 156   gen(env, _zap_dead_Java_locals_Java      , zap_dead_locals_Type         , zap_dead_Java_locals_C          ,    0 , false, true , false );
 157   gen(env, _zap_dead_native_locals_Java    , zap_dead_locals_Type         , zap_dead_native_locals_C        ,    0 , false, true , false );
 158 # endif
 159   return true;
 160 }
 161 
 162 #undef gen
 163 
 164 


 403   assert(elem_type->is_klass(), "not a class");
 404   jint dims[5];
 405   dims[0] = len1;
 406   dims[1] = len2;
 407   dims[2] = len3;
 408   dims[3] = len4;
 409   dims[4] = len5;
 410   oop obj = ArrayKlass::cast(elem_type)->multi_allocate(5, dims, THREAD);
 411   deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
 412   thread->set_vm_result(obj);
 413 JRT_END
 414 
 415 JRT_ENTRY(void, OptoRuntime::multianewarrayN_C(Klass* elem_type, arrayOopDesc* dims, JavaThread *thread))
 416   assert(check_compiled_frame(thread), "incorrect caller");
 417   assert(elem_type->is_klass(), "not a class");
 418   assert(oop(dims)->is_typeArray(), "not an array");
 419 
 420   ResourceMark rm;
 421   jint len = dims->length();
 422   assert(len > 0, "Dimensions array should contain data");
 423   jint *j_dims = typeArrayOop(dims)->int_at_addr(0);
 424   jint *c_dims = NEW_RESOURCE_ARRAY(jint, len);
 425   Copy::conjoint_jints_atomic(j_dims, c_dims, len);
 426 
 427   oop obj = ArrayKlass::cast(elem_type)->multi_allocate(len, c_dims, THREAD);
 428   deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
 429   thread->set_vm_result(obj);
 430 JRT_END
 431 
 432 JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notify_C(oopDesc* obj, JavaThread *thread))
 433 
 434   // Very few notify/notifyAll operations find any threads on the waitset, so
 435   // the dominant fast-path is to simply return.
 436   // Relatedly, it's critical that notify/notifyAll be fast in order to
 437   // reduce lock hold times.

 438   if (!SafepointSynchronize::is_synchronizing()) {
 439     if (ObjectSynchronizer::quick_notify(obj, thread, false)) {
 440       return;
 441     }
 442   }
 443 
 444   // This is the case the fast-path above isn't provisioned to handle.
 445   // The fast-path is designed to handle frequently arising cases in an efficient manner.
 446   // (The fast-path is just a degenerate variant of the slow-path).
 447   // Perform the dreaded state transition and pass control into the slow-path.
 448   JRT_BLOCK;
 449   Handle h_obj(THREAD, obj);
 450   ObjectSynchronizer::notify(h_obj, CHECK);
 451   JRT_BLOCK_END;
 452 JRT_END
 453 
 454 JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notifyAll_C(oopDesc* obj, JavaThread *thread))
 455 

 456   if (!SafepointSynchronize::is_synchronizing() ) {
 457     if (ObjectSynchronizer::quick_notify(obj, thread, true)) {
 458       return;
 459     }
 460   }
 461 
 462   // This is the case the fast-path above isn't provisioned to handle.
 463   // The fast-path is designed to handle frequently arising cases in an efficient manner.
 464   // (The fast-path is just a degenerate variant of the slow-path).
 465   // Perform the dreaded state transition and pass control into the slow-path.
 466   JRT_BLOCK;
 467   Handle h_obj(THREAD, obj);
 468   ObjectSynchronizer::notifyall(h_obj, CHECK);
 469   JRT_BLOCK_END;
 470 JRT_END
 471 
 472 const TypeFunc *OptoRuntime::new_instance_Type() {
 473   // create input type (domain)
 474   const Type **fields = TypeTuple::fields(1);
 475   fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated


 574   fields = TypeTuple::fields(0);
 575   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
 576 
 577   return TypeFunc::make(domain, range);
 578 }
 579 
 580 const TypeFunc *OptoRuntime::g1_wb_post_Type() {
 581 
 582   const Type **fields = TypeTuple::fields(2);
 583   fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL;  // Card addr
 584   fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL;  // thread
 585   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);
 586 
 587   // create result type (range)
 588   fields = TypeTuple::fields(0);
 589   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields);
 590 
 591   return TypeFunc::make(domain, range);
 592 }
 593 



























 594 const TypeFunc *OptoRuntime::uncommon_trap_Type() {
 595   // create input type (domain)
 596   const Type **fields = TypeTuple::fields(1);
 597   fields[TypeFunc::Parms+0] = TypeInt::INT; // trap_reason (deopt reason and action)
 598   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields);
 599 
 600   // create result type (range)
 601   fields = TypeTuple::fields(0);
 602   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
 603 
 604   return TypeFunc::make(domain, range);
 605 }
 606 
 607 # ifdef ENABLE_ZAP_DEAD_LOCALS
 608 // Type used for stub generation for zap_dead_locals.
 609 // No inputs or outputs
 610 const TypeFunc *OptoRuntime::zap_dead_locals_Type() {
 611   // create input type (domain)
 612   const Type **fields = TypeTuple::fields(0);
 613   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms,fields);


1503 
1504   return TypeFunc::make(domain,range);
1505 }
1506 
1507 const TypeFunc *OptoRuntime::dtrace_object_alloc_Type() {
1508   // create input type (domain)
1509   const Type **fields = TypeTuple::fields(2);
1510   fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage
1511   fields[TypeFunc::Parms+1] = TypeInstPtr::NOTNULL;  // oop;    newly allocated object
1512 
1513   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
1514 
1515   // create result type (range)
1516   fields = TypeTuple::fields(0);
1517 
1518   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
1519 
1520   return TypeFunc::make(domain,range);
1521 }
1522 































1523 
1524 JRT_ENTRY_NO_ASYNC(void, OptoRuntime::register_finalizer(oopDesc* obj, JavaThread* thread))
1525   assert(obj->is_oop(), "must be a valid oop");
1526   assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
1527   InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
1528 JRT_END
1529 
1530 //-----------------------------------------------------------------------------
1531 
1532 NamedCounter * volatile OptoRuntime::_named_counters = NULL;
1533 
1534 //
1535 // dump the collected NamedCounters.
1536 //
1537 void OptoRuntime::print_named_counters() {
1538   int total_lock_count = 0;
1539   int eliminated_lock_count = 0;
1540 
1541   NamedCounter* c = _named_counters;
1542   while (c) {




  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  *
  23  */
  24 
  25 #include "precompiled.hpp"
  26 #include "classfile/systemDictionary.hpp"
  27 #include "classfile/vmSymbols.hpp"
  28 #include "code/codeCache.hpp"
  29 #include "code/compiledIC.hpp"
  30 #include "code/icBuffer.hpp"
  31 #include "code/nmethod.hpp"
  32 #include "code/pcDesc.hpp"
  33 #include "code/scopeDesc.hpp"
  34 #include "code/vtableStubs.hpp"
  35 #include "compiler/compileBroker.hpp"
  36 #include "compiler/oopMap.hpp"
  37 #include "gc/shenandoah/shenandoahBarrierSet.hpp"
  38 #include "gc/g1/g1SATBCardTableModRefBS.hpp"
  39 #include "gc/g1/heapRegion.hpp"
  40 #include "gc/shared/barrierSet.hpp"
  41 #include "gc/shared/collectedHeap.hpp"
  42 #include "gc/shared/gcLocker.inline.hpp"
  43 #include "interpreter/bytecode.hpp"
  44 #include "interpreter/interpreter.hpp"
  45 #include "interpreter/linkResolver.hpp"
  46 #include "memory/oopFactory.hpp"
  47 #include "oops/objArrayKlass.hpp"
  48 #include "oops/oop.inline.hpp"
  49 #include "opto/ad.hpp"
  50 #include "opto/addnode.hpp"
  51 #include "opto/callnode.hpp"
  52 #include "opto/cfgnode.hpp"
  53 #include "opto/graphKit.hpp"
  54 #include "opto/machnode.hpp"
  55 #include "opto/matcher.hpp"
  56 #include "opto/memnode.hpp"
  57 #include "opto/mulnode.hpp"


  75 // For debugging purposes:
  76 //  To force FullGCALot inside a runtime function, add the following two lines
  77 //
  78 //  Universe::release_fullgc_alot_dummy();
  79 //  MarkSweep::invoke(0, "Debugging");
  80 //
  81 // At command line specify the parameters: -XX:+FullGCALot -XX:FullGCALotStart=100000000
  82 
  83 
  84 
  85 
  86 // Compiled code entry points
  87 address OptoRuntime::_new_instance_Java                           = NULL;
  88 address OptoRuntime::_new_array_Java                              = NULL;
  89 address OptoRuntime::_new_array_nozero_Java                       = NULL;
  90 address OptoRuntime::_multianewarray2_Java                        = NULL;
  91 address OptoRuntime::_multianewarray3_Java                        = NULL;
  92 address OptoRuntime::_multianewarray4_Java                        = NULL;
  93 address OptoRuntime::_multianewarray5_Java                        = NULL;
  94 address OptoRuntime::_multianewarrayN_Java                        = NULL;
  95 address OptoRuntime::_shenandoah_write_barrier_Java               = NULL;
  96 address OptoRuntime::_g1_wb_pre_Java                              = NULL;
  97 address OptoRuntime::_g1_wb_post_Java                             = NULL;
  98 address OptoRuntime::_vtable_must_compile_Java                    = NULL;
  99 address OptoRuntime::_complete_monitor_locking_Java               = NULL;
 100 address OptoRuntime::_monitor_notify_Java                         = NULL;
 101 address OptoRuntime::_monitor_notifyAll_Java                      = NULL;
 102 address OptoRuntime::_rethrow_Java                                = NULL;
 103 
 104 address OptoRuntime::_slow_arraycopy_Java                         = NULL;
 105 address OptoRuntime::_register_finalizer_Java                     = NULL;
 106 
 107 # ifdef ENABLE_ZAP_DEAD_LOCALS
 108 address OptoRuntime::_zap_dead_Java_locals_Java                   = NULL;
 109 address OptoRuntime::_zap_dead_native_locals_Java                 = NULL;
 110 # endif
 111 
 112 ExceptionBlob* OptoRuntime::_exception_blob;
 113 
 114 // This should be called in an assertion at the start of OptoRuntime routines
 115 // which are entered from compiled code (all of them)


 127 #define gen(env, var, type_func_gen, c_func, fancy_jump, pass_tls, save_arg_regs, return_pc) \
 128   var = generate_stub(env, type_func_gen, CAST_FROM_FN_PTR(address, c_func), #var, fancy_jump, pass_tls, save_arg_regs, return_pc); \
 129   if (var == NULL) { return false; }
 130 
 131 bool OptoRuntime::generate(ciEnv* env) {
 132 
 133   generate_exception_blob();
 134 
 135   // Note: tls: Means fetching the return oop out of the thread-local storage
 136   //
 137   //   variable/name                       type-function-gen              , runtime method                  ,fncy_jp, tls,save_args,retpc
 138   // -------------------------------------------------------------------------------------------------------------------------------
 139   gen(env, _new_instance_Java              , new_instance_Type            , new_instance_C                  ,    0 , true , false, false);
 140   gen(env, _new_array_Java                 , new_array_Type               , new_array_C                     ,    0 , true , false, false);
 141   gen(env, _new_array_nozero_Java          , new_array_Type               , new_array_nozero_C              ,    0 , true , false, false);
 142   gen(env, _multianewarray2_Java           , multianewarray2_Type         , multianewarray2_C               ,    0 , true , false, false);
 143   gen(env, _multianewarray3_Java           , multianewarray3_Type         , multianewarray3_C               ,    0 , true , false, false);
 144   gen(env, _multianewarray4_Java           , multianewarray4_Type         , multianewarray4_C               ,    0 , true , false, false);
 145   gen(env, _multianewarray5_Java           , multianewarray5_Type         , multianewarray5_C               ,    0 , true , false, false);
 146   gen(env, _multianewarrayN_Java           , multianewarrayN_Type         , multianewarrayN_C               ,    0 , true , false, false);
 147   gen(env, _shenandoah_write_barrier_Java  , shenandoah_write_barrier_Type, ShenandoahBarrierSet::resolve_and_maybe_copy_oop_c2, 0, false, false, false);
 148   gen(env, _g1_wb_pre_Java                 , g1_wb_pre_Type               , SharedRuntime::g1_wb_pre        ,    0 , false, false, false);
 149   gen(env, _g1_wb_post_Java                , g1_wb_post_Type              , SharedRuntime::g1_wb_post       ,    0 , false, false, false);
 150   gen(env, _complete_monitor_locking_Java  , complete_monitor_enter_Type  , SharedRuntime::complete_monitor_locking_C, 0, false, false, false);
 151   gen(env, _monitor_notify_Java            , monitor_notify_Type          , monitor_notify_C                ,    0 , false, false, false);
 152   gen(env, _monitor_notifyAll_Java         , monitor_notify_Type          , monitor_notifyAll_C             ,    0 , false, false, false);
 153   gen(env, _rethrow_Java                   , rethrow_Type                 , rethrow_C                       ,    2 , true , false, true );
 154 
 155   gen(env, _slow_arraycopy_Java            , slow_arraycopy_Type          , SharedRuntime::slow_arraycopy_C ,    0 , false, false, false);
 156   gen(env, _register_finalizer_Java        , register_finalizer_Type      , register_finalizer              ,    0 , false, false, false);
 157 
 158 # ifdef ENABLE_ZAP_DEAD_LOCALS
 159   gen(env, _zap_dead_Java_locals_Java      , zap_dead_locals_Type         , zap_dead_Java_locals_C          ,    0 , false, true , false );
 160   gen(env, _zap_dead_native_locals_Java    , zap_dead_locals_Type         , zap_dead_native_locals_C        ,    0 , false, true , false );
 161 # endif
 162   return true;
 163 }
 164 
 165 #undef gen
 166 
 167 


 406   assert(elem_type->is_klass(), "not a class");
 407   jint dims[5];
 408   dims[0] = len1;
 409   dims[1] = len2;
 410   dims[2] = len3;
 411   dims[3] = len4;
 412   dims[4] = len5;
 413   oop obj = ArrayKlass::cast(elem_type)->multi_allocate(5, dims, THREAD);
 414   deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
 415   thread->set_vm_result(obj);
 416 JRT_END
 417 
 418 JRT_ENTRY(void, OptoRuntime::multianewarrayN_C(Klass* elem_type, arrayOopDesc* dims, JavaThread *thread))
 419   assert(check_compiled_frame(thread), "incorrect caller");
 420   assert(elem_type->is_klass(), "not a class");
 421   assert(oop(dims)->is_typeArray(), "not an array");
 422 
 423   ResourceMark rm;
 424   jint len = dims->length();
 425   assert(len > 0, "Dimensions array should contain data");
 426   jint *j_dims = typeArrayOop(oopDesc::bs()->read_barrier(dims))->int_at_addr(0);
 427   jint *c_dims = NEW_RESOURCE_ARRAY(jint, len);
 428   Copy::conjoint_jints_atomic(j_dims, c_dims, len);
 429 
 430   oop obj = ArrayKlass::cast(elem_type)->multi_allocate(len, c_dims, THREAD);
 431   deoptimize_caller_frame(thread, HAS_PENDING_EXCEPTION);
 432   thread->set_vm_result(obj);
 433 JRT_END
 434 
 435 JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notify_C(oopDesc* obj, JavaThread *thread))
 436 
 437   // Very few notify/notifyAll operations find any threads on the waitset, so
 438   // the dominant fast-path is to simply return.
 439   // Relatedly, it's critical that notify/notifyAll be fast in order to
 440   // reduce lock hold times.
 441   obj = oopDesc::bs()->write_barrier(obj);
 442   if (!SafepointSynchronize::is_synchronizing()) {
 443     if (ObjectSynchronizer::quick_notify(obj, thread, false)) {
 444       return;
 445     }
 446   }
 447 
 448   // This is the case the fast-path above isn't provisioned to handle.
 449   // The fast-path is designed to handle frequently arising cases in an efficient manner.
 450   // (The fast-path is just a degenerate variant of the slow-path).
 451   // Perform the dreaded state transition and pass control into the slow-path.
 452   JRT_BLOCK;
 453   Handle h_obj(THREAD, obj);
 454   ObjectSynchronizer::notify(h_obj, CHECK);
 455   JRT_BLOCK_END;
 456 JRT_END
 457 
 458 JRT_BLOCK_ENTRY(void, OptoRuntime::monitor_notifyAll_C(oopDesc* obj, JavaThread *thread))
 459 
 460   obj = oopDesc::bs()->write_barrier(obj);
 461   if (!SafepointSynchronize::is_synchronizing() ) {
 462     if (ObjectSynchronizer::quick_notify(obj, thread, true)) {
 463       return;
 464     }
 465   }
 466 
 467   // This is the case the fast-path above isn't provisioned to handle.
 468   // The fast-path is designed to handle frequently arising cases in an efficient manner.
 469   // (The fast-path is just a degenerate variant of the slow-path).
 470   // Perform the dreaded state transition and pass control into the slow-path.
 471   JRT_BLOCK;
 472   Handle h_obj(THREAD, obj);
 473   ObjectSynchronizer::notifyall(h_obj, CHECK);
 474   JRT_BLOCK_END;
 475 JRT_END
 476 
 477 const TypeFunc *OptoRuntime::new_instance_Type() {
 478   // create input type (domain)
 479   const Type **fields = TypeTuple::fields(1);
 480   fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // Klass to be allocated


 579   fields = TypeTuple::fields(0);
 580   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
 581 
 582   return TypeFunc::make(domain, range);
 583 }
 584 
 585 const TypeFunc *OptoRuntime::g1_wb_post_Type() {
 586 
 587   const Type **fields = TypeTuple::fields(2);
 588   fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL;  // Card addr
 589   fields[TypeFunc::Parms+1] = TypeRawPtr::NOTNULL;  // thread
 590   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2, fields);
 591 
 592   // create result type (range)
 593   fields = TypeTuple::fields(0);
 594   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms, fields);
 595 
 596   return TypeFunc::make(domain, range);
 597 }
 598 
 599 const TypeFunc *OptoRuntime::shenandoah_clone_barrier_Type() {
 600   const Type **fields = TypeTuple::fields(1);
 601   fields[TypeFunc::Parms+0] = TypeInstPtr::NOTNULL; // original field value
 602   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields);
 603 
 604   // create result type (range)
 605   fields = TypeTuple::fields(0);
 606   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
 607 
 608   return TypeFunc::make(domain, range);
 609 }
 610 
 611 const TypeFunc *OptoRuntime::shenandoah_cas_obj_Type() {
 612   const Type **fields = TypeTuple::fields(3);
 613   fields[TypeFunc::Parms+0] = TypeRawPtr::NOTNULL; // Address
 614   fields[TypeFunc::Parms+1] = TypeInstPtr::BOTTOM;  // New value
 615   fields[TypeFunc::Parms+2] = TypeInstPtr::BOTTOM;  // Expected value
 616   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+3, fields);
 617 
 618   // create result type (range)
 619   fields = TypeTuple::fields(1);
 620   fields[TypeFunc::Parms+0] = TypeInt::BOOL;
 621   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+1, fields);
 622 
 623   return TypeFunc::make(domain, range);
 624 }
 625 
 626 const TypeFunc *OptoRuntime::uncommon_trap_Type() {
 627   // create input type (domain)
 628   const Type **fields = TypeTuple::fields(1);
 629   fields[TypeFunc::Parms+0] = TypeInt::INT; // trap_reason (deopt reason and action)
 630   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+1, fields);
 631 
 632   // create result type (range)
 633   fields = TypeTuple::fields(0);
 634   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0, fields);
 635 
 636   return TypeFunc::make(domain, range);
 637 }
 638 
 639 # ifdef ENABLE_ZAP_DEAD_LOCALS
 640 // Type used for stub generation for zap_dead_locals.
 641 // No inputs or outputs
 642 const TypeFunc *OptoRuntime::zap_dead_locals_Type() {
 643   // create input type (domain)
 644   const Type **fields = TypeTuple::fields(0);
 645   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms,fields);


1535 
1536   return TypeFunc::make(domain,range);
1537 }
1538 
1539 const TypeFunc *OptoRuntime::dtrace_object_alloc_Type() {
1540   // create input type (domain)
1541   const Type **fields = TypeTuple::fields(2);
1542   fields[TypeFunc::Parms+0] = TypeRawPtr::BOTTOM; // Thread-local storage
1543   fields[TypeFunc::Parms+1] = TypeInstPtr::NOTNULL;  // oop;    newly allocated object
1544 
1545   const TypeTuple *domain = TypeTuple::make(TypeFunc::Parms+2,fields);
1546 
1547   // create result type (range)
1548   fields = TypeTuple::fields(0);
1549 
1550   const TypeTuple *range = TypeTuple::make(TypeFunc::Parms+0,fields);
1551 
1552   return TypeFunc::make(domain,range);
1553 }
1554 
1555 /**
1556  * oop write_barrier_static(oop obj)
1557  * oop read_barrier_static(oop obj)
1558  */
1559 const TypeFunc* OptoRuntime::shenandoah_barrier_Type(const Type* type) {
1560   // create input type (domain)
1561   const Type** fields = TypeTuple::fields(1);
1562   fields[TypeFunc::Parms+0] = type;
1563 
1564   const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+1, fields);
1565 
1566   // result type needed
1567   fields = TypeTuple::fields(1);
1568   fields[TypeFunc::Parms+0] = type;
1569   const TypeTuple* range = TypeTuple::make(TypeFunc::Parms + 1, fields);
1570   return TypeFunc::make(domain, range);
1571 }
1572 
1573 const TypeFunc* OptoRuntime::shenandoah_write_barrier_Type() {
1574   // create input type (domain)
1575   const Type** fields = TypeTuple::fields(1);
1576   fields[TypeFunc::Parms+0] = TypeOopPtr::NOTNULL;
1577 
1578   const TypeTuple* domain = TypeTuple::make(TypeFunc::Parms+1, fields);
1579 
1580   // result type needed
1581   fields = TypeTuple::fields(1);
1582   fields[TypeFunc::Parms+0] = TypeOopPtr::NOTNULL;
1583   const TypeTuple* range = TypeTuple::make(TypeFunc::Parms + 1, fields);
1584   return TypeFunc::make(domain, range);
1585 }
1586 
1587 JRT_ENTRY_NO_ASYNC(void, OptoRuntime::register_finalizer(oopDesc* obj, JavaThread* thread))
1588   assert(obj->is_oop(), "must be a valid oop");
1589   assert(obj->klass()->has_finalizer(), "shouldn't be here otherwise");
1590   InstanceKlass::register_finalizer(instanceOop(obj), CHECK);
1591 JRT_END
1592 
1593 //-----------------------------------------------------------------------------
1594 
1595 NamedCounter * volatile OptoRuntime::_named_counters = NULL;
1596 
1597 //
1598 // dump the collected NamedCounters.
1599 //
1600 void OptoRuntime::print_named_counters() {
1601   int total_lock_count = 0;
1602   int eliminated_lock_count = 0;
1603 
1604   NamedCounter* c = _named_counters;
1605   while (c) {


< prev index next >