31 #include "code/scopeDesc.hpp"
32 #include "runtime/sweeper.hpp"
33 #include "compiler/compileBroker.hpp"
34 #include "compiler/compileLog.hpp"
35 #include "compiler/compilerOracle.hpp"
36 #include "interpreter/linkResolver.hpp"
37 #include "memory/allocation.inline.hpp"
38 #include "memory/oopFactory.hpp"
39 #include "memory/universe.inline.hpp"
40 #include "oops/methodData.hpp"
41 #include "oops/objArrayKlass.hpp"
42 #include "oops/oop.inline.hpp"
43 #include "prims/jvmtiExport.hpp"
44 #include "runtime/init.hpp"
45 #include "runtime/reflection.hpp"
46 #include "runtime/sharedRuntime.hpp"
47 #include "utilities/dtrace.hpp"
48 #include "jvmci/jvmciRuntime.hpp"
49 #include "jvmci/jvmciJavaClasses.hpp"
50
51 JVMCIEnv::JVMCIEnv(CompileTask* task, int system_dictionary_modification_counter) {
52 _task = task;
53 _system_dictionary_modification_counter = system_dictionary_modification_counter;
54 {
55 // Get Jvmti capabilities under lock to get consistent values.
56 MutexLocker mu(JvmtiThreadState_lock);
57 _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint();
58 _jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables();
59 _jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions();
60 }
61 }
62
63 // ------------------------------------------------------------------
64 // Note: the logic of this method should mirror the logic of
65 // constantPoolOopDesc::verify_constant_pool_resolve.
66 bool JVMCIEnv::check_klass_accessibility(KlassHandle accessing_klass, KlassHandle resolved_klass) {
67 if (accessing_klass->is_objArray_klass()) {
68 accessing_klass = ObjArrayKlass::cast(accessing_klass())->bottom_klass();
69 }
70 if (!accessing_klass->is_instance_klass()) {
71 return true;
72 }
73
74 if (resolved_klass->is_objArray_klass()) {
75 // Find the element klass, if this is an array.
76 resolved_klass = ObjArrayKlass::cast(resolved_klass())->bottom_klass();
77 }
78 if (resolved_klass->is_instance_klass()) {
79 return Reflection::verify_class_access(accessing_klass(), resolved_klass(), true);
80 }
517 frame_words, oop_map_set,
518 handler_table, &implicit_tbl,
519 compiler, comp_level, installed_code, speculation_log);
520
521 // Free codeBlobs
522 //code_buffer->free_blob();
523 if (nm == NULL) {
524 // The CodeCache is full. Print out warning and disable compilation.
525 {
526 MutexUnlocker ml(Compile_lock);
527 MutexUnlocker locker(MethodCompileQueue_lock);
528 CompileBroker::handle_full_code_cache(CodeCache::get_code_blob_type(comp_level));
529 }
530 } else {
531 nm->set_has_unsafe_access(has_unsafe_access);
532 nm->set_has_wide_vectors(has_wide_vector);
533
534 // Record successful registration.
535 // (Put nm into the task handle *before* publishing to the Java heap.)
536 CompileTask* task = env == NULL ? NULL : env->task();
537 if (task != NULL) task->set_code(nm);
538
539 if (installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(installed_code())) {
540 if (entry_bci == InvocationEntryBci) {
541 if (TieredCompilation) {
542 // If there is an old version we're done with it
543 nmethod* old = method->code();
544 if (TraceMethodReplacement && old != NULL) {
545 ResourceMark rm;
546 char *method_name = method->name_and_sig_as_C_string();
547 tty->print_cr("Replacing method %s", method_name);
548 }
549 if (old != NULL ) {
550 old->make_not_entrant();
551 }
552 }
553 if (TraceNMethodInstalls) {
554 ResourceMark rm;
555 char *method_name = method->name_and_sig_as_C_string();
556 ttyLocker ttyl;
557 tty->print_cr("Installing method (%d) %s [entry point: %p]",
|
31 #include "code/scopeDesc.hpp"
32 #include "runtime/sweeper.hpp"
33 #include "compiler/compileBroker.hpp"
34 #include "compiler/compileLog.hpp"
35 #include "compiler/compilerOracle.hpp"
36 #include "interpreter/linkResolver.hpp"
37 #include "memory/allocation.inline.hpp"
38 #include "memory/oopFactory.hpp"
39 #include "memory/universe.inline.hpp"
40 #include "oops/methodData.hpp"
41 #include "oops/objArrayKlass.hpp"
42 #include "oops/oop.inline.hpp"
43 #include "prims/jvmtiExport.hpp"
44 #include "runtime/init.hpp"
45 #include "runtime/reflection.hpp"
46 #include "runtime/sharedRuntime.hpp"
47 #include "utilities/dtrace.hpp"
48 #include "jvmci/jvmciRuntime.hpp"
49 #include "jvmci/jvmciJavaClasses.hpp"
50
51 JVMCIEnv::JVMCIEnv(CompileTask* task, int system_dictionary_modification_counter):
52 _task(task),
53 _system_dictionary_modification_counter(system_dictionary_modification_counter),
54 _failure_reason(NULL),
55 _retryable(true)
56 {
57 // Get Jvmti capabilities under lock to get consistent values.
58 MutexLocker mu(JvmtiThreadState_lock);
59 _jvmti_can_hotswap_or_post_breakpoint = JvmtiExport::can_hotswap_or_post_breakpoint();
60 _jvmti_can_access_local_variables = JvmtiExport::can_access_local_variables();
61 _jvmti_can_post_on_exceptions = JvmtiExport::can_post_on_exceptions();
62 }
63
64 // ------------------------------------------------------------------
65 // Note: the logic of this method should mirror the logic of
66 // constantPoolOopDesc::verify_constant_pool_resolve.
67 bool JVMCIEnv::check_klass_accessibility(KlassHandle accessing_klass, KlassHandle resolved_klass) {
68 if (accessing_klass->is_objArray_klass()) {
69 accessing_klass = ObjArrayKlass::cast(accessing_klass())->bottom_klass();
70 }
71 if (!accessing_klass->is_instance_klass()) {
72 return true;
73 }
74
75 if (resolved_klass->is_objArray_klass()) {
76 // Find the element klass, if this is an array.
77 resolved_klass = ObjArrayKlass::cast(resolved_klass())->bottom_klass();
78 }
79 if (resolved_klass->is_instance_klass()) {
80 return Reflection::verify_class_access(accessing_klass(), resolved_klass(), true);
81 }
518 frame_words, oop_map_set,
519 handler_table, &implicit_tbl,
520 compiler, comp_level, installed_code, speculation_log);
521
522 // Free codeBlobs
523 //code_buffer->free_blob();
524 if (nm == NULL) {
525 // The CodeCache is full. Print out warning and disable compilation.
526 {
527 MutexUnlocker ml(Compile_lock);
528 MutexUnlocker locker(MethodCompileQueue_lock);
529 CompileBroker::handle_full_code_cache(CodeCache::get_code_blob_type(comp_level));
530 }
531 } else {
532 nm->set_has_unsafe_access(has_unsafe_access);
533 nm->set_has_wide_vectors(has_wide_vector);
534
535 // Record successful registration.
536 // (Put nm into the task handle *before* publishing to the Java heap.)
537 CompileTask* task = env == NULL ? NULL : env->task();
538 if (task != NULL) {
539 task->set_code(nm);
540 }
541
542 if (installed_code->is_a(HotSpotNmethod::klass()) && HotSpotNmethod::isDefault(installed_code())) {
543 if (entry_bci == InvocationEntryBci) {
544 if (TieredCompilation) {
545 // If there is an old version we're done with it
546 nmethod* old = method->code();
547 if (TraceMethodReplacement && old != NULL) {
548 ResourceMark rm;
549 char *method_name = method->name_and_sig_as_C_string();
550 tty->print_cr("Replacing method %s", method_name);
551 }
552 if (old != NULL ) {
553 old->make_not_entrant();
554 }
555 }
556 if (TraceNMethodInstalls) {
557 ResourceMark rm;
558 char *method_name = method->name_and_sig_as_C_string();
559 ttyLocker ttyl;
560 tty->print_cr("Installing method (%d) %s [entry point: %p]",
|