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