diff src/share/vm/c1x/c1x_VMEntries.cpp @ 1421:6223633ce7dd

changed VMExit/VMEntries to non-static, added eclipse c++ project, CIR interface changes
author Lukas Stadler <lukas.stadler@oracle.com>
date Fri, 23 Jul 2010 15:53:02 -0700
parents 7bf6a77b9c5a
children 3483ec571caf
line wrap: on
line diff
--- a/src/share/vm/c1x/c1x_VMEntries.cpp	Tue Jul 13 11:47:55 2010 -0700
+++ b/src/share/vm/c1x/c1x_VMEntries.cpp	Fri Jul 23 15:53:02 2010 -0700
@@ -26,12 +26,13 @@
 # include "incls/_precompiled.incl"
 # include "incls/_c1x_VMEntries.cpp.incl"
 
+
 /*
 * Class:     com_sun_hotspot_c1x_VMEntries
 * Method:    RiMethod_code
 * Signature: (Ljava/lang/Object;)[B
 */
-JNIEXPORT jbyteArray JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1code(JNIEnv *env, jclass, jobject method) {
+JNIEXPORT jbyteArray JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1code(JNIEnv *env, jobject, jobject method) {
   methodOop m = (methodOop)JNIHandles::resolve(method);
   int code_size = m->code_size();
   jbyteArray result = env->NewByteArray(code_size);
@@ -44,7 +45,7 @@
 * Method:    RiMethod_maxStackSize
 * Signature: (Ljava/lang/Object;)I
 */
-JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxStackSize(JNIEnv *, jclass, jobject method) {
+JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxStackSize(JNIEnv *, jobject, jobject method) {
   methodOop m = (methodOop)JNIHandles::resolve(method);
   return m->max_stack();
 }
@@ -54,7 +55,7 @@
 * Method:    RiMethod_maxLocals
 * Signature: (Ljava/lang/Object;)I
 */
-JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxLocals(JNIEnv *, jclass, jobject method) {
+JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxLocals(JNIEnv *, jobject, jobject method) {
   methodOop m = (methodOop)JNIHandles::resolve(method);
   return m->max_locals();
 }
@@ -64,7 +65,7 @@
 * Method:    RiMethod_holder
 * Signature: (Ljava/lang/Object;)Lcom/sun/cri/ri/RiType;
 */
-JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1holder(JNIEnv *, jclass, jobject method) {
+JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1holder(JNIEnv *, jobject, jobject method) {
   VM_ENTRY_MARK
   methodOop m = (methodOop)JNIHandles::resolve(method);
   klassOop k = m->method_holder();
@@ -76,7 +77,7 @@
 * Method:    RiMethod_signature
 * Signature: (Ljava/lang/Object;)Lcom/sun/cri/ri/RiSignature;
 */
-JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1signature(JNIEnv *env, jclass, jobject method) {
+JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1signature(JNIEnv *env, jobject, jobject method) {
   methodOop m = (methodOop)JNIHandles::resolve(method);
   return env->NewStringUTF(m->signature()->as_utf8());
 }
@@ -86,7 +87,7 @@
 * Method:    RiMethod_name
 * Signature: (Ljava/lang/Object;)Ljava/lang/String;
 */
-JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1name(JNIEnv *env, jclass, jobject method) {
+JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1name(JNIEnv *env, jobject, jobject method) {
   methodOop m = (methodOop)JNIHandles::resolve(method);
   return env->NewStringUTF(m->name()->as_utf8());
 }
@@ -96,7 +97,7 @@
 * Method:    RiSignature_lookupType
 * Signature: (Ljava/lang/String;Lcom/sun/cri/ri/RiType;)Lcom/sun/cri/ri/RiType;
 */
-JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1lookupType(JNIEnv *, jclass, jstring name, jobject accessor) {
+JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1lookupType(JNIEnv *, jobject, jstring name, jobject accessor) {
   VM_ENTRY_MARK
   klassOop k = (klassOop)JNIHandles::resolve(accessor);
   oop n = JNIHandles::resolve_external_guard(name);
@@ -114,7 +115,7 @@
 * Method:    RiSignature_symbolToString
 * Signature: (Ljava/lang/Object;)Ljava/lang/String;
 */
-JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1symbolToString(JNIEnv *env, jclass, jobject symbol) {
+JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1symbolToString(JNIEnv *env, jobject, jobject symbol) {
   symbolOop s = (symbolOop)JNIHandles::resolve(symbol);
   return env->NewStringUTF(s->as_utf8());
 }
@@ -124,7 +125,7 @@
 * Method:    RiType_javaClass
 * Signature: (Ljava/lang/Object;)Ljava/lang/Class;
 */
-JNIEXPORT jclass JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1javaClass(JNIEnv *, jclass, jobject klass) {
+JNIEXPORT jclass JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1javaClass(JNIEnv *, jobject, jobject klass) {
   klassOop k = (klassOop)JNIHandles::resolve(klass);
   oop result = k->klass_part()->java_mirror();
   return (jclass) JNIHandles::make_local(Thread::current(), result);
@@ -135,7 +136,7 @@
 * Method:    RiType_name
 * Signature: (Ljava/lang/Object;)Ljava/lang/String;
 */
-JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1name(JNIEnv *env, jclass, jobject klass) {
+JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1name(JNIEnv *env, jobject, jobject klass) {
   klassOop k = (klassOop)JNIHandles::resolve(klass);
   return env->NewStringUTF(k->klass_part()->name()->as_utf8());
 }
@@ -146,7 +147,7 @@
 * Method:    RiConstantPool_lookupConstant
 * Signature: (Ljava/lang/Object;I)Ljava/lang/Object;
 */
-JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupConstant(JNIEnv *env, jclass, jobject cpHandle, jint index) {
+JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupConstant(JNIEnv *env, jobject, jobject cpHandle, jint index) {
 
   VM_ENTRY_MARK;
   constantPoolOop cp = (constantPoolOop)JNIHandles::resolve(cpHandle);
@@ -206,7 +207,7 @@
 * Method:    RiConstantPool_lookupMethod
 * Signature: (Ljava/lang/Object;I)Lcom/sun/cri/ri/RiMethod;
 */
-JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupMethod(JNIEnv *env, jclass, jobject cpHandle, jint index, jbyte byteCode) {
+JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupMethod(JNIEnv *env, jobject, jobject cpHandle, jint index, jbyte byteCode) {
   VM_ENTRY_MARK;
   constantPoolOop cp = (constantPoolOop)JNIHandles::resolve(cpHandle);
   Bytecodes::Code bc = (Bytecodes::Code)(((int)byteCode) & 0xFF);
@@ -220,7 +221,7 @@
 * Method:    RiConstantPool_lookupSignature
 * Signature: (Ljava/lang/Object;I)Lcom/sun/cri/ri/RiSignature;
 */
-JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupSignature(JNIEnv *env, jclass, jobject cpHandle, jint index) {
+JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupSignature(JNIEnv *env, jobject, jobject cpHandle, jint index) {
   fatal("currently unsupported");
   return NULL;
 }
@@ -230,7 +231,7 @@
 * Method:    RiConstantPool_lookupType
 * Signature: (Ljava/lang/Object;I)Lcom/sun/cri/ri/RiType;
 */
-JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupType(JNIEnv *env, jclass, jobject cpHandle, jint index) {
+JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupType(JNIEnv *env, jobject, jobject cpHandle, jint index) {
   VM_ENTRY_MARK;
   constantPoolOop cp = (constantPoolOop)JNIHandles::resolve(cpHandle);
   ciInstanceKlass* loading_klass = (ciInstanceKlass *)CURRENT_ENV->get_object(cp->pool_holder());
@@ -245,7 +246,7 @@
 * Method:    RiConstantPool_lookupField
 * Signature: (Ljava/lang/Object;I)Lcom/sun/cri/ri/RiField;
 */
-JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupField(JNIEnv *env, jclass, jobject cpHandle, jint index) {
+JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupField(JNIEnv *env, jobject, jobject cpHandle, jint index) {
   VM_ENTRY_MARK;
   constantPoolOop cp = (constantPoolOop)JNIHandles::resolve(cpHandle);
   ciInstanceKlass* loading_klass = (ciInstanceKlass *)CURRENT_ENV->get_object(cp->pool_holder());
@@ -258,7 +259,7 @@
 * Method:    findRiType
 * Signature: (Ljava/lang/Object;)Lcom/sun/cri/ri/RiType;
 */
-JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_findRiType(JNIEnv *, jclass, jobject klass) {
+JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_findRiType(JNIEnv *, jobject, jobject klass) {
   VM_ENTRY_MARK;
   klassOop o = (klassOop)JNIHandles::resolve(klass);
   return JNIHandles::make_local(THREAD, C1XCompiler::get_RiType(o));
@@ -269,7 +270,7 @@
 * Method:    RiRuntime_getConstantPool
 * Signature: (Ljava/lang/Object;)Lcom/sun/cri/ri/RiConstantPool;
 */
-JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiRuntime_1getConstantPool(JNIEnv *, jclass, jobject klass) {
+JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiRuntime_1getConstantPool(JNIEnv *, jobject, jobject klass) {
   VM_ENTRY_MARK;
   klassOop o = (klassOop)JNIHandles::resolve(klass);
   return JNIHandles::make_local(THREAD, C1XCompiler::get_RiConstantPool(((instanceKlass*)o->klass_part())->constants()));
@@ -280,7 +281,7 @@
 * Method:    RiType_isArrayClass
 * Signature: (Ljava/lang/Object;)Z
 */
-JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isArrayClass(JNIEnv *, jclass, jobject klass) {
+JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isArrayClass(JNIEnv *, jobject, jobject klass) {
   klassOop o = (klassOop)JNIHandles::resolve(klass);
   o->print();
   bool result = o->klass_part()->oop_is_array();
@@ -293,7 +294,7 @@
 * Method:    RiType_isInstanceClass
 * Signature: (Ljava/lang/Object;)Z
 */
-JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInstanceClass(JNIEnv *, jclass, jobject klass) {
+JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInstanceClass(JNIEnv *, jobject, jobject klass) {
   klassOop o = (klassOop)JNIHandles::resolve(klass);
   return o->klass_part()->oop_is_instanceKlass();
 }
@@ -303,7 +304,7 @@
 * Method:    RiType_isInterface
 * Signature: (Ljava/lang/Object;)Z
 */
-JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInterface(JNIEnv *, jclass, jobject klass) {
+JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInterface(JNIEnv *, jobject, jobject klass) {
   klassOop o = (klassOop)JNIHandles::resolve(klass);
   return o->klass_part()->is_interface();
 }
@@ -313,41 +314,147 @@
 * Method:    RiMethod_accessFlags
 * Signature: (Ljava/lang/Object;)I
 */
-JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1accessFlags(JNIEnv *, jclass, jobject method) {
+JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1accessFlags(JNIEnv *, jobject, jobject method) {
   methodOop m = (methodOop)JNIHandles::resolve(method);
   return m->access_flags().as_int();
 }
 
+
+// helpers used to set fields in the HotSpotVMConfig object
+jfieldID getFieldID(JNIEnv* env, jobject obj, const char* name, const char* sig) {
+  jfieldID id = env->GetFieldID(env->GetObjectClass(obj), name, sig);
+  if (id == NULL) {
+    tty->print_cr("field not found: %s (%s)", name, sig);
+    assert(id != NULL, "field not found");
+  }
+  return id;
+}
+
+void set_boolean(JNIEnv* env, jobject obj, const char* name, bool value) { env->SetBooleanField(obj, getFieldID(env, obj, name, "Z"), value); }
+void set_int(JNIEnv* env, jobject obj, const char* name, int value) { env->SetIntField(obj, getFieldID(env, obj, name, "I"), value); }
+void set_long(JNIEnv* env, jobject obj, const char* name, long value) { env->SetLongField(obj, getFieldID(env, obj, name, "J"), value); }
+
+jboolean get_boolean(JNIEnv* env, jobject obj, const char* name) { return env->GetBooleanField(obj, getFieldID(env, obj, name, "Z")); }
+jint get_int(JNIEnv* env, jobject obj, const char* name) { return env->GetIntField(obj, getFieldID(env, obj, name, "I")); }
+jobject get_object(JNIEnv* env, jobject obj, const char* name) { return env->GetObjectField(obj, getFieldID(env, obj, name, "Ljava/lang/Object;")); }
+jobject get_object(JNIEnv* env, jobject obj, const char* name, const char* sig) { return env->GetObjectField(obj, getFieldID(env, obj, name, sig)); }
+
+
+// Helpful routine for computing field offsets at run time rather than hardcoding them
+int compute_offset(klassOop klass_oop, const char* name, const char* sig) {
+  JavaThread* THREAD = JavaThread::current();
+  fieldDescriptor fd;
+  instanceKlass* ik = instanceKlass::cast(klass_oop);
+  symbolOop name_symbol = SymbolTable::probe(name, (int)strlen(name));
+  symbolOop signature_symbol   = SymbolTable::probe(sig, (int)strlen(sig));
+  if (name_symbol == NULL || signature_symbol == NULL || !ik->find_local_field(name_symbol, signature_symbol, &fd)) {
+    ResourceMark rm;
+    tty->print_cr("Invalid layout of %s at %s", ik->external_name(), name_symbol->as_C_string());
+    fatal("Invalid layout of c1x4hotspot class");
+  }
+  return fd.offset();
+}
+
+
+class TypeHelper {
+public:
+  jclass        jniHotSpotType;
+  jclass        jniHotSpotTargetMethod;
+  klassOop      HotSpotType;
+  klassOop      HotSpotTargetMethod;
+  int           HotSpotType_klassOop;
+
+  TypeHelper(JNIEnv* jniEnv) {
+    jniHotSpotType = jniEnv->FindClass("com/sun/hotspot/c1x/HotSpotType");
+    jniHotSpotTargetMethod = jniEnv->FindClass("com/sun/hotspot/c1x/HotSpotTargetMethod");
+  }
+
+  void initialize() {
+    HotSpotType = java_lang_Class::as_klassOop(JNIHandles::resolve(jniHotSpotType));
+    HotSpotTargetMethod = java_lang_Class::as_klassOop(JNIHandles::resolve(jniHotSpotTargetMethod));
+    HotSpotType_klassOop = compute_offset(HotSpotType, "klassOop", "Ljava/lang/Object;");
+  }
+};
+
+
+
+
 /*
 * Class:     com_sun_hotspot_c1x_VMEntries
 * Method:    installCode
-* Signature: (Ljava/lang/Object;[BI)V
+* Signature: (Lcom/sun/hotspot/c1x/HotSpotTargetMethod;)V
 */
-JNIEXPORT void JNICALL Java_com_sun_hotspot_c1x_VMEntries_installCode(JNIEnv *jniEnv, jclass, jobject method, jbyteArray code, jint frameSize) {
+JNIEXPORT void JNICALL Java_com_sun_hotspot_c1x_VMEntries_installCode(JNIEnv *jniEnv, jobject, jobject targetMethod) {
+  TypeHelper types(jniEnv);
 
-  methodOop m = (methodOop)JNIHandles::resolve(method);
-  jboolean isCopy = false;
-  jbyte *codeBytes = jniEnv->GetByteArrayElements(code, &isCopy);
-  // TODO: Check if we need to disallocate?
-  int codeSize = jniEnv->GetArrayLength(code);
-  VM_ENTRY_MARK;
-  ciEnv *env = CURRENT_ENV;
+  methodOop m = (methodOop)JNIHandles::resolve(get_object(jniEnv, targetMethod, "methodOop"));
+  jbyteArray code = (jbyteArray)get_object(jniEnv, targetMethod, "code", "[B");
+  jintArray relocationOffsetsObj = (jintArray)get_object(jniEnv, targetMethod, "relocationOffsets", "[I");
+  jobjectArray relocationDataObj = (jobjectArray)get_object(jniEnv, targetMethod, "relocationData", "[Ljava/lang/Object;");
+  jint frameSize = get_int(jniEnv, targetMethod, "frameSize");
 
-  env->set_oop_recorder(new OopRecorder(env->arena()));
-  env->set_debug_info(new DebugInformationRecorder(env->oop_recorder()));
-  env->set_dependencies(new Dependencies(env));
-  ciMethod *ciMethodObject = (ciMethod *)env->get_object(m);
   CodeOffsets offsets;
 
   // TODO: This is a hack.. Produce correct entries.
   offsets.set_value(CodeOffsets::Exceptions, 0);
   offsets.set_value(CodeOffsets::Deopt, 0);
 
-  CodeBuffer buffer((address)codeBytes, codeSize);
+  offsets.set_value(CodeOffsets::Entry, get_int(jniEnv, targetMethod, "unverifiedEntrypoint"));
+  offsets.set_value(CodeOffsets::Verified_Entry, get_int(jniEnv, targetMethod, "verifiedEntrypoint"));
+
+  VM_ENTRY_MARK;
+  ciEnv *env = CURRENT_ENV;
+
+  types.initialize();
+
+  env->set_oop_recorder(new OopRecorder(env->arena()));
+  env->set_debug_info(new DebugInformationRecorder(env->oop_recorder()));
+  env->set_dependencies(new Dependencies(env));
+  ciMethod *ciMethodObject = (ciMethod *)env->get_object(m);
+
+  int codeSize = ((arrayOop)JNIHandles::resolve(code))->length();
+  int relocationCount = relocationOffsetsObj == NULL ? 0 : ((arrayOop)JNIHandles::resolve(relocationOffsetsObj))->length();
+
+  CodeBuffer buffer("c1x nmethod", codeSize, relocationCount * relocInfo::length_limit);
+  buffer.initialize_oop_recorder(env->oop_recorder());
+
+  // copy the code into the newly created CodeBuffer
+  CodeSection* instructions = buffer.insts();
+  memcpy(instructions->start(), ((arrayOop)JNIHandles::resolve(code))->base(T_BYTE), codeSize);
+  instructions->set_end(instructions->start() + codeSize);
+
+  if (relocationCount > 0) {
+    jint* relocationOffsets = (jint*)((arrayOop)JNIHandles::resolve(relocationOffsetsObj))->base(T_INT);
+    oop* relocationObjects = (oop*)((arrayOop)JNIHandles::resolve(relocationDataObj))->base(T_OBJECT);
+
+    for (int i=0; i<relocationCount; i++) {
+      address inst = (address)instructions->start() + relocationOffsets[i];
+      oop obj = relocationObjects[i];
+      assert(obj != NULL, "NULL oop needn't be patched");
+
+      if (java_lang_boxing_object::is_instance(obj, T_LONG)) {
+          address operand = Assembler::locate_operand(inst, Assembler::call32_operand);
+          long dest = obj->long_field(java_lang_boxing_object::value_offset_in_bytes(T_LONG));
+          long disp = dest - (long)(operand + 4);
+          assert(disp == (int) disp, "disp doesn't fit in 32 bits");
+          *((int*)operand) = (int)disp;
+
+          instructions->relocate(inst, runtime_call_Relocation::spec(), Assembler::call32_operand);
+          tty->print_cr("relocating (Long)");
+      } else if (obj->is_a(types.HotSpotType)) {
+          address operand = Assembler::locate_operand(inst, Assembler::imm_operand);
+
+          *((oop**)operand) = obj->obj_field_addr<oop>(types.HotSpotType_klassOop);
+          instructions->relocate(inst, oop_Relocation::spec_for_immediate(), Assembler::imm_operand);
+          tty->print_cr("relocating (HotSpotType)");
+      } else {
+          tty->print_cr("unknown relocation type");
+      }
+    }
+  }
+
   buffer.print();
-  CodeSection *inst_section = buffer.insts();
-  inst_section->set_end(inst_section->start() + codeSize);
-  buffer.initialize_oop_recorder(env->oop_recorder());
+
   OopMapSet oop_map_set;
   ExceptionHandlerTable handler_table;
   ImplicitExceptionTable inc_table;
@@ -358,25 +465,26 @@
   }
 }
 
-// helpers used to set fields in the HotSpotVMConfig object
-#define SET_CONFIG_BOOLEAN(name, value) { jfieldID id = jniEnv->GetFieldID(klass, #name, "Z"); jniEnv->SetBooleanField(config, id, value); }
-#define SET_CONFIG_INT(name, value) { jfieldID id = jniEnv->GetFieldID(klass, #name, "I"); jniEnv->SetIntField(config, id, value); }
-
 /*
 * Class:     com_sun_hotspot_c1x_VMEntries
 * Method:    getConfiguration
 * Signature: ()Lcom/sun/hotspot/c1x/HotSpotVMConfig;
 */
-JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getConfiguration(JNIEnv *jniEnv, jclass) {
-  jclass klass = jniEnv->FindClass("com/sun/hotspot/c1x/HotSpotVMConfig");
+JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getConfiguration(JNIEnv *env, jobject) {
+  jclass klass = env->FindClass("com/sun/hotspot/c1x/HotSpotVMConfig");
   assert(klass != NULL, "HotSpot vm config class not found");
-  jobject config = jniEnv->AllocObject(klass);
-  jfieldID id = jniEnv->GetFieldID(klass, "windowsOs", "Z");
+  jobject config = env->AllocObject(klass);
 #ifdef _WIN64
-  SET_CONFIG_BOOLEAN(windowsOs, true)
+  set_boolean(env, config, "windowsOs", true);
 #else
-  SET_CONFIG_BOOLEAN(windowsOs, false)
+  set_boolean(env, config, "windowsOs", false);
 #endif
+  set_int(env, config, "codeEntryAlignment", CodeEntryAlignment);
+  set_int(env, config, "vmPageSize", os::vm_page_size());
+  set_int(env, config, "stackShadowPages", StackShadowPages);
+  set_int(env, config, "hubOffset", oopDesc::klass_offset_in_bytes());
+  set_long(env, config, "instanceofStub", (long)Runtime1::entry_for(Runtime1::slow_subtype_check_id));
+  set_long(env, config, "debugStub", (long)warning);
   return config;
 }
 
@@ -389,6 +497,7 @@
   {CC"RiMethod_signature",              CC"(Ljava/lang/Object;)Ljava/lang/String;",                                 FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1signature)},
   {CC"RiMethod_name",                   CC"(Ljava/lang/Object;)Ljava/lang/String;",                                 FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1name)},
   {CC"RiSignature_lookupType",          CC"(Ljava/lang/String;Ljava/lang/Object;)Lcom/sun/cri/ri/RiType;",          FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1lookupType)},
+  {CC"RiSignature_symbolToString",      CC"(Ljava/lang/Object;)Ljava/lang/String;",                                 FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1symbolToString)},
   {CC"RiType_javaClass",                CC"(Ljava/lang/Object;)Ljava/lang/Class;",                                  FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1javaClass)},
   {CC"RiType_name",                     CC"(Ljava/lang/Object;)Ljava/lang/String;",                                 FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1name)},
   {CC"RiConstantPool_lookupConstant",   CC"(Ljava/lang/Object;I)Ljava/lang/Object;",                                FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupConstant)},
@@ -401,10 +510,10 @@
   {CC"RiType_isInstanceClass",          CC"(Ljava/lang/Object;)Z",                                                  FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInstanceClass)},
   {CC"RiType_isInterface",              CC"(Ljava/lang/Object;)Z",                                                  FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInterface)},
   {CC"RiMethod_accessFlags",            CC"(Ljava/lang/Object;)I",                                                  FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1accessFlags)},
-  {CC"installCode",                     CC"(Ljava/lang/Object;[BI)V",                                               FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installCode)},
+  {CC"installCode",                     CC"(Lcom/sun/hotspot/c1x/HotSpotTargetMethod;)V",                           FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installCode)},
   {CC"getConfiguration",                CC"()Lcom/sun/hotspot/c1x/HotSpotVMConfig;",                                FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getConfiguration)}
 };
 
 int VMEntries_methods_count() {
   return sizeof(VMEntries_methods) / sizeof(JNINativeMethod);
-}
\ No newline at end of file
+}