54 #include "prims/jvmtiExport.hpp"
55 #include "prims/jvmtiThreadState.hpp"
56 #include "prims/unsafe.hpp"
57 #include "runtime/jniHandles.inline.hpp"
58 #include "runtime/objectMonitor.hpp"
59 #include "runtime/sharedRuntime.hpp"
60 #include "runtime/stubRoutines.hpp"
61 #include "utilities/macros.hpp"
62 #include "utilities/powerOfTwo.hpp"
63
64 //---------------------------make_vm_intrinsic----------------------------
65 CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
66 vmIntrinsicID id = m->intrinsic_id();
67 assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
68
69 if (!m->is_loaded()) {
70 // Do not attempt to inline unloaded methods.
71 return nullptr;
72 }
73
74 C2Compiler* compiler = (C2Compiler*)CompileBroker::compiler(CompLevel_full_optimization);
75 bool is_available = false;
76
77 {
78 // For calling is_intrinsic_supported and is_intrinsic_disabled_by_flag
79 // the compiler must transition to '_thread_in_vm' state because both
80 // methods access VM-internal data.
81 VM_ENTRY_MARK;
82 methodHandle mh(THREAD, m->get_Method());
83 is_available = compiler != nullptr && compiler->is_intrinsic_available(mh, C->directive());
84 if (is_available && is_virtual) {
85 is_available = vmIntrinsics::does_virtual_dispatch(id);
86 }
87 }
88
89 if (is_available) {
90 assert(id <= vmIntrinsics::LAST_COMPILER_INLINE, "caller responsibility");
91 assert(id != vmIntrinsics::_Object_init && id != vmIntrinsics::_invoke, "enum out of order?");
92 return new LibraryIntrinsic(m, is_virtual,
93 vmIntrinsics::predicates_needed(id),
94 vmIntrinsics::does_virtual_dispatch(id),
|
54 #include "prims/jvmtiExport.hpp"
55 #include "prims/jvmtiThreadState.hpp"
56 #include "prims/unsafe.hpp"
57 #include "runtime/jniHandles.inline.hpp"
58 #include "runtime/objectMonitor.hpp"
59 #include "runtime/sharedRuntime.hpp"
60 #include "runtime/stubRoutines.hpp"
61 #include "utilities/macros.hpp"
62 #include "utilities/powerOfTwo.hpp"
63
64 //---------------------------make_vm_intrinsic----------------------------
65 CallGenerator* Compile::make_vm_intrinsic(ciMethod* m, bool is_virtual) {
66 vmIntrinsicID id = m->intrinsic_id();
67 assert(id != vmIntrinsics::_none, "must be a VM intrinsic");
68
69 if (!m->is_loaded()) {
70 // Do not attempt to inline unloaded methods.
71 return nullptr;
72 }
73
74 C2Compiler* compiler = (C2Compiler*)CompilerThread::current()->compiler();
75 bool is_available = false;
76
77 {
78 // For calling is_intrinsic_supported and is_intrinsic_disabled_by_flag
79 // the compiler must transition to '_thread_in_vm' state because both
80 // methods access VM-internal data.
81 VM_ENTRY_MARK;
82 methodHandle mh(THREAD, m->get_Method());
83 is_available = compiler != nullptr && compiler->is_intrinsic_available(mh, C->directive());
84 if (is_available && is_virtual) {
85 is_available = vmIntrinsics::does_virtual_dispatch(id);
86 }
87 }
88
89 if (is_available) {
90 assert(id <= vmIntrinsics::LAST_COMPILER_INLINE, "caller responsibility");
91 assert(id != vmIntrinsics::_Object_init && id != vmIntrinsics::_invoke, "enum out of order?");
92 return new LibraryIntrinsic(m, is_virtual,
93 vmIntrinsics::predicates_needed(id),
94 vmIntrinsics::does_virtual_dispatch(id),
|