< prev index next >

src/hotspot/share/c1/c1_Runtime1.cpp

Print this page


  35 #include "code/codeBlob.hpp"
  36 #include "code/compiledIC.hpp"
  37 #include "code/pcDesc.hpp"
  38 #include "code/scopeDesc.hpp"
  39 #include "code/vtableStubs.hpp"
  40 #include "compiler/disassembler.hpp"
  41 #include "gc/shared/barrierSet.hpp"
  42 #include "gc/shared/c1/barrierSetC1.hpp"
  43 #include "gc/shared/collectedHeap.hpp"
  44 #include "interpreter/bytecode.hpp"
  45 #include "interpreter/interpreter.hpp"
  46 #include "jfr/support/jfrIntrinsics.hpp"
  47 #include "logging/log.hpp"
  48 #include "memory/allocation.inline.hpp"
  49 #include "memory/oopFactory.hpp"
  50 #include "memory/resourceArea.hpp"
  51 #include "oops/access.inline.hpp"
  52 #include "oops/objArrayOop.inline.hpp"
  53 #include "oops/objArrayKlass.hpp"
  54 #include "oops/oop.inline.hpp"


  55 #include "runtime/atomic.hpp"
  56 #include "runtime/biasedLocking.hpp"
  57 #include "runtime/compilationPolicy.hpp"
  58 #include "runtime/fieldDescriptor.inline.hpp"
  59 #include "runtime/frame.inline.hpp"
  60 #include "runtime/interfaceSupport.inline.hpp"
  61 #include "runtime/javaCalls.hpp"
  62 #include "runtime/sharedRuntime.hpp"
  63 #include "runtime/threadCritical.hpp"
  64 #include "runtime/vframe.inline.hpp"
  65 #include "runtime/vframeArray.hpp"
  66 #include "runtime/vm_version.hpp"
  67 #include "utilities/copy.hpp"
  68 #include "utilities/events.hpp"
  69 
  70 
  71 // Implementation of StubAssembler
  72 
  73 StubAssembler::StubAssembler(CodeBuffer* code, const char * name, int stub_id) : C1_MacroAssembler(code) {
  74   _name = name;


 101 }
 102 
 103 // Implementation of Runtime1
 104 
 105 CodeBlob* Runtime1::_blobs[Runtime1::number_of_ids];
 106 const char *Runtime1::_blob_names[] = {
 107   RUNTIME1_STUBS(STUB_NAME, LAST_STUB_NAME)
 108 };
 109 
 110 #ifndef PRODUCT
 111 // statistics
 112 int Runtime1::_generic_arraycopy_cnt = 0;
 113 int Runtime1::_generic_arraycopystub_cnt = 0;
 114 int Runtime1::_arraycopy_slowcase_cnt = 0;
 115 int Runtime1::_arraycopy_checkcast_cnt = 0;
 116 int Runtime1::_arraycopy_checkcast_attempt_cnt = 0;
 117 int Runtime1::_new_type_array_slowcase_cnt = 0;
 118 int Runtime1::_new_object_array_slowcase_cnt = 0;
 119 int Runtime1::_new_instance_slowcase_cnt = 0;
 120 int Runtime1::_new_multi_array_slowcase_cnt = 0;

 121 int Runtime1::_monitorenter_slowcase_cnt = 0;
 122 int Runtime1::_monitorexit_slowcase_cnt = 0;
 123 int Runtime1::_patch_code_slowcase_cnt = 0;
 124 int Runtime1::_throw_range_check_exception_count = 0;
 125 int Runtime1::_throw_index_exception_count = 0;
 126 int Runtime1::_throw_div0_exception_count = 0;
 127 int Runtime1::_throw_null_pointer_exception_count = 0;
 128 int Runtime1::_throw_class_cast_exception_count = 0;
 129 int Runtime1::_throw_incompatible_class_change_error_count = 0;
 130 int Runtime1::_throw_illegal_monitor_state_exception_count = 0;
 131 int Runtime1::_throw_array_store_exception_count = 0;
 132 int Runtime1::_throw_count = 0;
 133 
 134 static int _byte_arraycopy_stub_cnt = 0;
 135 static int _short_arraycopy_stub_cnt = 0;
 136 static int _int_arraycopy_stub_cnt = 0;
 137 static int _long_arraycopy_stub_cnt = 0;
 138 static int _oop_arraycopy_stub_cnt = 0;
 139 
 140 address Runtime1::arraycopy_count_address(BasicType type) {


 395   }
 396   // This is pretty rare but this runtime patch is stressful to deoptimization
 397   // if we deoptimize here so force a deopt to stress the path.
 398   if (DeoptimizeALot) {
 399     deopt_caller();
 400   }
 401 JRT_END
 402 
 403 
 404 JRT_ENTRY(void, Runtime1::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims))
 405   NOT_PRODUCT(_new_multi_array_slowcase_cnt++;)
 406 
 407   assert(klass->is_klass(), "not a class");
 408   assert(rank >= 1, "rank must be nonzero");
 409   Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
 410   oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
 411   thread->set_vm_result(obj);
 412 JRT_END
 413 
 414 





















 415 JRT_ENTRY(void, Runtime1::unimplemented_entry(JavaThread* thread, StubID id))
 416   tty->print_cr("Runtime1::entry_for(%d) returned unimplemented entry point", id);
 417 JRT_END
 418 
 419 
 420 JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread, oopDesc* obj))
 421   ResourceMark rm(thread);
 422   const char* klass_name = obj->klass()->external_name();
 423   SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayStoreException(), klass_name);
 424 JRT_END
 425 
 426 
 427 // counter_overflow() is called from within C1-compiled methods. The enclosing method is the method
 428 // associated with the top activation record. The inlinee (that is possibly included in the enclosing
 429 // method) method oop is passed as an argument. In order to do that it is embedded in the code as
 430 // a constant.
 431 static nmethod* counter_overflow_helper(JavaThread* THREAD, int branch_bci, Method* m) {
 432   nmethod* osr_nm = NULL;
 433   methodHandle method(THREAD, m);
 434 


1483   tty->print_cr(" _resolve_invoke_virtual_cnt:     %d", SharedRuntime::_resolve_virtual_ctr);
1484   tty->print_cr(" _resolve_invoke_opt_virtual_cnt: %d", SharedRuntime::_resolve_opt_virtual_ctr);
1485   tty->print_cr(" _resolve_invoke_static_cnt:      %d", SharedRuntime::_resolve_static_ctr);
1486   tty->print_cr(" _handle_wrong_method_cnt:        %d", SharedRuntime::_wrong_method_ctr);
1487   tty->print_cr(" _ic_miss_cnt:                    %d", SharedRuntime::_ic_miss_ctr);
1488   tty->print_cr(" _generic_arraycopy_cnt:          %d", _generic_arraycopy_cnt);
1489   tty->print_cr(" _generic_arraycopystub_cnt:      %d", _generic_arraycopystub_cnt);
1490   tty->print_cr(" _byte_arraycopy_cnt:             %d", _byte_arraycopy_stub_cnt);
1491   tty->print_cr(" _short_arraycopy_cnt:            %d", _short_arraycopy_stub_cnt);
1492   tty->print_cr(" _int_arraycopy_cnt:              %d", _int_arraycopy_stub_cnt);
1493   tty->print_cr(" _long_arraycopy_cnt:             %d", _long_arraycopy_stub_cnt);
1494   tty->print_cr(" _oop_arraycopy_cnt:              %d", _oop_arraycopy_stub_cnt);
1495   tty->print_cr(" _arraycopy_slowcase_cnt:         %d", _arraycopy_slowcase_cnt);
1496   tty->print_cr(" _arraycopy_checkcast_cnt:        %d", _arraycopy_checkcast_cnt);
1497   tty->print_cr(" _arraycopy_checkcast_attempt_cnt:%d", _arraycopy_checkcast_attempt_cnt);
1498 
1499   tty->print_cr(" _new_type_array_slowcase_cnt:    %d", _new_type_array_slowcase_cnt);
1500   tty->print_cr(" _new_object_array_slowcase_cnt:  %d", _new_object_array_slowcase_cnt);
1501   tty->print_cr(" _new_instance_slowcase_cnt:      %d", _new_instance_slowcase_cnt);
1502   tty->print_cr(" _new_multi_array_slowcase_cnt:   %d", _new_multi_array_slowcase_cnt);

1503   tty->print_cr(" _monitorenter_slowcase_cnt:      %d", _monitorenter_slowcase_cnt);
1504   tty->print_cr(" _monitorexit_slowcase_cnt:       %d", _monitorexit_slowcase_cnt);
1505   tty->print_cr(" _patch_code_slowcase_cnt:        %d", _patch_code_slowcase_cnt);
1506 
1507   tty->print_cr(" _throw_range_check_exception_count:            %d:", _throw_range_check_exception_count);
1508   tty->print_cr(" _throw_index_exception_count:                  %d:", _throw_index_exception_count);
1509   tty->print_cr(" _throw_div0_exception_count:                   %d:", _throw_div0_exception_count);
1510   tty->print_cr(" _throw_null_pointer_exception_count:           %d:", _throw_null_pointer_exception_count);
1511   tty->print_cr(" _throw_class_cast_exception_count:             %d:", _throw_class_cast_exception_count);
1512   tty->print_cr(" _throw_incompatible_class_change_error_count:  %d:", _throw_incompatible_class_change_error_count);
1513   tty->print_cr(" _throw_illegal_monitor_state_exception_count:  %d:", _throw_illegal_monitor_state_exception_count);
1514   tty->print_cr(" _throw_array_store_exception_count:            %d:", _throw_array_store_exception_count);
1515   tty->print_cr(" _throw_count:                                  %d:", _throw_count);
1516 
1517   SharedRuntime::print_ic_miss_histogram();
1518   tty->cr();
1519 }
1520 #endif // PRODUCT


  35 #include "code/codeBlob.hpp"
  36 #include "code/compiledIC.hpp"
  37 #include "code/pcDesc.hpp"
  38 #include "code/scopeDesc.hpp"
  39 #include "code/vtableStubs.hpp"
  40 #include "compiler/disassembler.hpp"
  41 #include "gc/shared/barrierSet.hpp"
  42 #include "gc/shared/c1/barrierSetC1.hpp"
  43 #include "gc/shared/collectedHeap.hpp"
  44 #include "interpreter/bytecode.hpp"
  45 #include "interpreter/interpreter.hpp"
  46 #include "jfr/support/jfrIntrinsics.hpp"
  47 #include "logging/log.hpp"
  48 #include "memory/allocation.inline.hpp"
  49 #include "memory/oopFactory.hpp"
  50 #include "memory/resourceArea.hpp"
  51 #include "oops/access.inline.hpp"
  52 #include "oops/objArrayOop.inline.hpp"
  53 #include "oops/objArrayKlass.hpp"
  54 #include "oops/oop.inline.hpp"
  55 #include "oops/valueArrayKlass.hpp"
  56 #include "oops/valueArrayOop.inline.hpp"
  57 #include "runtime/atomic.hpp"
  58 #include "runtime/biasedLocking.hpp"
  59 #include "runtime/compilationPolicy.hpp"
  60 #include "runtime/fieldDescriptor.inline.hpp"
  61 #include "runtime/frame.inline.hpp"
  62 #include "runtime/interfaceSupport.inline.hpp"
  63 #include "runtime/javaCalls.hpp"
  64 #include "runtime/sharedRuntime.hpp"
  65 #include "runtime/threadCritical.hpp"
  66 #include "runtime/vframe.inline.hpp"
  67 #include "runtime/vframeArray.hpp"
  68 #include "runtime/vm_version.hpp"
  69 #include "utilities/copy.hpp"
  70 #include "utilities/events.hpp"
  71 
  72 
  73 // Implementation of StubAssembler
  74 
  75 StubAssembler::StubAssembler(CodeBuffer* code, const char * name, int stub_id) : C1_MacroAssembler(code) {
  76   _name = name;


 103 }
 104 
 105 // Implementation of Runtime1
 106 
 107 CodeBlob* Runtime1::_blobs[Runtime1::number_of_ids];
 108 const char *Runtime1::_blob_names[] = {
 109   RUNTIME1_STUBS(STUB_NAME, LAST_STUB_NAME)
 110 };
 111 
 112 #ifndef PRODUCT
 113 // statistics
 114 int Runtime1::_generic_arraycopy_cnt = 0;
 115 int Runtime1::_generic_arraycopystub_cnt = 0;
 116 int Runtime1::_arraycopy_slowcase_cnt = 0;
 117 int Runtime1::_arraycopy_checkcast_cnt = 0;
 118 int Runtime1::_arraycopy_checkcast_attempt_cnt = 0;
 119 int Runtime1::_new_type_array_slowcase_cnt = 0;
 120 int Runtime1::_new_object_array_slowcase_cnt = 0;
 121 int Runtime1::_new_instance_slowcase_cnt = 0;
 122 int Runtime1::_new_multi_array_slowcase_cnt = 0;
 123 int Runtime1::_load_flattened_array_slowcase_cnt = 0;
 124 int Runtime1::_monitorenter_slowcase_cnt = 0;
 125 int Runtime1::_monitorexit_slowcase_cnt = 0;
 126 int Runtime1::_patch_code_slowcase_cnt = 0;
 127 int Runtime1::_throw_range_check_exception_count = 0;
 128 int Runtime1::_throw_index_exception_count = 0;
 129 int Runtime1::_throw_div0_exception_count = 0;
 130 int Runtime1::_throw_null_pointer_exception_count = 0;
 131 int Runtime1::_throw_class_cast_exception_count = 0;
 132 int Runtime1::_throw_incompatible_class_change_error_count = 0;
 133 int Runtime1::_throw_illegal_monitor_state_exception_count = 0;
 134 int Runtime1::_throw_array_store_exception_count = 0;
 135 int Runtime1::_throw_count = 0;
 136 
 137 static int _byte_arraycopy_stub_cnt = 0;
 138 static int _short_arraycopy_stub_cnt = 0;
 139 static int _int_arraycopy_stub_cnt = 0;
 140 static int _long_arraycopy_stub_cnt = 0;
 141 static int _oop_arraycopy_stub_cnt = 0;
 142 
 143 address Runtime1::arraycopy_count_address(BasicType type) {


 398   }
 399   // This is pretty rare but this runtime patch is stressful to deoptimization
 400   // if we deoptimize here so force a deopt to stress the path.
 401   if (DeoptimizeALot) {
 402     deopt_caller();
 403   }
 404 JRT_END
 405 
 406 
 407 JRT_ENTRY(void, Runtime1::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims))
 408   NOT_PRODUCT(_new_multi_array_slowcase_cnt++;)
 409 
 410   assert(klass->is_klass(), "not a class");
 411   assert(rank >= 1, "rank must be nonzero");
 412   Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
 413   oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
 414   thread->set_vm_result(obj);
 415 JRT_END
 416 
 417 
 418 JRT_ENTRY(void, Runtime1::load_flattened_array(JavaThread* thread, valueArrayOopDesc* array, int index))
 419   NOT_PRODUCT(_new_multi_array_slowcase_cnt++;)
 420   Klass* klass = array->klass();
 421   assert(klass->is_valueArray_klass(), "expected value array oop");
 422   assert(array->length() > 0 && index < array->length(), "already checked");
 423 
 424   ValueArrayKlass* vaklass = ValueArrayKlass::cast(klass);
 425   ValueKlass* vklass = vaklass->element_klass();
 426 
 427   // We have a non-empty flattened array, so the element type must have been initialized.
 428   assert(vklass->is_initialized(), "must be");
 429   Handle holder(THREAD, vklass->klass_holder()); // keep the vklass alive
 430   oop obj = vklass->allocate_instance(CHECK);
 431 
 432   void* src = array->value_at_addr(index, vaklass->layout_helper());
 433   vklass->value_store(src, vklass->data_for_oop(obj),
 434                       vaklass->element_byte_size(), true, false);
 435   thread->set_vm_result(obj);
 436 JRT_END
 437 
 438 
 439 JRT_ENTRY(void, Runtime1::unimplemented_entry(JavaThread* thread, StubID id))
 440   tty->print_cr("Runtime1::entry_for(%d) returned unimplemented entry point", id);
 441 JRT_END
 442 
 443 
 444 JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread, oopDesc* obj))
 445   ResourceMark rm(thread);
 446   const char* klass_name = obj->klass()->external_name();
 447   SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayStoreException(), klass_name);
 448 JRT_END
 449 
 450 
 451 // counter_overflow() is called from within C1-compiled methods. The enclosing method is the method
 452 // associated with the top activation record. The inlinee (that is possibly included in the enclosing
 453 // method) method oop is passed as an argument. In order to do that it is embedded in the code as
 454 // a constant.
 455 static nmethod* counter_overflow_helper(JavaThread* THREAD, int branch_bci, Method* m) {
 456   nmethod* osr_nm = NULL;
 457   methodHandle method(THREAD, m);
 458 


1507   tty->print_cr(" _resolve_invoke_virtual_cnt:     %d", SharedRuntime::_resolve_virtual_ctr);
1508   tty->print_cr(" _resolve_invoke_opt_virtual_cnt: %d", SharedRuntime::_resolve_opt_virtual_ctr);
1509   tty->print_cr(" _resolve_invoke_static_cnt:      %d", SharedRuntime::_resolve_static_ctr);
1510   tty->print_cr(" _handle_wrong_method_cnt:        %d", SharedRuntime::_wrong_method_ctr);
1511   tty->print_cr(" _ic_miss_cnt:                    %d", SharedRuntime::_ic_miss_ctr);
1512   tty->print_cr(" _generic_arraycopy_cnt:          %d", _generic_arraycopy_cnt);
1513   tty->print_cr(" _generic_arraycopystub_cnt:      %d", _generic_arraycopystub_cnt);
1514   tty->print_cr(" _byte_arraycopy_cnt:             %d", _byte_arraycopy_stub_cnt);
1515   tty->print_cr(" _short_arraycopy_cnt:            %d", _short_arraycopy_stub_cnt);
1516   tty->print_cr(" _int_arraycopy_cnt:              %d", _int_arraycopy_stub_cnt);
1517   tty->print_cr(" _long_arraycopy_cnt:             %d", _long_arraycopy_stub_cnt);
1518   tty->print_cr(" _oop_arraycopy_cnt:              %d", _oop_arraycopy_stub_cnt);
1519   tty->print_cr(" _arraycopy_slowcase_cnt:         %d", _arraycopy_slowcase_cnt);
1520   tty->print_cr(" _arraycopy_checkcast_cnt:        %d", _arraycopy_checkcast_cnt);
1521   tty->print_cr(" _arraycopy_checkcast_attempt_cnt:%d", _arraycopy_checkcast_attempt_cnt);
1522 
1523   tty->print_cr(" _new_type_array_slowcase_cnt:    %d", _new_type_array_slowcase_cnt);
1524   tty->print_cr(" _new_object_array_slowcase_cnt:  %d", _new_object_array_slowcase_cnt);
1525   tty->print_cr(" _new_instance_slowcase_cnt:      %d", _new_instance_slowcase_cnt);
1526   tty->print_cr(" _new_multi_array_slowcase_cnt:   %d", _new_multi_array_slowcase_cnt);
1527   tty->print_cr(" _load_flattened_array_slowcase_cnt:%d", _load_flattened_array_slowcase_cnt);
1528   tty->print_cr(" _monitorenter_slowcase_cnt:      %d", _monitorenter_slowcase_cnt);
1529   tty->print_cr(" _monitorexit_slowcase_cnt:       %d", _monitorexit_slowcase_cnt);
1530   tty->print_cr(" _patch_code_slowcase_cnt:        %d", _patch_code_slowcase_cnt);
1531 
1532   tty->print_cr(" _throw_range_check_exception_count:            %d:", _throw_range_check_exception_count);
1533   tty->print_cr(" _throw_index_exception_count:                  %d:", _throw_index_exception_count);
1534   tty->print_cr(" _throw_div0_exception_count:                   %d:", _throw_div0_exception_count);
1535   tty->print_cr(" _throw_null_pointer_exception_count:           %d:", _throw_null_pointer_exception_count);
1536   tty->print_cr(" _throw_class_cast_exception_count:             %d:", _throw_class_cast_exception_count);
1537   tty->print_cr(" _throw_incompatible_class_change_error_count:  %d:", _throw_incompatible_class_change_error_count);
1538   tty->print_cr(" _throw_illegal_monitor_state_exception_count:  %d:", _throw_illegal_monitor_state_exception_count);
1539   tty->print_cr(" _throw_array_store_exception_count:            %d:", _throw_array_store_exception_count);
1540   tty->print_cr(" _throw_count:                                  %d:", _throw_count);
1541 
1542   SharedRuntime::print_ic_miss_histogram();
1543   tty->cr();
1544 }
1545 #endif // PRODUCT
< prev index next >