< prev index next >

src/hotspot/share/c1/c1_Runtime1.cpp

Print this page


 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) {


 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


 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::_store_flattened_array_slowcase_cnt = 0;
 125 int Runtime1::_monitorenter_slowcase_cnt = 0;
 126 int Runtime1::_monitorexit_slowcase_cnt = 0;
 127 int Runtime1::_patch_code_slowcase_cnt = 0;
 128 int Runtime1::_throw_range_check_exception_count = 0;
 129 int Runtime1::_throw_index_exception_count = 0;
 130 int Runtime1::_throw_div0_exception_count = 0;
 131 int Runtime1::_throw_null_pointer_exception_count = 0;
 132 int Runtime1::_throw_class_cast_exception_count = 0;
 133 int Runtime1::_throw_incompatible_class_change_error_count = 0;
 134 int Runtime1::_throw_illegal_monitor_state_exception_count = 0;
 135 int Runtime1::_throw_array_store_exception_count = 0;
 136 int Runtime1::_throw_count = 0;
 137 
 138 static int _byte_arraycopy_stub_cnt = 0;
 139 static int _short_arraycopy_stub_cnt = 0;
 140 static int _int_arraycopy_stub_cnt = 0;
 141 static int _long_arraycopy_stub_cnt = 0;
 142 static int _oop_arraycopy_stub_cnt = 0;
 143 
 144 address Runtime1::arraycopy_count_address(BasicType type) {


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


1526   tty->print_cr(" _resolve_invoke_virtual_cnt:     %d", SharedRuntime::_resolve_virtual_ctr);
1527   tty->print_cr(" _resolve_invoke_opt_virtual_cnt: %d", SharedRuntime::_resolve_opt_virtual_ctr);
1528   tty->print_cr(" _resolve_invoke_static_cnt:      %d", SharedRuntime::_resolve_static_ctr);
1529   tty->print_cr(" _handle_wrong_method_cnt:        %d", SharedRuntime::_wrong_method_ctr);
1530   tty->print_cr(" _ic_miss_cnt:                    %d", SharedRuntime::_ic_miss_ctr);
1531   tty->print_cr(" _generic_arraycopy_cnt:          %d", _generic_arraycopy_cnt);
1532   tty->print_cr(" _generic_arraycopystub_cnt:      %d", _generic_arraycopystub_cnt);
1533   tty->print_cr(" _byte_arraycopy_cnt:             %d", _byte_arraycopy_stub_cnt);
1534   tty->print_cr(" _short_arraycopy_cnt:            %d", _short_arraycopy_stub_cnt);
1535   tty->print_cr(" _int_arraycopy_cnt:              %d", _int_arraycopy_stub_cnt);
1536   tty->print_cr(" _long_arraycopy_cnt:             %d", _long_arraycopy_stub_cnt);
1537   tty->print_cr(" _oop_arraycopy_cnt:              %d", _oop_arraycopy_stub_cnt);
1538   tty->print_cr(" _arraycopy_slowcase_cnt:         %d", _arraycopy_slowcase_cnt);
1539   tty->print_cr(" _arraycopy_checkcast_cnt:        %d", _arraycopy_checkcast_cnt);
1540   tty->print_cr(" _arraycopy_checkcast_attempt_cnt:%d", _arraycopy_checkcast_attempt_cnt);
1541 
1542   tty->print_cr(" _new_type_array_slowcase_cnt:    %d", _new_type_array_slowcase_cnt);
1543   tty->print_cr(" _new_object_array_slowcase_cnt:  %d", _new_object_array_slowcase_cnt);
1544   tty->print_cr(" _new_instance_slowcase_cnt:      %d", _new_instance_slowcase_cnt);
1545   tty->print_cr(" _new_multi_array_slowcase_cnt:   %d", _new_multi_array_slowcase_cnt);
1546   tty->print_cr(" _load_flattened_array_slowcase_cnt: %d", _load_flattened_array_slowcase_cnt);
1547   tty->print_cr(" _store_flattened_array_slowcase_cnt:%d", _store_flattened_array_slowcase_cnt);
1548   tty->print_cr(" _monitorenter_slowcase_cnt:      %d", _monitorenter_slowcase_cnt);
1549   tty->print_cr(" _monitorexit_slowcase_cnt:       %d", _monitorexit_slowcase_cnt);
1550   tty->print_cr(" _patch_code_slowcase_cnt:        %d", _patch_code_slowcase_cnt);
1551 
1552   tty->print_cr(" _throw_range_check_exception_count:            %d:", _throw_range_check_exception_count);
1553   tty->print_cr(" _throw_index_exception_count:                  %d:", _throw_index_exception_count);
1554   tty->print_cr(" _throw_div0_exception_count:                   %d:", _throw_div0_exception_count);
1555   tty->print_cr(" _throw_null_pointer_exception_count:           %d:", _throw_null_pointer_exception_count);
1556   tty->print_cr(" _throw_class_cast_exception_count:             %d:", _throw_class_cast_exception_count);
1557   tty->print_cr(" _throw_incompatible_class_change_error_count:  %d:", _throw_incompatible_class_change_error_count);
1558   tty->print_cr(" _throw_illegal_monitor_state_exception_count:  %d:", _throw_illegal_monitor_state_exception_count);
1559   tty->print_cr(" _throw_array_store_exception_count:            %d:", _throw_array_store_exception_count);
1560   tty->print_cr(" _throw_count:                                  %d:", _throw_count);
1561 
1562   SharedRuntime::print_ic_miss_histogram();
1563   tty->cr();
1564 }
1565 #endif // PRODUCT
< prev index next >