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/handles.inline.hpp"
61 #include "runtime/interfaceSupport.inline.hpp"
62 #include "runtime/javaCalls.hpp"
63 #include "runtime/sharedRuntime.hpp"
64 #include "runtime/threadCritical.hpp"
65 #include "runtime/vframe.inline.hpp"
66 #include "runtime/vframeArray.hpp"
67 #include "runtime/vm_version.hpp"
68 #include "utilities/copy.hpp"
69 #include "utilities/events.hpp"
70
71
72 // Implementation of StubAssembler
73
74 StubAssembler::StubAssembler(CodeBuffer* code, const char * name, int stub_id) : C1_MacroAssembler(code) {
102 }
103
104 // Implementation of Runtime1
105
106 CodeBlob* Runtime1::_blobs[Runtime1::number_of_ids];
107 const char *Runtime1::_blob_names[] = {
108 RUNTIME1_STUBS(STUB_NAME, LAST_STUB_NAME)
109 };
110
111 #ifndef PRODUCT
112 // statistics
113 int Runtime1::_generic_arraycopy_cnt = 0;
114 int Runtime1::_generic_arraycopystub_cnt = 0;
115 int Runtime1::_arraycopy_slowcase_cnt = 0;
116 int Runtime1::_arraycopy_checkcast_cnt = 0;
117 int Runtime1::_arraycopy_checkcast_attempt_cnt = 0;
118 int Runtime1::_new_type_array_slowcase_cnt = 0;
119 int Runtime1::_new_object_array_slowcase_cnt = 0;
120 int Runtime1::_new_instance_slowcase_cnt = 0;
121 int Runtime1::_new_multi_array_slowcase_cnt = 0;
122 int Runtime1::_monitorenter_slowcase_cnt = 0;
123 int Runtime1::_monitorexit_slowcase_cnt = 0;
124 int Runtime1::_patch_code_slowcase_cnt = 0;
125 int Runtime1::_throw_range_check_exception_count = 0;
126 int Runtime1::_throw_index_exception_count = 0;
127 int Runtime1::_throw_div0_exception_count = 0;
128 int Runtime1::_throw_null_pointer_exception_count = 0;
129 int Runtime1::_throw_class_cast_exception_count = 0;
130 int Runtime1::_throw_incompatible_class_change_error_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) {
141 switch (type) {
142 case T_BOOLEAN:
143 case T_BYTE: return (address)&_byte_arraycopy_stub_cnt;
144 case T_CHAR:
145 case T_SHORT: return (address)&_short_arraycopy_stub_cnt;
146 case T_FLOAT:
147 case T_INT: return (address)&_int_arraycopy_stub_cnt;
148 case T_DOUBLE:
149 case T_LONG: return (address)&_long_arraycopy_stub_cnt;
150 case T_ARRAY:
368 BasicType elt_type = TypeArrayKlass::cast(klass)->element_type();
369 oop obj = oopFactory::new_typeArray(elt_type, length, CHECK);
370 thread->set_vm_result(obj);
371 // This is pretty rare but this runtime patch is stressful to deoptimization
372 // if we deoptimize here so force a deopt to stress the path.
373 if (DeoptimizeALot) {
374 deopt_caller();
375 }
376
377 JRT_END
378
379
380 JRT_ENTRY(void, Runtime1::new_object_array(JavaThread* thread, Klass* array_klass, jint length))
381 NOT_PRODUCT(_new_object_array_slowcase_cnt++;)
382
383 // Note: no handle for klass needed since they are not used
384 // anymore after new_objArray() and no GC can happen before.
385 // (This may have to change if this code changes!)
386 assert(array_klass->is_klass(), "not a class");
387 Handle holder(THREAD, array_klass->klass_holder()); // keep the klass alive
388 Klass* elem_klass = ObjArrayKlass::cast(array_klass)->element_klass();
389 objArrayOop obj = oopFactory::new_objArray(elem_klass, length, CHECK);
390 thread->set_vm_result(obj);
391 // This is pretty rare but this runtime patch is stressful to deoptimization
392 // if we deoptimize here so force a deopt to stress the path.
393 if (DeoptimizeALot) {
394 deopt_caller();
395 }
396 JRT_END
397
398
399 JRT_ENTRY(void, Runtime1::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims))
400 NOT_PRODUCT(_new_multi_array_slowcase_cnt++;)
401
402 assert(klass->is_klass(), "not a class");
403 assert(rank >= 1, "rank must be nonzero");
404 Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
405 oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
406 thread->set_vm_result(obj);
407 JRT_END
408
409
410 JRT_ENTRY(void, Runtime1::unimplemented_entry(JavaThread* thread, StubID id))
411 tty->print_cr("Runtime1::entry_for(%d) returned unimplemented entry point", id);
412 JRT_END
413
414
415 JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread, oopDesc* obj))
416 ResourceMark rm(thread);
417 const char* klass_name = obj->klass()->external_name();
418 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayStoreException(), klass_name);
419 JRT_END
420
421
422 // counter_overflow() is called from within C1-compiled methods. The enclosing method is the method
423 // associated with the top activation record. The inlinee (that is possibly included in the enclosing
424 // method) method oop is passed as an argument. In order to do that it is embedded in the code as
425 // a constant.
426 static nmethod* counter_overflow_helper(JavaThread* THREAD, int branch_bci, Method* m) {
427 nmethod* osr_nm = NULL;
428 methodHandle method(THREAD, m);
429
675 JRT_END
676
677
678 JRT_ENTRY(void, Runtime1::throw_class_cast_exception(JavaThread* thread, oopDesc* object))
679 NOT_PRODUCT(_throw_class_cast_exception_count++;)
680 ResourceMark rm(thread);
681 char* message = SharedRuntime::generate_class_cast_message(
682 thread, object->klass());
683 SharedRuntime::throw_and_post_jvmti_exception(
684 thread, vmSymbols::java_lang_ClassCastException(), message);
685 JRT_END
686
687
688 JRT_ENTRY(void, Runtime1::throw_incompatible_class_change_error(JavaThread* thread))
689 NOT_PRODUCT(_throw_incompatible_class_change_error_count++;)
690 ResourceMark rm(thread);
691 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_IncompatibleClassChangeError());
692 JRT_END
693
694
695 JRT_ENTRY_NO_ASYNC(void, Runtime1::monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock))
696 NOT_PRODUCT(_monitorenter_slowcase_cnt++;)
697 if (PrintBiasedLockingStatistics) {
698 Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
699 }
700 Handle h_obj(thread, obj);
701 if (UseBiasedLocking) {
702 // Retry fast entry if bias is revoked to avoid unnecessary inflation
703 ObjectSynchronizer::fast_enter(h_obj, lock->lock(), true, CHECK);
704 } else {
705 if (UseFastLocking) {
706 // When using fast locking, the compiled code has already tried the fast case
707 assert(obj == lock->obj(), "must match");
708 ObjectSynchronizer::slow_enter(h_obj, lock->lock(), THREAD);
709 } else {
710 lock->set_obj(obj);
711 ObjectSynchronizer::fast_enter(h_obj, lock->lock(), false, THREAD);
712 }
713 }
714 JRT_END
940 // accesses.
941
942 patch_field_type = result.field_type();
943 deoptimize_for_atomic = (AlwaysAtomicAccesses && (patch_field_type == T_DOUBLE || patch_field_type == T_LONG));
944
945 } else if (load_klass_or_mirror_patch_id) {
946 Klass* k = NULL;
947 switch (code) {
948 case Bytecodes::_putstatic:
949 case Bytecodes::_getstatic:
950 { Klass* klass = resolve_field_return_klass(caller_method, bci, CHECK);
951 init_klass = klass;
952 mirror = Handle(THREAD, klass->java_mirror());
953 }
954 break;
955 case Bytecodes::_new:
956 { Bytecode_new bnew(caller_method(), caller_method->bcp_from(bci));
957 k = caller_method->constants()->klass_at(bnew.index(), CHECK);
958 }
959 break;
960 case Bytecodes::_multianewarray:
961 { Bytecode_multianewarray mna(caller_method(), caller_method->bcp_from(bci));
962 k = caller_method->constants()->klass_at(mna.index(), CHECK);
963 }
964 break;
965 case Bytecodes::_instanceof:
966 { Bytecode_instanceof io(caller_method(), caller_method->bcp_from(bci));
967 k = caller_method->constants()->klass_at(io.index(), CHECK);
968 }
969 break;
970 case Bytecodes::_checkcast:
971 { Bytecode_checkcast cc(caller_method(), caller_method->bcp_from(bci));
972 k = caller_method->constants()->klass_at(cc.index(), CHECK);
973 }
974 break;
975 case Bytecodes::_anewarray:
976 { Bytecode_anewarray anew(caller_method(), caller_method->bcp_from(bci));
977 Klass* ek = caller_method->constants()->klass_at(anew.index(), CHECK);
978 k = ek->array_klass(CHECK);
979 }
1466 tty->print_cr(" _resolve_invoke_virtual_cnt: %d", SharedRuntime::_resolve_virtual_ctr);
1467 tty->print_cr(" _resolve_invoke_opt_virtual_cnt: %d", SharedRuntime::_resolve_opt_virtual_ctr);
1468 tty->print_cr(" _resolve_invoke_static_cnt: %d", SharedRuntime::_resolve_static_ctr);
1469 tty->print_cr(" _handle_wrong_method_cnt: %d", SharedRuntime::_wrong_method_ctr);
1470 tty->print_cr(" _ic_miss_cnt: %d", SharedRuntime::_ic_miss_ctr);
1471 tty->print_cr(" _generic_arraycopy_cnt: %d", _generic_arraycopy_cnt);
1472 tty->print_cr(" _generic_arraycopystub_cnt: %d", _generic_arraycopystub_cnt);
1473 tty->print_cr(" _byte_arraycopy_cnt: %d", _byte_arraycopy_stub_cnt);
1474 tty->print_cr(" _short_arraycopy_cnt: %d", _short_arraycopy_stub_cnt);
1475 tty->print_cr(" _int_arraycopy_cnt: %d", _int_arraycopy_stub_cnt);
1476 tty->print_cr(" _long_arraycopy_cnt: %d", _long_arraycopy_stub_cnt);
1477 tty->print_cr(" _oop_arraycopy_cnt: %d", _oop_arraycopy_stub_cnt);
1478 tty->print_cr(" _arraycopy_slowcase_cnt: %d", _arraycopy_slowcase_cnt);
1479 tty->print_cr(" _arraycopy_checkcast_cnt: %d", _arraycopy_checkcast_cnt);
1480 tty->print_cr(" _arraycopy_checkcast_attempt_cnt:%d", _arraycopy_checkcast_attempt_cnt);
1481
1482 tty->print_cr(" _new_type_array_slowcase_cnt: %d", _new_type_array_slowcase_cnt);
1483 tty->print_cr(" _new_object_array_slowcase_cnt: %d", _new_object_array_slowcase_cnt);
1484 tty->print_cr(" _new_instance_slowcase_cnt: %d", _new_instance_slowcase_cnt);
1485 tty->print_cr(" _new_multi_array_slowcase_cnt: %d", _new_multi_array_slowcase_cnt);
1486 tty->print_cr(" _monitorenter_slowcase_cnt: %d", _monitorenter_slowcase_cnt);
1487 tty->print_cr(" _monitorexit_slowcase_cnt: %d", _monitorexit_slowcase_cnt);
1488 tty->print_cr(" _patch_code_slowcase_cnt: %d", _patch_code_slowcase_cnt);
1489
1490 tty->print_cr(" _throw_range_check_exception_count: %d:", _throw_range_check_exception_count);
1491 tty->print_cr(" _throw_index_exception_count: %d:", _throw_index_exception_count);
1492 tty->print_cr(" _throw_div0_exception_count: %d:", _throw_div0_exception_count);
1493 tty->print_cr(" _throw_null_pointer_exception_count: %d:", _throw_null_pointer_exception_count);
1494 tty->print_cr(" _throw_class_cast_exception_count: %d:", _throw_class_cast_exception_count);
1495 tty->print_cr(" _throw_incompatible_class_change_error_count: %d:", _throw_incompatible_class_change_error_count);
1496 tty->print_cr(" _throw_array_store_exception_count: %d:", _throw_array_store_exception_count);
1497 tty->print_cr(" _throw_count: %d:", _throw_count);
1498
1499 SharedRuntime::print_ic_miss_histogram();
1500 tty->cr();
1501 }
1502 #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/handles.inline.hpp"
63 #include "runtime/interfaceSupport.inline.hpp"
64 #include "runtime/javaCalls.hpp"
65 #include "runtime/sharedRuntime.hpp"
66 #include "runtime/threadCritical.hpp"
67 #include "runtime/vframe.inline.hpp"
68 #include "runtime/vframeArray.hpp"
69 #include "runtime/vm_version.hpp"
70 #include "utilities/copy.hpp"
71 #include "utilities/events.hpp"
72
73
74 // Implementation of StubAssembler
75
76 StubAssembler::StubAssembler(CodeBuffer* code, const char * name, int stub_id) : C1_MacroAssembler(code) {
104 }
105
106 // Implementation of Runtime1
107
108 CodeBlob* Runtime1::_blobs[Runtime1::number_of_ids];
109 const char *Runtime1::_blob_names[] = {
110 RUNTIME1_STUBS(STUB_NAME, LAST_STUB_NAME)
111 };
112
113 #ifndef PRODUCT
114 // statistics
115 int Runtime1::_generic_arraycopy_cnt = 0;
116 int Runtime1::_generic_arraycopystub_cnt = 0;
117 int Runtime1::_arraycopy_slowcase_cnt = 0;
118 int Runtime1::_arraycopy_checkcast_cnt = 0;
119 int Runtime1::_arraycopy_checkcast_attempt_cnt = 0;
120 int Runtime1::_new_type_array_slowcase_cnt = 0;
121 int Runtime1::_new_object_array_slowcase_cnt = 0;
122 int Runtime1::_new_instance_slowcase_cnt = 0;
123 int Runtime1::_new_multi_array_slowcase_cnt = 0;
124 int Runtime1::_load_flattened_array_slowcase_cnt = 0;
125 int Runtime1::_store_flattened_array_slowcase_cnt = 0;
126 int Runtime1::_monitorenter_slowcase_cnt = 0;
127 int Runtime1::_monitorexit_slowcase_cnt = 0;
128 int Runtime1::_patch_code_slowcase_cnt = 0;
129 int Runtime1::_throw_range_check_exception_count = 0;
130 int Runtime1::_throw_index_exception_count = 0;
131 int Runtime1::_throw_div0_exception_count = 0;
132 int Runtime1::_throw_null_pointer_exception_count = 0;
133 int Runtime1::_throw_class_cast_exception_count = 0;
134 int Runtime1::_throw_incompatible_class_change_error_count = 0;
135 int Runtime1::_throw_illegal_monitor_state_exception_count = 0;
136 int Runtime1::_throw_array_store_exception_count = 0;
137 int Runtime1::_throw_count = 0;
138
139 static int _byte_arraycopy_stub_cnt = 0;
140 static int _short_arraycopy_stub_cnt = 0;
141 static int _int_arraycopy_stub_cnt = 0;
142 static int _long_arraycopy_stub_cnt = 0;
143 static int _oop_arraycopy_stub_cnt = 0;
144
145 address Runtime1::arraycopy_count_address(BasicType type) {
146 switch (type) {
147 case T_BOOLEAN:
148 case T_BYTE: return (address)&_byte_arraycopy_stub_cnt;
149 case T_CHAR:
150 case T_SHORT: return (address)&_short_arraycopy_stub_cnt;
151 case T_FLOAT:
152 case T_INT: return (address)&_int_arraycopy_stub_cnt;
153 case T_DOUBLE:
154 case T_LONG: return (address)&_long_arraycopy_stub_cnt;
155 case T_ARRAY:
373 BasicType elt_type = TypeArrayKlass::cast(klass)->element_type();
374 oop obj = oopFactory::new_typeArray(elt_type, length, CHECK);
375 thread->set_vm_result(obj);
376 // This is pretty rare but this runtime patch is stressful to deoptimization
377 // if we deoptimize here so force a deopt to stress the path.
378 if (DeoptimizeALot) {
379 deopt_caller();
380 }
381
382 JRT_END
383
384
385 JRT_ENTRY(void, Runtime1::new_object_array(JavaThread* thread, Klass* array_klass, jint length))
386 NOT_PRODUCT(_new_object_array_slowcase_cnt++;)
387
388 // Note: no handle for klass needed since they are not used
389 // anymore after new_objArray() and no GC can happen before.
390 // (This may have to change if this code changes!)
391 assert(array_klass->is_klass(), "not a class");
392 Handle holder(THREAD, array_klass->klass_holder()); // keep the klass alive
393 Klass* elem_klass = ArrayKlass::cast(array_klass)->element_klass();
394 if (elem_klass->is_value()) {
395 arrayOop obj = oopFactory::new_valueArray(elem_klass, length, CHECK);
396 thread->set_vm_result(obj);
397 } else {
398 objArrayOop obj = oopFactory::new_objArray(elem_klass, length, CHECK);
399 thread->set_vm_result(obj);
400 }
401 // This is pretty rare but this runtime patch is stressful to deoptimization
402 // if we deoptimize here so force a deopt to stress the path.
403 if (DeoptimizeALot) {
404 deopt_caller();
405 }
406 JRT_END
407
408
409 JRT_ENTRY(void, Runtime1::new_multi_array(JavaThread* thread, Klass* klass, int rank, jint* dims))
410 NOT_PRODUCT(_new_multi_array_slowcase_cnt++;)
411
412 assert(klass->is_klass(), "not a class");
413 assert(rank >= 1, "rank must be nonzero");
414 Handle holder(THREAD, klass->klass_holder()); // keep the klass alive
415 oop obj = ArrayKlass::cast(klass)->multi_allocate(rank, dims, CHECK);
416 thread->set_vm_result(obj);
417 JRT_END
418
419
420 JRT_ENTRY(void, Runtime1::load_flattened_array(JavaThread* thread, valueArrayOopDesc* array, int index))
421 NOT_PRODUCT(_load_flattened_array_slowcase_cnt++;)
422 Klass* klass = array->klass();
423 assert(klass->is_valueArray_klass(), "expected value array oop");
424 assert(array->length() > 0 && index < array->length(), "already checked");
425
426 ValueArrayKlass* vaklass = ValueArrayKlass::cast(klass);
427 ValueKlass* vklass = vaklass->element_klass();
428
429 // We have a non-empty flattened array, so the element type must have been initialized.
430 assert(vklass->is_initialized(), "must be");
431 Handle holder(THREAD, vklass->klass_holder()); // keep the vklass alive
432 valueArrayHandle ha(THREAD, array);
433 oop obj = vklass->allocate_instance(CHECK);
434
435 void* src = ha()->value_at_addr(index, vaklass->layout_helper());
436 vklass->value_store(src, vklass->data_for_oop(obj),
437 vaklass->element_byte_size(), true, false);
438 thread->set_vm_result(obj);
439 JRT_END
440
441
442 JRT_ENTRY(void, Runtime1::store_flattened_array(JavaThread* thread, valueArrayOopDesc* array, int index, oopDesc* value))
443 NOT_PRODUCT(_store_flattened_array_slowcase_cnt++;)
444 if (value == NULL) {
445 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_NullPointerException());
446 } else {
447 Klass* klass = array->klass();
448 assert(klass->is_valueArray_klass(), "expected value array");
449 assert(ArrayKlass::cast(klass)->element_klass() == value->klass(), "Store type incorrect");
450
451 ValueArrayKlass* vaklass = ValueArrayKlass::cast(klass);
452 ValueKlass* vklass = vaklass->element_klass();
453 const int lh = vaklass->layout_helper();
454 vklass->value_store(vklass->data_for_oop(value), array->value_at_addr(index, lh),
455 vaklass->element_byte_size(), true, false);
456 }
457 JRT_END
458
459
460 JRT_ENTRY(void, Runtime1::unimplemented_entry(JavaThread* thread, StubID id))
461 tty->print_cr("Runtime1::entry_for(%d) returned unimplemented entry point", id);
462 JRT_END
463
464
465 JRT_ENTRY(void, Runtime1::throw_array_store_exception(JavaThread* thread, oopDesc* obj))
466 ResourceMark rm(thread);
467 const char* klass_name = obj->klass()->external_name();
468 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_ArrayStoreException(), klass_name);
469 JRT_END
470
471
472 // counter_overflow() is called from within C1-compiled methods. The enclosing method is the method
473 // associated with the top activation record. The inlinee (that is possibly included in the enclosing
474 // method) method oop is passed as an argument. In order to do that it is embedded in the code as
475 // a constant.
476 static nmethod* counter_overflow_helper(JavaThread* THREAD, int branch_bci, Method* m) {
477 nmethod* osr_nm = NULL;
478 methodHandle method(THREAD, m);
479
725 JRT_END
726
727
728 JRT_ENTRY(void, Runtime1::throw_class_cast_exception(JavaThread* thread, oopDesc* object))
729 NOT_PRODUCT(_throw_class_cast_exception_count++;)
730 ResourceMark rm(thread);
731 char* message = SharedRuntime::generate_class_cast_message(
732 thread, object->klass());
733 SharedRuntime::throw_and_post_jvmti_exception(
734 thread, vmSymbols::java_lang_ClassCastException(), message);
735 JRT_END
736
737
738 JRT_ENTRY(void, Runtime1::throw_incompatible_class_change_error(JavaThread* thread))
739 NOT_PRODUCT(_throw_incompatible_class_change_error_count++;)
740 ResourceMark rm(thread);
741 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_IncompatibleClassChangeError());
742 JRT_END
743
744
745 JRT_ENTRY(void, Runtime1::throw_illegal_monitor_state_exception(JavaThread* thread))
746 NOT_PRODUCT(_throw_illegal_monitor_state_exception_count++;)
747 ResourceMark rm(thread);
748 SharedRuntime::throw_and_post_jvmti_exception(thread, vmSymbols::java_lang_IllegalMonitorStateException());
749 JRT_END
750
751
752 JRT_ENTRY_NO_ASYNC(void, Runtime1::monitorenter(JavaThread* thread, oopDesc* obj, BasicObjectLock* lock))
753 NOT_PRODUCT(_monitorenter_slowcase_cnt++;)
754 if (PrintBiasedLockingStatistics) {
755 Atomic::inc(BiasedLocking::slow_path_entry_count_addr());
756 }
757 Handle h_obj(thread, obj);
758 if (UseBiasedLocking) {
759 // Retry fast entry if bias is revoked to avoid unnecessary inflation
760 ObjectSynchronizer::fast_enter(h_obj, lock->lock(), true, CHECK);
761 } else {
762 if (UseFastLocking) {
763 // When using fast locking, the compiled code has already tried the fast case
764 assert(obj == lock->obj(), "must match");
765 ObjectSynchronizer::slow_enter(h_obj, lock->lock(), THREAD);
766 } else {
767 lock->set_obj(obj);
768 ObjectSynchronizer::fast_enter(h_obj, lock->lock(), false, THREAD);
769 }
770 }
771 JRT_END
997 // accesses.
998
999 patch_field_type = result.field_type();
1000 deoptimize_for_atomic = (AlwaysAtomicAccesses && (patch_field_type == T_DOUBLE || patch_field_type == T_LONG));
1001
1002 } else if (load_klass_or_mirror_patch_id) {
1003 Klass* k = NULL;
1004 switch (code) {
1005 case Bytecodes::_putstatic:
1006 case Bytecodes::_getstatic:
1007 { Klass* klass = resolve_field_return_klass(caller_method, bci, CHECK);
1008 init_klass = klass;
1009 mirror = Handle(THREAD, klass->java_mirror());
1010 }
1011 break;
1012 case Bytecodes::_new:
1013 { Bytecode_new bnew(caller_method(), caller_method->bcp_from(bci));
1014 k = caller_method->constants()->klass_at(bnew.index(), CHECK);
1015 }
1016 break;
1017 case Bytecodes::_defaultvalue:
1018 { Bytecode_defaultvalue bdefaultvalue(caller_method(), caller_method->bcp_from(bci));
1019 k = caller_method->constants()->klass_at(bdefaultvalue.index(), CHECK);
1020 }
1021 break;
1022 case Bytecodes::_multianewarray:
1023 { Bytecode_multianewarray mna(caller_method(), caller_method->bcp_from(bci));
1024 k = caller_method->constants()->klass_at(mna.index(), CHECK);
1025 }
1026 break;
1027 case Bytecodes::_instanceof:
1028 { Bytecode_instanceof io(caller_method(), caller_method->bcp_from(bci));
1029 k = caller_method->constants()->klass_at(io.index(), CHECK);
1030 }
1031 break;
1032 case Bytecodes::_checkcast:
1033 { Bytecode_checkcast cc(caller_method(), caller_method->bcp_from(bci));
1034 k = caller_method->constants()->klass_at(cc.index(), CHECK);
1035 }
1036 break;
1037 case Bytecodes::_anewarray:
1038 { Bytecode_anewarray anew(caller_method(), caller_method->bcp_from(bci));
1039 Klass* ek = caller_method->constants()->klass_at(anew.index(), CHECK);
1040 k = ek->array_klass(CHECK);
1041 }
1528 tty->print_cr(" _resolve_invoke_virtual_cnt: %d", SharedRuntime::_resolve_virtual_ctr);
1529 tty->print_cr(" _resolve_invoke_opt_virtual_cnt: %d", SharedRuntime::_resolve_opt_virtual_ctr);
1530 tty->print_cr(" _resolve_invoke_static_cnt: %d", SharedRuntime::_resolve_static_ctr);
1531 tty->print_cr(" _handle_wrong_method_cnt: %d", SharedRuntime::_wrong_method_ctr);
1532 tty->print_cr(" _ic_miss_cnt: %d", SharedRuntime::_ic_miss_ctr);
1533 tty->print_cr(" _generic_arraycopy_cnt: %d", _generic_arraycopy_cnt);
1534 tty->print_cr(" _generic_arraycopystub_cnt: %d", _generic_arraycopystub_cnt);
1535 tty->print_cr(" _byte_arraycopy_cnt: %d", _byte_arraycopy_stub_cnt);
1536 tty->print_cr(" _short_arraycopy_cnt: %d", _short_arraycopy_stub_cnt);
1537 tty->print_cr(" _int_arraycopy_cnt: %d", _int_arraycopy_stub_cnt);
1538 tty->print_cr(" _long_arraycopy_cnt: %d", _long_arraycopy_stub_cnt);
1539 tty->print_cr(" _oop_arraycopy_cnt: %d", _oop_arraycopy_stub_cnt);
1540 tty->print_cr(" _arraycopy_slowcase_cnt: %d", _arraycopy_slowcase_cnt);
1541 tty->print_cr(" _arraycopy_checkcast_cnt: %d", _arraycopy_checkcast_cnt);
1542 tty->print_cr(" _arraycopy_checkcast_attempt_cnt:%d", _arraycopy_checkcast_attempt_cnt);
1543
1544 tty->print_cr(" _new_type_array_slowcase_cnt: %d", _new_type_array_slowcase_cnt);
1545 tty->print_cr(" _new_object_array_slowcase_cnt: %d", _new_object_array_slowcase_cnt);
1546 tty->print_cr(" _new_instance_slowcase_cnt: %d", _new_instance_slowcase_cnt);
1547 tty->print_cr(" _new_multi_array_slowcase_cnt: %d", _new_multi_array_slowcase_cnt);
1548 tty->print_cr(" _load_flattened_array_slowcase_cnt: %d", _load_flattened_array_slowcase_cnt);
1549 tty->print_cr(" _store_flattened_array_slowcase_cnt:%d", _store_flattened_array_slowcase_cnt);
1550 tty->print_cr(" _monitorenter_slowcase_cnt: %d", _monitorenter_slowcase_cnt);
1551 tty->print_cr(" _monitorexit_slowcase_cnt: %d", _monitorexit_slowcase_cnt);
1552 tty->print_cr(" _patch_code_slowcase_cnt: %d", _patch_code_slowcase_cnt);
1553
1554 tty->print_cr(" _throw_range_check_exception_count: %d:", _throw_range_check_exception_count);
1555 tty->print_cr(" _throw_index_exception_count: %d:", _throw_index_exception_count);
1556 tty->print_cr(" _throw_div0_exception_count: %d:", _throw_div0_exception_count);
1557 tty->print_cr(" _throw_null_pointer_exception_count: %d:", _throw_null_pointer_exception_count);
1558 tty->print_cr(" _throw_class_cast_exception_count: %d:", _throw_class_cast_exception_count);
1559 tty->print_cr(" _throw_incompatible_class_change_error_count: %d:", _throw_incompatible_class_change_error_count);
1560 tty->print_cr(" _throw_illegal_monitor_state_exception_count: %d:", _throw_illegal_monitor_state_exception_count);
1561 tty->print_cr(" _throw_array_store_exception_count: %d:", _throw_array_store_exception_count);
1562 tty->print_cr(" _throw_count: %d:", _throw_count);
1563
1564 SharedRuntime::print_ic_miss_histogram();
1565 tty->cr();
1566 }
1567 #endif // PRODUCT
|