< prev index next >

src/hotspot/share/jvmci/jvmciCompilerToVM.cpp

Print this page




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 #include "precompiled.hpp"

  25 #include "classfile/javaClasses.inline.hpp"
  26 #include "code/scopeDesc.hpp"
  27 #include "memory/oopFactory.hpp"
  28 #include "oops/cpCache.inline.hpp"
  29 #include "oops/generateOopMap.hpp"
  30 #include "oops/method.inline.hpp"
  31 #include "oops/objArrayOop.inline.hpp"
  32 #include "oops/typeArrayOop.inline.hpp"
  33 #include "compiler/compileBroker.hpp"
  34 #include "compiler/disassembler.hpp"
  35 #include "jvmci/jvmciCompilerToVM.hpp"
  36 #include "jvmci/jvmciCodeInstaller.hpp"
  37 #include "jvmci/jvmciRuntime.hpp"

  38 #include "runtime/jniHandles.inline.hpp"
  39 #include "runtime/timerTrace.hpp"
  40 #include "runtime/vframe_hp.hpp"
  41 
  42 
  43 void JNIHandleMark::push_jni_handle_block() {
  44   JavaThread* thread = JavaThread::current();
  45   if (thread != NULL) {
  46     // Allocate a new block for JNI handles.
  47     // Inlined code from jni_PushLocalFrame()
  48     JNIHandleBlock* java_handles = ((JavaThread*)thread)->active_handles();
  49     JNIHandleBlock* compile_handles = JNIHandleBlock::allocate_block(thread);
  50     assert(compile_handles != NULL && java_handles != NULL, "should not be NULL");
  51     compile_handles->set_pop_frame_link(java_handles);
  52     thread->set_active_handles(compile_handles);
  53   }
  54 }
  55 
  56 void JNIHandleMark::pop_jni_handle_block() {
  57   JavaThread* thread = JavaThread::current();


  81     args.push_long((jlong) (address) method());
  82     JavaCalls::call_static(&result, SystemDictionary::HotSpotResolvedJavaMethodImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::method_fromMetaspace_signature(), &args, CHECK_NULL);
  83 
  84     return (oop)result.get_jobject();
  85   }
  86   return NULL;
  87 }
  88 
  89 oop CompilerToVM::get_jvmci_type(Klass* klass, TRAPS) {
  90   if (klass != NULL) {
  91     JavaValue result(T_OBJECT);
  92     JavaCallArguments args;
  93     args.push_oop(Handle(THREAD, klass->java_mirror()));
  94     JavaCalls::call_static(&result, SystemDictionary::HotSpotResolvedObjectTypeImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::klass_fromMetaspace_signature(), &args, CHECK_NULL);
  95 
  96     return (oop)result.get_jobject();
  97   }
  98   return NULL;
  99 }
 100 






 101 
 102 jobjectArray readConfiguration0(JNIEnv *env, TRAPS);
 103 
 104 C2V_VMENTRY(jobjectArray, readConfiguration, (JNIEnv *env))
 105    jobjectArray config = readConfiguration0(env, CHECK_NULL);
 106    return config;
 107 C2V_END
 108 
 109 C2V_VMENTRY(jobject, getFlagValue, (JNIEnv *, jobject c2vm, jobject name_handle))
 110 #define RETURN_BOXED_LONG(value) oop box; jvalue p; p.j = (jlong) (value); box = java_lang_boxing_object::create(T_LONG, &p, CHECK_NULL); return JNIHandles::make_local(THREAD, box);
 111 #define RETURN_BOXED_DOUBLE(value) oop box; jvalue p; p.d = (jdouble) (value); box = java_lang_boxing_object::create(T_DOUBLE, &p, CHECK_NULL); return JNIHandles::make_local(THREAD, box);
 112   Handle name(THREAD, JNIHandles::resolve(name_handle));
 113   if (name.is_null()) {
 114     THROW_0(vmSymbols::java_lang_NullPointerException());
 115   }
 116   ResourceMark rm;
 117   const char* cstring = java_lang_String::as_utf8_string(name());
 118   Flag* flag = Flag::find_flag(cstring, strlen(cstring), /* allow_locked */ true, /* return_flag */ true);
 119   if (flag == NULL) {
 120     return c2vm;




   5  * This code is free software; you can redistribute it and/or modify it
   6  * under the terms of the GNU General Public License version 2 only, as
   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 #include "precompiled.hpp"
  25 #include "ci/ciUtilities.inline.hpp"
  26 #include "classfile/javaClasses.inline.hpp"
  27 #include "code/scopeDesc.hpp"
  28 #include "memory/oopFactory.hpp"
  29 #include "oops/cpCache.inline.hpp"
  30 #include "oops/generateOopMap.hpp"
  31 #include "oops/method.inline.hpp"
  32 #include "oops/objArrayOop.inline.hpp"
  33 #include "oops/typeArrayOop.inline.hpp"
  34 #include "compiler/compileBroker.hpp"
  35 #include "compiler/disassembler.hpp"
  36 #include "jvmci/jvmciCompilerToVM.hpp"
  37 #include "jvmci/jvmciCodeInstaller.hpp"
  38 #include "jvmci/jvmciRuntime.hpp"
  39 #include "runtime/interfaceSupport.inline.hpp"
  40 #include "runtime/jniHandles.inline.hpp"
  41 #include "runtime/timerTrace.hpp"
  42 #include "runtime/vframe_hp.hpp"
  43 
  44 
  45 void JNIHandleMark::push_jni_handle_block() {
  46   JavaThread* thread = JavaThread::current();
  47   if (thread != NULL) {
  48     // Allocate a new block for JNI handles.
  49     // Inlined code from jni_PushLocalFrame()
  50     JNIHandleBlock* java_handles = ((JavaThread*)thread)->active_handles();
  51     JNIHandleBlock* compile_handles = JNIHandleBlock::allocate_block(thread);
  52     assert(compile_handles != NULL && java_handles != NULL, "should not be NULL");
  53     compile_handles->set_pop_frame_link(java_handles);
  54     thread->set_active_handles(compile_handles);
  55   }
  56 }
  57 
  58 void JNIHandleMark::pop_jni_handle_block() {
  59   JavaThread* thread = JavaThread::current();


  83     args.push_long((jlong) (address) method());
  84     JavaCalls::call_static(&result, SystemDictionary::HotSpotResolvedJavaMethodImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::method_fromMetaspace_signature(), &args, CHECK_NULL);
  85 
  86     return (oop)result.get_jobject();
  87   }
  88   return NULL;
  89 }
  90 
  91 oop CompilerToVM::get_jvmci_type(Klass* klass, TRAPS) {
  92   if (klass != NULL) {
  93     JavaValue result(T_OBJECT);
  94     JavaCallArguments args;
  95     args.push_oop(Handle(THREAD, klass->java_mirror()));
  96     JavaCalls::call_static(&result, SystemDictionary::HotSpotResolvedObjectTypeImpl_klass(), vmSymbols::fromMetaspace_name(), vmSymbols::klass_fromMetaspace_signature(), &args, CHECK_NULL);
  97 
  98     return (oop)result.get_jobject();
  99   }
 100   return NULL;
 101 }
 102 
 103 Handle JavaArgumentUnboxer::next_arg(BasicType expectedType) {
 104   assert(_index < _args->length(), "out of bounds");
 105   oop arg=((objArrayOop) (_args))->obj_at(_index++);
 106   assert(expectedType == T_OBJECT || java_lang_boxing_object::is_instance(arg, expectedType), "arg type mismatch");
 107   return Handle(Thread::current(), arg);
 108 }
 109 
 110 jobjectArray readConfiguration0(JNIEnv *env, TRAPS);
 111 
 112 C2V_VMENTRY(jobjectArray, readConfiguration, (JNIEnv *env))
 113    jobjectArray config = readConfiguration0(env, CHECK_NULL);
 114    return config;
 115 C2V_END
 116 
 117 C2V_VMENTRY(jobject, getFlagValue, (JNIEnv *, jobject c2vm, jobject name_handle))
 118 #define RETURN_BOXED_LONG(value) oop box; jvalue p; p.j = (jlong) (value); box = java_lang_boxing_object::create(T_LONG, &p, CHECK_NULL); return JNIHandles::make_local(THREAD, box);
 119 #define RETURN_BOXED_DOUBLE(value) oop box; jvalue p; p.d = (jdouble) (value); box = java_lang_boxing_object::create(T_DOUBLE, &p, CHECK_NULL); return JNIHandles::make_local(THREAD, box);
 120   Handle name(THREAD, JNIHandles::resolve(name_handle));
 121   if (name.is_null()) {
 122     THROW_0(vmSymbols::java_lang_NullPointerException());
 123   }
 124   ResourceMark rm;
 125   const char* cstring = java_lang_String::as_utf8_string(name());
 126   Flag* flag = Flag::find_flag(cstring, strlen(cstring), /* allow_locked */ true, /* return_flag */ true);
 127   if (flag == NULL) {
 128     return c2vm;


< prev index next >