comparison src/share/vm/c1x/c1x_VMEntries.cpp @ 1429:abc670a709dc

* -XX:TraceC1X=0...5 controls the native c1x tracing * -Dc1x.debug=true turns on the logging proxies and lots of log output on the java side * provide more information about types to the compiler (type hierarchy, etc) * provide exception handler tables to the compiler * add exception handlers to the nmethod * correct implementation of ExceptionObject * exception handling/unwinding entry points * modified versions of handle/unwind exception stubs using standard calling conventions * exception throwing * implicit null pointer exception, implicit div by 0 exception * arraystore/classcast/arrayindex exceptions * checkcast implementation * newarray, anewarray, multinewarray implementation * correct new instance initialization * access to java class mirrors (for ldc) * unresolved methods * class resolving - class patching (asssembly prototype copying)
author Lukas Stadler <lukas.stadler@oracle.com>
date Tue, 31 Aug 2010 22:13:30 -0700
parents 695451afc619
children b61a43cd1255
comparison
equal deleted inserted replaced
1428:695451afc619 1429:abc670a709dc
49 } 49 }
50 50
51 // public RiType RiMethod_holder(long vmId); 51 // public RiType RiMethod_holder(long vmId);
52 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1holder(JNIEnv *, jobject, jlong vmId) { 52 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1holder(JNIEnv *, jobject, jlong vmId) {
53 VM_ENTRY_MARK 53 VM_ENTRY_MARK
54 klassOop klass = VmIds::get<methodOop>(vmId)->method_holder(); 54 KlassHandle klass = VmIds::get<methodOop>(vmId)->method_holder();
55 jlong klassVmId = VmIds::add<klassOop>(klass); 55 Handle name = VmIds::toString<Handle>(klass->name(), CHECK_NULL);
56 Handle name = VmIds::toString<Handle>(klass->klass_part()->name(), CHECK_NULL); 56 oop holder = C1XCompiler::createHotSpotTypeResolved(klass, name, CHECK_NULL);
57 oop holder = VMExits::createRiType(klassVmId, name, THREAD);
58 return JNIHandles::make_local(THREAD, holder); 57 return JNIHandles::make_local(THREAD, holder);
59 } 58 }
60 59
61 // public String RiMethod_signature(long vmId); 60 // public String RiMethod_signature(long vmId);
62 JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1signature(JNIEnv *env, jobject, jlong vmId) { 61 JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1signature(JNIEnv *env, jobject, jlong vmId) {
63 VM_ENTRY_MARK 62 VM_ENTRY_MARK
64 methodOop method = VmIds::get<methodOop>(vmId); 63 methodOop method = VmIds::get<methodOop>(vmId);
64 method->constMethod()->exception_table();
65 return VmIds::toString<jstring>(method->signature(), THREAD); 65 return VmIds::toString<jstring>(method->signature(), THREAD);
66 } 66 }
67 67
68 // public int RiMethod_accessFlags(long vmId); 68 // public int RiMethod_accessFlags(long vmId);
69 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1accessFlags(JNIEnv *, jobject, jlong vmId) { 69 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1accessFlags(JNIEnv *, jobject, jlong vmId) {
70 return VmIds::get<methodOop>(vmId)->access_flags().as_int(); 70 return VmIds::get<methodOop>(vmId)->access_flags().as_int();
71 } 71 }
72 72
73 // public RiExceptionHandler[] RiMethod_exceptionHandlers(long vmId);
74 JNIEXPORT jobjectArray JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1exceptionHandlers(JNIEnv *, jobject, jlong vmId) {
75 VM_ENTRY_MARK
76 methodHandle method = VmIds::get<methodOop>(vmId);
77 typeArrayHandle handlers = method->exception_table();
78 int handler_count = handlers.is_null() ? 0 : handlers->length() / 4;
79
80 instanceKlass::cast(HotSpotExceptionHandler::klass())->initialize(CHECK_NULL);
81 objArrayHandle array = oopFactory::new_objArray(SystemDictionary::RiExceptionHandler_klass(), handler_count, CHECK_NULL);
82
83 for (int i=0; i<handler_count; i++) {
84 // exception handlers are stored as four integers: start bci, end bci, handler bci, catch class constant pool index
85 int base = i * 4;
86 Handle entry = instanceKlass::cast(HotSpotExceptionHandler::klass())->allocate_instance(CHECK_NULL);
87 HotSpotExceptionHandler::set_startBci(entry, handlers->int_at(base + 0));
88 HotSpotExceptionHandler::set_endBci(entry, handlers->int_at(base + 1));
89 HotSpotExceptionHandler::set_handlerBci(entry, handlers->int_at(base + 2));
90 int catch_class_index = handlers->int_at(base + 3);
91 HotSpotExceptionHandler::set_catchClassIndex(entry, catch_class_index);
92
93 if (catch_class_index == 0) {
94 HotSpotExceptionHandler::set_catchClass(entry, NULL);
95 } else {
96 constantPoolOop cp = instanceKlass::cast(method->method_holder())->constants();
97 ciInstanceKlass* loading_klass = (ciInstanceKlass *)CURRENT_ENV->get_object(method->method_holder());
98 bool is_accessible = false;
99 ciKlass *klass = CURRENT_ENV->get_klass_by_index(cp, catch_class_index, is_accessible, loading_klass);
100 oop catch_class = C1XCompiler::get_RiType(klass, method->method_holder(), CHECK_NULL);
101
102 HotSpotExceptionHandler::set_catchClass(entry, catch_class);
103 }
104 array->obj_at_put(i, entry());
105 }
106
107 return (jobjectArray)JNIHandles::make_local(array());
108 }
109
73 // public RiType RiSignature_lookupType(String returnType, long accessingClassVmId); 110 // public RiType RiSignature_lookupType(String returnType, long accessingClassVmId);
74 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1lookupType(JNIEnv *, jobject, jstring jname, jlong accessingClassVmId) { 111 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1lookupType(JNIEnv *env, jobject, jstring jname, jlong accessingClassVmId) {
75 VM_ENTRY_MARK; 112 VM_ENTRY_MARK;
76 113
77 symbolOop nameSymbol = VmIds::toSymbol(jname); 114 symbolOop nameSymbol = VmIds::toSymbol(jname);
78 Handle name = JNIHandles::resolve(jname); 115 Handle name = JNIHandles::resolve(jname);
79 116
101 classloader = VmIds::get<klassOop>(accessingClassVmId)->klass_part()->class_loader(); 138 classloader = VmIds::get<klassOop>(accessingClassVmId)->klass_part()->class_loader();
102 protectionDomain = VmIds::get<klassOop>(accessingClassVmId)->klass_part()->protection_domain(); 139 protectionDomain = VmIds::get<klassOop>(accessingClassVmId)->klass_part()->protection_domain();
103 } 140 }
104 klassOop resolved_type = SystemDictionary::resolve_or_null(nameSymbol, classloader, protectionDomain, THREAD); 141 klassOop resolved_type = SystemDictionary::resolve_or_null(nameSymbol, classloader, protectionDomain, THREAD);
105 if (resolved_type != NULL) { 142 if (resolved_type != NULL) {
106 result = VMExits::createRiType(VmIds::add<klassOop>(resolved_type), name, THREAD); 143 result = C1XCompiler::createHotSpotTypeResolved(resolved_type, name, CHECK_NULL);
107 } else { 144 } else {
108 result = VMExits::createRiTypeUnresolved(name, accessingClassVmId, THREAD); 145 result = VMExits::createRiTypeUnresolved(name, accessingClassVmId, THREAD);
109 } 146 }
110 } 147 }
111 148
141 return NULL; 178 return NULL;
142 } 179 }
143 } 180 }
144 result = VMExits::createCiConstantObject(VmIds::add<oop>(string), CHECK_0); 181 result = VMExits::createCiConstantObject(VmIds::add<oop>(string), CHECK_0);
145 } else if (tag.is_klass() || tag.is_unresolved_klass()) { 182 } else if (tag.is_klass() || tag.is_unresolved_klass()) {
146 183 bool ignore;
147 // TODO: Return RiType object 184 ciInstanceKlass* accessor = (ciInstanceKlass*)ciEnv::current()->get_object(cp->pool_holder());
148 ShouldNotReachHere(); 185 ciKlass* klass = ciEnv::current()->get_klass_by_index(cp, index, ignore, accessor);
149 // 4881222: allow ldc to take a class type 186 result = C1XCompiler::get_RiType(klass, cp->pool_holder(), CHECK_NULL);
150 //bool ignore;
151 //ciKlass* klass = get_klass_by_index_impl(cpool, index, ignore, accessor);
152 //if (HAS_PENDING_EXCEPTION) {
153 // CLEAR_PENDING_EXCEPTION;
154 // record_out_of_memory_failure();
155 // return ciConstant();
156 //}
157 //assert (klass->is_instance_klass() || klass->is_array_klass(),
158 // "must be an instance or array klass ");
159 //return ciConstant(T_OBJECT, klass);
160 } else if (tag.is_object()) { 187 } else if (tag.is_object()) {
161 oop obj = cp->object_at(index); 188 oop obj = cp->object_at(index);
162 assert(obj->is_instance(), "must be an instance"); 189 assert(obj->is_instance(), "must be an instance");
163 result = VMExits::createCiConstantObject(VmIds::add<oop>(obj), CHECK_0); 190 result = VMExits::createCiConstantObject(VmIds::add<oop>(obj), CHECK_NULL);
164 } else { 191 } else {
165 ShouldNotReachHere(); 192 ShouldNotReachHere();
166 } 193 }
167 194
168 return JNIHandles::make_local(THREAD, result); 195 return JNIHandles::make_local(THREAD, result);
170 197
171 // public RiMethod RiConstantPool_lookupMethod(long vmId, int cpi, byte byteCode); 198 // public RiMethod RiConstantPool_lookupMethod(long vmId, int cpi, byte byteCode);
172 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupMethod(JNIEnv *env, jobject, jlong vmId, jint index, jbyte byteCode) { 199 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupMethod(JNIEnv *env, jobject, jlong vmId, jint index, jbyte byteCode) {
173 VM_ENTRY_MARK; 200 VM_ENTRY_MARK;
174 201
175 constantPoolOop cp = VmIds::get<constantPoolOop>(vmId); 202 constantPoolHandle cp = VmIds::get<constantPoolOop>(vmId);
176 203
177 Bytecodes::Code bc = (Bytecodes::Code)(((int)byteCode) & 0xFF); 204 Bytecodes::Code bc = (Bytecodes::Code)(((int)byteCode) & 0xFF);
178 ciInstanceKlass* loading_klass = (ciInstanceKlass *)CURRENT_ENV->get_object(cp->pool_holder()); 205 ciInstanceKlass* loading_klass = (ciInstanceKlass *)CURRENT_ENV->get_object(cp->pool_holder());
179 ciMethod *cimethod = CURRENT_ENV->get_method_by_index(cp, index, bc, loading_klass); 206 ciMethod *cimethod = CURRENT_ENV->get_method_by_index(cp, index, bc, loading_klass);
180 methodOop method = (methodOop)cimethod->get_oop(); 207 if (cimethod->is_loaded()) {
181 Handle name = VmIds::toString<Handle>(method->name(), CHECK_NULL); 208 methodOop method = (methodOop)cimethod->get_oop();
182 return JNIHandles::make_local(THREAD, VMExits::createRiMethod(VmIds::add<methodOop>(method), name, THREAD)); 209 Handle name = VmIds::toString<Handle>(method->name(), CHECK_NULL);
210 return JNIHandles::make_local(THREAD, VMExits::createRiMethodResolved(VmIds::add<methodOop>(method), name, THREAD));
211 } else {
212 Handle name = VmIds::toString<Handle>((symbolOop)cimethod->name()->get_oop(), CHECK_NULL);
213 Handle signature = VmIds::toString<Handle>((symbolOop)cimethod->signature()->as_symbol()->get_oop(), CHECK_NULL);
214 Handle holder = C1XCompiler::get_RiType(cimethod->holder(), cp->klass(), THREAD);
215 return JNIHandles::make_local(THREAD, VMExits::createRiMethodUnresolved(name, signature, holder, THREAD));
216 }
183 } 217 }
184 218
185 // public RiSignature RiConstantPool_lookupSignature(long vmId, int cpi); 219 // public RiSignature RiConstantPool_lookupSignature(long vmId, int cpi);
186 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupSignature(JNIEnv *env, jobject, jlong vmId, jint index) { 220 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupSignature(JNIEnv *env, jobject, jlong vmId, jint index) {
187 fatal("currently unsupported"); 221 fatal("currently unsupported");
196 230
197 ciInstanceKlass* loading_klass = (ciInstanceKlass *)CURRENT_ENV->get_object(cp->pool_holder()); 231 ciInstanceKlass* loading_klass = (ciInstanceKlass *)CURRENT_ENV->get_object(cp->pool_holder());
198 bool is_accessible = false; 232 bool is_accessible = false;
199 ciKlass *klass = CURRENT_ENV->get_klass_by_index(cp, index, is_accessible, loading_klass); 233 ciKlass *klass = CURRENT_ENV->get_klass_by_index(cp, index, is_accessible, loading_klass);
200 return JNIHandles::make_local(THREAD, C1XCompiler::get_RiType(klass, cp->klass(), THREAD)); 234 return JNIHandles::make_local(THREAD, C1XCompiler::get_RiType(klass, cp->klass(), THREAD));
201
202 } 235 }
203 236
204 // public RiField RiConstantPool_lookupField(long vmId, int cpi); 237 // public RiField RiConstantPool_lookupField(long vmId, int cpi);
205 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupField(JNIEnv *env, jobject, jlong vmId, jint index) { 238 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupField(JNIEnv *env, jobject, jlong vmId, jint index) {
206 VM_ENTRY_MARK; 239 VM_ENTRY_MARK;
218 251
219 constantPoolOop constantPool = instanceKlass::cast(VmIds::get<klassOop>(vmId))->constants(); 252 constantPoolOop constantPool = instanceKlass::cast(VmIds::get<klassOop>(vmId))->constants();
220 return JNIHandles::make_local(VMExits::createRiConstantPool(VmIds::add<constantPoolOop>(constantPool), THREAD)); 253 return JNIHandles::make_local(VMExits::createRiConstantPool(VmIds::add<constantPoolOop>(constantPool), THREAD));
221 } 254 }
222 255
223 // public boolean RiType_isArrayClass(long vmId); 256 // public RiMethod RiType_resolveMethodImpl(long vmId, String name, String signature);
224 JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isArrayClass(JNIEnv *, jobject, jlong vmId) { 257 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_3resolveMethodImpl(JNIEnv *, jobject, jlong vmId, jstring name, jstring signature) {
225 return VmIds::get<klassOop>(vmId)->klass_part()->oop_is_javaArray(); 258 VM_ENTRY_MARK;
226 } 259
227 260 klassOop klass = VmIds::get<klassOop>(vmId);
228 // public boolean RiType_isInstanceClass(long vmId); 261 methodOop method = klass->klass_part()->lookup_method(VmIds::toSymbol(name), VmIds::toSymbol(signature));
229 JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInstanceClass(JNIEnv *, jobject, jlong vmId) { 262 return JNIHandles::make_local(THREAD, VMExits::createRiMethodResolved(VmIds::add<methodOop>(method), Handle(JNIHandles::resolve(name)), THREAD));
230 return VmIds::get<klassOop>(vmId)->klass_part()->oop_is_instance(); 263 }
231 } 264
232 265 // public boolean RiType_isSubtypeOf(long vmId, RiType other);
233 // public boolean RiType_isInterface(long vmId); 266 JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_2isSubtypeOf(JNIEnv *, jobject, jlong vmId, jobject jother) {
234 JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInterface(JNIEnv *, jobject, jlong vmId) { 267 oop other = JNIHandles::resolve(jother);
235 return VmIds::get<klassOop>(vmId)->klass_part()->is_interface(); 268 assert(other->is_a(HotSpotTypeResolved::klass()), "resolved hotspot type expected");
236 } 269 klassOop thisKlass = VmIds::get<klassOop>(vmId);
237 270 klassOop otherKlass = VmIds::get<klassOop>(HotSpotTypeResolved::vmId(other));
238 // public long RiType_instanceSize(long vmId); 271 return instanceKlass::cast(thisKlass)->is_subtype_of(otherKlass);
239 JNIEXPORT jlong JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1instanceSize(JNIEnv *, jobject, jlong vmId) { 272 }
240 return align_object_size(instanceKlass::cast(VmIds::get<klassOop>(vmId))->size_helper() * HeapWordSize);
241 }
242
243 273
244 // helpers used to set fields in the HotSpotVMConfig object 274 // helpers used to set fields in the HotSpotVMConfig object
245 jfieldID getFieldID(JNIEnv* env, jobject obj, const char* name, const char* sig) { 275 jfieldID getFieldID(JNIEnv* env, jobject obj, const char* name, const char* sig) {
246 jfieldID id = env->GetFieldID(env->GetObjectClass(obj), name, sig); 276 jfieldID id = env->GetFieldID(env->GetObjectClass(obj), name, sig);
247 if (id == NULL) { 277 if (id == NULL) {
248 tty->print_cr("field not found: %s (%s)", name, sig); 278 TRACE_C1X_1("field not found: %s (%s)", name, sig);
249 assert(id != NULL, "field not found"); 279 fatal("field not found");
250 } 280 }
251 return id; 281 return id;
252 } 282 }
283
284 // public RiType getPrimitiveArrayType(CiKind kind);
285 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) {
286 VM_ENTRY_MARK;
287 BasicType type;
288 switch(CiKind::typeChar(kind)) {
289 case 'z': type = T_BOOLEAN; break;
290 case 'b': type = T_BYTE; break;
291 case 's': type = T_SHORT; break;
292 case 'c': type = T_CHAR; break;
293 case 'i': type = T_INT; break;
294 case 'f': type = T_FLOAT; break;
295 case 'l': type = T_LONG; break;
296 case 'd': type = T_DOUBLE; break;
297 case 'a':
298 default:
299 fatal("unexpected CiKind in getPrimitiveArrayType");
300 break;
301 }
302 ciKlass* klass = ciTypeArrayKlass::make(type);
303 return JNIHandles::make_local(THREAD, C1XCompiler::get_RiType(klass, NULL, THREAD));
304 }
305
253 306
254 void set_boolean(JNIEnv* env, jobject obj, const char* name, bool value) { env->SetBooleanField(obj, getFieldID(env, obj, name, "Z"), value); } 307 void set_boolean(JNIEnv* env, jobject obj, const char* name, bool value) { env->SetBooleanField(obj, getFieldID(env, obj, name, "Z"), value); }
255 void set_int(JNIEnv* env, jobject obj, const char* name, int value) { env->SetIntField(obj, getFieldID(env, obj, name, "I"), value); } 308 void set_int(JNIEnv* env, jobject obj, const char* name, int value) { env->SetIntField(obj, getFieldID(env, obj, name, "I"), value); }
256 void set_long(JNIEnv* env, jobject obj, const char* name, long value) { env->SetLongField(obj, getFieldID(env, obj, name, "J"), value); } 309 void set_long(JNIEnv* env, jobject obj, const char* name, long value) { env->SetLongField(obj, getFieldID(env, obj, name, "J"), value); }
257 void set_object(JNIEnv* env, jobject obj, const char* name, jobject value) { env->SetObjectField(obj, getFieldID(env, obj, name, "Ljava/lang/Object;"), value); } 310 void set_object(JNIEnv* env, jobject obj, const char* name, jobject value) { env->SetObjectField(obj, getFieldID(env, obj, name, "Ljava/lang/Object;"), value); }
267 BasicType basicTypes[] = { T_BOOLEAN, T_BYTE, T_SHORT, T_CHAR, T_INT, T_FLOAT, T_LONG, T_DOUBLE, T_OBJECT }; 320 BasicType basicTypes[] = { T_BOOLEAN, T_BYTE, T_SHORT, T_CHAR, T_INT, T_FLOAT, T_LONG, T_DOUBLE, T_OBJECT };
268 int basicTypeCount = sizeof(basicTypes) / sizeof(BasicType); 321 int basicTypeCount = sizeof(basicTypes) / sizeof(BasicType);
269 322
270 // public HotSpotVMConfig getConfiguration(); 323 // public HotSpotVMConfig getConfiguration();
271 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getConfiguration(JNIEnv *env, jobject) { 324 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_getConfiguration(JNIEnv *env, jobject) {
272 tty->print_cr("Java_com_sun_hotspot_c1x_VMEntries_getConfiguration");
273 jclass klass = env->FindClass("com/sun/hotspot/c1x/HotSpotVMConfig"); 325 jclass klass = env->FindClass("com/sun/hotspot/c1x/HotSpotVMConfig");
274 assert(klass != NULL, "HotSpot vm config class not found"); 326 assert(klass != NULL, "HotSpot vm config class not found");
275 jobject config = env->AllocObject(klass); 327 jobject config = env->AllocObject(klass);
276 #ifdef _WIN64 328 #ifdef _WIN64
277 set_boolean(env, config, "windowsOs", true); 329 set_boolean(env, config, "windowsOs", true);
284 set_int(env, config, "hubOffset", oopDesc::klass_offset_in_bytes()); 336 set_int(env, config, "hubOffset", oopDesc::klass_offset_in_bytes());
285 set_int(env, config, "arrayLengthOffset", arrayOopDesc::length_offset_in_bytes()); 337 set_int(env, config, "arrayLengthOffset", arrayOopDesc::length_offset_in_bytes());
286 set_int(env, config, "threadTlabTopOffset", in_bytes(JavaThread::tlab_top_offset())); 338 set_int(env, config, "threadTlabTopOffset", in_bytes(JavaThread::tlab_top_offset()));
287 set_int(env, config, "threadTlabEndOffset", in_bytes(JavaThread::tlab_end_offset())); 339 set_int(env, config, "threadTlabEndOffset", in_bytes(JavaThread::tlab_end_offset()));
288 set_int(env, config, "instanceHeaderPrototypeOffset", Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes()); 340 set_int(env, config, "instanceHeaderPrototypeOffset", Klass::prototype_header_offset_in_bytes() + klassOopDesc::klass_part_offset_in_bytes());
289 341 set_int(env, config, "threadExceptionOopOffset", in_bytes(JavaThread::exception_oop_offset()));
342 set_int(env, config, "threadExceptionPcOffset", in_bytes(JavaThread::exception_pc_offset()));
343 set_int(env, config, "threadMultiNewArrayStorage", in_bytes(JavaThread::c1x_multinewarray_storage_offset()));
344
345 set_long(env, config, "debugStub", VmIds::addStub((address)warning));
290 set_long(env, config, "instanceofStub", VmIds::addStub(Runtime1::entry_for(Runtime1::slow_subtype_check_id))); 346 set_long(env, config, "instanceofStub", VmIds::addStub(Runtime1::entry_for(Runtime1::slow_subtype_check_id)));
291 set_long(env, config, "debugStub", VmIds::addStub((address)warning)); 347 set_long(env, config, "newInstanceStub", VmIds::addStub(Runtime1::entry_for(Runtime1::fast_new_instance_init_check_id)));
348 set_long(env, config, "newTypeArrayStub", VmIds::addStub(Runtime1::entry_for(Runtime1::new_type_array_id)));
349 set_long(env, config, "newObjectArrayStub", VmIds::addStub(Runtime1::entry_for(Runtime1::new_object_array_id)));
350 set_long(env, config, "newMultiArrayStub", VmIds::addStub(Runtime1::entry_for(Runtime1::new_multi_array_id)));
351 set_long(env, config, "loadKlassStub", VmIds::addStub(Runtime1::entry_for(Runtime1::load_klass_patching_id)));
292 set_long(env, config, "resolveStaticCallStub", VmIds::addStub(SharedRuntime::get_resolve_static_call_stub())); 352 set_long(env, config, "resolveStaticCallStub", VmIds::addStub(SharedRuntime::get_resolve_static_call_stub()));
293 set_long(env, config, "newInstanceStub", VmIds::addStub(Runtime1::entry_for(Runtime1::fast_new_instance_id))); 353 set_long(env, config, "unwindExceptionStub", VmIds::addStub(Runtime1::entry_for(Runtime1::c1x_unwind_exception_call_id)));
294 set_long(env, config, "throwImplicitNullStub", VmIds::addStub(Runtime1::entry_for(Runtime1::throw_null_pointer_exception_id))); 354 set_long(env, config, "handleExceptionStub", VmIds::addStub(Runtime1::entry_for(Runtime1::handle_exception_nofpu_id)));
355 set_long(env, config, "throwClassCastException", VmIds::addStub(Runtime1::entry_for(Runtime1::throw_class_cast_exception_id)));
356 set_long(env, config, "throwArrayStoreException", VmIds::addStub(Runtime1::entry_for(Runtime1::throw_array_store_exception_id)));
357 set_long(env, config, "throwArrayIndexException", VmIds::addStub(Runtime1::entry_for(Runtime1::throw_range_check_failed_id)));
295 358
296 jintArray arrayOffsets = env->NewIntArray(basicTypeCount); 359 jintArray arrayOffsets = env->NewIntArray(basicTypeCount);
297 for (int i=0; i<basicTypeCount; i++) { 360 for (int i=0; i<basicTypeCount; i++) {
298 jint offset = arrayOopDesc::base_offset_in_bytes(basicTypes[i]); 361 jint offset = arrayOopDesc::base_offset_in_bytes(basicTypes[i]);
299 env->SetIntArrayRegion(arrayOffsets, i, 1, &offset); 362 env->SetIntArrayRegion(arrayOffsets, i, 1, &offset);
325 #define TYPE "Lcom/sun/cri/ri/RiType;" 388 #define TYPE "Lcom/sun/cri/ri/RiType;"
326 #define METHOD "Lcom/sun/cri/ri/RiMethod;" 389 #define METHOD "Lcom/sun/cri/ri/RiMethod;"
327 #define SIGNATURE "Lcom/sun/cri/ri/RiSignature;" 390 #define SIGNATURE "Lcom/sun/cri/ri/RiSignature;"
328 #define FIELD "Lcom/sun/cri/ri/RiField;" 391 #define FIELD "Lcom/sun/cri/ri/RiField;"
329 #define CONSTANT_POOL "Lcom/sun/cri/ri/RiConstantPool;" 392 #define CONSTANT_POOL "Lcom/sun/cri/ri/RiConstantPool;"
393 #define EXCEPTION_HANDLERS "[Lcom/sun/cri/ri/RiExceptionHandler;"
330 #define TARGET_METHOD "Lcom/sun/hotspot/c1x/HotSpotTargetMethod;" 394 #define TARGET_METHOD "Lcom/sun/hotspot/c1x/HotSpotTargetMethod;"
331 #define CONFIG "Lcom/sun/hotspot/c1x/HotSpotVMConfig;" 395 #define CONFIG "Lcom/sun/hotspot/c1x/HotSpotVMConfig;"
332 #define HS_METHOD "Lcom/sun/hotspot/c1x/HotSpotMethod;" 396 #define HS_METHOD "Lcom/sun/hotspot/c1x/HotSpotMethod;"
333 #define CI_CONSTANT "Lcom/sun/cri/ci/CiConstant;" 397 #define CI_CONSTANT "Lcom/sun/cri/ci/CiConstant;"
398 #define CI_KIND "Lcom/sun/cri/ci/CiKind;"
334 #define STRING "Ljava/lang/String;" 399 #define STRING "Ljava/lang/String;"
335 #define OBJECT "Ljava/lang/Object;" 400 #define OBJECT "Ljava/lang/Object;"
336 401
337 JNINativeMethod VMEntries_methods[] = { 402 JNINativeMethod VMEntries_methods[] = {
338 {CC"RiMethod_code", CC"("PROXY")[B", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1code)}, 403 {CC"RiMethod_code", CC"("PROXY")[B", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1code)},
339 {CC"RiMethod_maxStackSize", CC"("PROXY")I", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxStackSize)}, 404 {CC"RiMethod_maxStackSize", CC"("PROXY")I", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxStackSize)},
340 {CC"RiMethod_maxLocals", CC"("PROXY")I", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxLocals)}, 405 {CC"RiMethod_maxLocals", CC"("PROXY")I", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxLocals)},
341 {CC"RiMethod_holder", CC"("PROXY")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1holder)}, 406 {CC"RiMethod_holder", CC"("PROXY")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1holder)},
342 {CC"RiMethod_signature", CC"("PROXY")"STRING, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1signature)}, 407 {CC"RiMethod_signature", CC"("PROXY")"STRING, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1signature)},
343 {CC"RiMethod_accessFlags", CC"("PROXY")I", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1accessFlags)}, 408 {CC"RiMethod_accessFlags", CC"("PROXY")I", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1accessFlags)},
409 {CC"RiMethod_exceptionHandlers", CC"("PROXY")"EXCEPTION_HANDLERS, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1exceptionHandlers)},
344 {CC"RiSignature_lookupType", CC"("STRING PROXY")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1lookupType)}, 410 {CC"RiSignature_lookupType", CC"("STRING PROXY")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1lookupType)},
345 {CC"RiConstantPool_lookupConstant", CC"("PROXY"I)"CI_CONSTANT, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupConstant)}, 411 {CC"RiConstantPool_lookupConstant", CC"("PROXY"I)"OBJECT, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupConstant)},
346 {CC"RiConstantPool_lookupMethod", CC"("PROXY"IB)"METHOD, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupMethod)}, 412 {CC"RiConstantPool_lookupMethod", CC"("PROXY"IB)"METHOD, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupMethod)},
347 {CC"RiConstantPool_lookupSignature", CC"("PROXY"I)"SIGNATURE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupSignature)}, 413 {CC"RiConstantPool_lookupSignature", CC"("PROXY"I)"SIGNATURE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupSignature)},
348 {CC"RiConstantPool_lookupType", CC"("PROXY"I)"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupType)}, 414 {CC"RiConstantPool_lookupType", CC"("PROXY"I)"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupType)},
349 {CC"RiConstantPool_lookupField", CC"("PROXY"I)"FIELD, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupField)}, 415 {CC"RiConstantPool_lookupField", CC"("PROXY"I)"FIELD, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupField)},
350 {CC"RiType_constantPool", CC"("PROXY")"CONSTANT_POOL, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1constantPool)}, 416 {CC"RiType_constantPool", CC"("PROXY")"CONSTANT_POOL, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1constantPool)},
351 {CC"RiType_isArrayClass", CC"("PROXY")Z", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1isArrayClass)}, 417 {CC"RiType_resolveMethodImpl", CC"("PROXY STRING STRING")"METHOD, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_3resolveMethodImpl)},
352 {CC"RiType_isInstanceClass", CC"("PROXY")Z", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInstanceClass)}, 418 {CC"RiType_isSubtypeOf", CC"("PROXY TYPE")Z", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_2isSubtypeOf)},
353 {CC"RiType_isInterface", CC"("PROXY")Z", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInterface)}, 419 {CC"getPrimitiveArrayType", CC"("CI_KIND")"TYPE, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getPrimitiveArrayType)},
354 {CC"RiType_instanceSize", CC"("PROXY")J", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1instanceSize)},
355 {CC"getConfiguration", CC"()"CONFIG, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getConfiguration)}, 420 {CC"getConfiguration", CC"()"CONFIG, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getConfiguration)},
356 {CC"installMethod", CC"("TARGET_METHOD")V", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installMethod)}, 421 {CC"installMethod", CC"("TARGET_METHOD")V", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installMethod)},
357 {CC"installStub", CC"("TARGET_METHOD")"PROXY, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installStub)} 422 {CC"installStub", CC"("TARGET_METHOD")"PROXY, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installStub)}
358 }; 423 };
359 424