Mercurial > hg > truffle
comparison src/share/vm/c1x/c1x_VMEntries.cpp @ 1425:98fffb304868
tlab-allocated "new instance", invokespecial, support for static fields in COMPILER_CLASSES_DO
author | Lukas Stadler <lukas.stadler@oracle.com> |
---|---|
date | Tue, 17 Aug 2010 17:34:25 -0700 |
parents | 760213a60e8b |
children | 149b1d2316de |
comparison
equal
deleted
inserted
replaced
1424:1ea65e9d943c | 1425:98fffb304868 |
---|---|
27 # include "incls/_c1x_VMEntries.cpp.incl" | 27 # include "incls/_c1x_VMEntries.cpp.incl" |
28 | 28 |
29 | 29 |
30 | 30 |
31 | 31 |
32 // public byte[] RiMethod_code(HotSpotProxy method); | 32 // public byte[] RiMethod_code(long vmId); |
33 JNIEXPORT jbyteArray JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1code(JNIEnv *env, jobject, jlong vmId) { | 33 JNIEXPORT jbyteArray JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1code(JNIEnv *env, jobject, jlong vmId) { |
34 methodOop method = C1XObjects::get<methodOop>(vmId); | 34 methodOop method = C1XObjects::get<methodOop>(vmId); |
35 int code_size = method->code_size(); | 35 int code_size = method->code_size(); |
36 jbyteArray result = env->NewByteArray(code_size); | 36 jbyteArray result = env->NewByteArray(code_size); |
37 env->SetByteArrayRegion(result, 0, code_size, (const jbyte *)method->code_base()); | 37 env->SetByteArrayRegion(result, 0, code_size, (const jbyte *)method->code_base()); |
38 return result; | 38 return result; |
39 } | 39 } |
40 | 40 |
41 // public int RiMethod_maxStackSize(HotSpotProxy method); | 41 // public int RiMethod_maxStackSize(long vmId); |
42 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxStackSize(JNIEnv *, jobject, jlong vmId) { | 42 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxStackSize(JNIEnv *, jobject, jlong vmId) { |
43 return C1XObjects::get<methodOop>(vmId)->max_stack(); | 43 return C1XObjects::get<methodOop>(vmId)->max_stack(); |
44 } | 44 } |
45 | 45 |
46 // public int RiMethod_maxLocals(HotSpotProxy method); | 46 // public int RiMethod_maxLocals(long vmId); |
47 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxLocals(JNIEnv *, jobject, jlong vmId) { | 47 JNIEXPORT jint JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1maxLocals(JNIEnv *, jobject, jlong vmId) { |
48 return C1XObjects::get<methodOop>(vmId)->max_locals(); | 48 return C1XObjects::get<methodOop>(vmId)->max_locals(); |
49 } | 49 } |
50 | 50 |
51 // public RiType RiMethod_holder(HotSpotProxy method); | 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 = C1XObjects::get<methodOop>(vmId)->method_holder(); | 54 klassOop klass = C1XObjects::get<methodOop>(vmId)->method_holder(); |
55 jlong klassVmId = C1XObjects::add<klassOop>(klass); | 55 jlong klassVmId = C1XObjects::add<klassOop>(klass); |
56 Handle name = C1XObjects::toString<Handle>(klass->klass_part()->name(), CHECK_NULL); | 56 Handle name = C1XObjects::toString<Handle>(klass->klass_part()->name(), CHECK_NULL); |
57 oop holder = VMExits::createRiType(klassVmId, name, THREAD); | 57 oop holder = VMExits::createRiType(klassVmId, name, THREAD); |
58 return JNIHandles::make_local(THREAD, holder); | 58 return JNIHandles::make_local(THREAD, holder); |
59 } | 59 } |
60 | 60 |
61 // public String RiMethod_signature(HotSpotProxy method); | 61 // public String RiMethod_signature(long vmId); |
62 JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1signature(JNIEnv *env, jobject, jlong vmId) { | 62 JNIEXPORT jstring JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiMethod_1signature(JNIEnv *env, jobject, jlong vmId) { |
63 VM_ENTRY_MARK | 63 VM_ENTRY_MARK |
64 methodOop method = C1XObjects::get<methodOop>(vmId); | 64 methodOop method = C1XObjects::get<methodOop>(vmId); |
65 return C1XObjects::toString<jstring>(method->signature(), THREAD); | 65 return C1XObjects::toString<jstring>(method->signature(), THREAD); |
66 } | 66 } |
67 | 67 |
68 // public int RiMethod_accessFlags(HotSpotProxy method); | 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 C1XObjects::get<methodOop>(vmId)->access_flags().as_int(); | 70 return C1XObjects::get<methodOop>(vmId)->access_flags().as_int(); |
71 } | 71 } |
72 | 72 |
73 // public RiType RiSignature_lookupType(String returnType, HotSpotProxy accessingClass); | 73 // 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) { | 74 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiSignature_1lookupType(JNIEnv *, jobject, jstring jname, jlong accessingClassVmId) { |
75 VM_ENTRY_MARK; | 75 VM_ENTRY_MARK; |
76 | 76 |
77 symbolOop nameSymbol = C1XObjects::toSymbol(jname); | 77 symbolOop nameSymbol = C1XObjects::toSymbol(jname); |
78 Handle name = JNIHandles::resolve(jname); | 78 Handle name = JNIHandles::resolve(jname); |
110 } | 110 } |
111 | 111 |
112 return JNIHandles::make_local(THREAD, result); | 112 return JNIHandles::make_local(THREAD, result); |
113 } | 113 } |
114 | 114 |
115 // public Object RiConstantPool_lookupConstant(HotSpotProxy constantPool, int cpi); | 115 // public Object RiConstantPool_lookupConstant(long vmId, int cpi); |
116 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupConstant(JNIEnv *env, jobject, jlong vmId, jint index) { | 116 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupConstant(JNIEnv *env, jobject, jlong vmId, jint index) { |
117 VM_ENTRY_MARK; | 117 VM_ENTRY_MARK; |
118 | 118 |
119 constantPoolOop cp = C1XObjects::get<constantPoolOop>(vmId); | 119 constantPoolOop cp = C1XObjects::get<constantPoolOop>(vmId); |
120 | 120 |
166 } | 166 } |
167 | 167 |
168 return JNIHandles::make_local(THREAD, result); | 168 return JNIHandles::make_local(THREAD, result); |
169 } | 169 } |
170 | 170 |
171 // public RiMethod RiConstantPool_lookupMethod(HotSpotProxy constantPool, int cpi, byte byteCode | 171 // 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) { | 172 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupMethod(JNIEnv *env, jobject, jlong vmId, jint index, jbyte byteCode) { |
173 VM_ENTRY_MARK; | 173 VM_ENTRY_MARK; |
174 | 174 |
175 constantPoolOop cp = C1XObjects::get<constantPoolOop>(vmId); | 175 constantPoolOop cp = C1XObjects::get<constantPoolOop>(vmId); |
176 | 176 |
180 methodOop method = (methodOop)cimethod->get_oop(); | 180 methodOop method = (methodOop)cimethod->get_oop(); |
181 Handle name = C1XObjects::toString<Handle>(method->name(), CHECK_NULL); | 181 Handle name = C1XObjects::toString<Handle>(method->name(), CHECK_NULL); |
182 return JNIHandles::make_local(THREAD, VMExits::createRiMethod(C1XObjects::add<methodOop>(method), name, THREAD)); | 182 return JNIHandles::make_local(THREAD, VMExits::createRiMethod(C1XObjects::add<methodOop>(method), name, THREAD)); |
183 } | 183 } |
184 | 184 |
185 // public RiSignature RiConstantPool_lookupSignature(HotSpotProxy constantPool, int cpi); | 185 // 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) { | 186 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupSignature(JNIEnv *env, jobject, jlong vmId, jint index) { |
187 fatal("currently unsupported"); | 187 fatal("currently unsupported"); |
188 return NULL; | 188 return NULL; |
189 } | 189 } |
190 | 190 |
191 // public RiType RiConstantPool_lookupType(HotSpotProxy constantPool, int cpi); | 191 // public RiType RiConstantPool_lookupType(long vmId, int cpi); |
192 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupType(JNIEnv *env, jobject, jlong vmId, jint index) { | 192 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupType(JNIEnv *env, jobject, jlong vmId, jint index) { |
193 VM_ENTRY_MARK; | 193 VM_ENTRY_MARK; |
194 | 194 |
195 constantPoolOop cp = C1XObjects::get<constantPoolOop>(vmId); | 195 constantPoolOop cp = C1XObjects::get<constantPoolOop>(vmId); |
196 | 196 |
199 ciKlass *klass = CURRENT_ENV->get_klass_by_index(cp, index, is_accessible, loading_klass); | 199 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)); | 200 return JNIHandles::make_local(THREAD, C1XCompiler::get_RiType(klass, cp->klass(), THREAD)); |
201 | 201 |
202 } | 202 } |
203 | 203 |
204 // public RiField RiConstantPool_lookupField(HotSpotProxy constantPool, int cpi); | 204 // 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) { | 205 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupField(JNIEnv *env, jobject, jlong vmId, jint index) { |
206 VM_ENTRY_MARK; | 206 VM_ENTRY_MARK; |
207 | 207 |
208 constantPoolOop cp = C1XObjects::get<constantPoolOop>(vmId); | 208 constantPoolOop cp = C1XObjects::get<constantPoolOop>(vmId); |
209 | 209 |
210 ciInstanceKlass* loading_klass = (ciInstanceKlass *)CURRENT_ENV->get_object(cp->pool_holder()); | 210 ciInstanceKlass* loading_klass = (ciInstanceKlass *)CURRENT_ENV->get_object(cp->pool_holder()); |
211 ciField *field = CURRENT_ENV->get_field_by_index(loading_klass, index); | 211 ciField *field = CURRENT_ENV->get_field_by_index(loading_klass, index); |
212 return JNIHandles::make_local(THREAD, C1XCompiler::get_RiField(field, THREAD)); | 212 return JNIHandles::make_local(THREAD, C1XCompiler::get_RiField(field, THREAD)); |
213 } | 213 } |
214 | 214 |
215 // public RiConstantPool RiType_constantPool(HotSpotProxy type); | 215 // public RiConstantPool RiType_constantPool(long vmId); |
216 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1constantPool(JNIEnv *, jobject, jlong vmId) { | 216 JNIEXPORT jobject JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1constantPool(JNIEnv *, jobject, jlong vmId) { |
217 VM_ENTRY_MARK; | 217 VM_ENTRY_MARK; |
218 | 218 |
219 constantPoolOop constantPool = instanceKlass::cast(C1XObjects::get<klassOop>(vmId))->constants(); | 219 constantPoolOop constantPool = instanceKlass::cast(C1XObjects::get<klassOop>(vmId))->constants(); |
220 return JNIHandles::make_local(VMExits::createRiConstantPool(C1XObjects::add<constantPoolOop>(constantPool), THREAD)); | 220 return JNIHandles::make_local(VMExits::createRiConstantPool(C1XObjects::add<constantPoolOop>(constantPool), THREAD)); |
221 } | 221 } |
222 | 222 |
223 // public boolean RiType_isArrayClass(HotSpotProxy klass); | 223 // public boolean RiType_isArrayClass(long vmId); |
224 JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isArrayClass(JNIEnv *, jobject, jlong vmId) { | 224 JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isArrayClass(JNIEnv *, jobject, jlong vmId) { |
225 return C1XObjects::get<klassOop>(vmId)->klass_part()->oop_is_javaArray(); | 225 return C1XObjects::get<klassOop>(vmId)->klass_part()->oop_is_javaArray(); |
226 } | 226 } |
227 | 227 |
228 // public boolean RiType_isInstanceClass(HotSpotProxy klass); | 228 // public boolean RiType_isInstanceClass(long vmId); |
229 JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInstanceClass(JNIEnv *, jobject, jlong vmId) { | 229 JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInstanceClass(JNIEnv *, jobject, jlong vmId) { |
230 return C1XObjects::get<klassOop>(vmId)->klass_part()->oop_is_instance(); | 230 return C1XObjects::get<klassOop>(vmId)->klass_part()->oop_is_instance(); |
231 } | 231 } |
232 | 232 |
233 // public boolean RiType_isInterface(HotSpotProxy klass); | 233 // public boolean RiType_isInterface(long vmId); |
234 JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInterface(JNIEnv *, jobject, jlong vmId) { | 234 JNIEXPORT jboolean JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInterface(JNIEnv *, jobject, jlong vmId) { |
235 return C1XObjects::get<klassOop>(vmId)->klass_part()->is_interface(); | 235 return C1XObjects::get<klassOop>(vmId)->klass_part()->is_interface(); |
236 } | |
237 | |
238 // public long RiType_instanceSize(long vmId); | |
239 JNIEXPORT jlong JNICALL Java_com_sun_hotspot_c1x_VMEntries_RiType_1instanceSize(JNIEnv *, jobject, jlong vmId) { | |
240 return align_object_size(instanceKlass::cast(C1XObjects::get<klassOop>(vmId))->size_helper() * HeapWordSize); | |
236 } | 241 } |
237 | 242 |
238 | 243 |
239 // helpers used to set fields in the HotSpotVMConfig object | 244 // helpers used to set fields in the HotSpotVMConfig object |
240 jfieldID getFieldID(JNIEnv* env, jobject obj, const char* name, const char* sig) { | 245 jfieldID getFieldID(JNIEnv* env, jobject obj, const char* name, const char* sig) { |
276 set_int(env, config, "codeEntryAlignment", CodeEntryAlignment); | 281 set_int(env, config, "codeEntryAlignment", CodeEntryAlignment); |
277 set_int(env, config, "vmPageSize", os::vm_page_size()); | 282 set_int(env, config, "vmPageSize", os::vm_page_size()); |
278 set_int(env, config, "stackShadowPages", StackShadowPages); | 283 set_int(env, config, "stackShadowPages", StackShadowPages); |
279 set_int(env, config, "hubOffset", oopDesc::klass_offset_in_bytes()); | 284 set_int(env, config, "hubOffset", oopDesc::klass_offset_in_bytes()); |
280 set_int(env, config, "arrayLengthOffset", arrayOopDesc::length_offset_in_bytes()); | 285 set_int(env, config, "arrayLengthOffset", arrayOopDesc::length_offset_in_bytes()); |
286 set_int(env, config, "threadTlabTopOffset", in_bytes(JavaThread::tlab_top_offset())); | |
287 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()); | |
281 | 289 |
282 set_long(env, config, "instanceofStub", C1XObjects::addStub(Runtime1::entry_for(Runtime1::slow_subtype_check_id))); | 290 set_long(env, config, "instanceofStub", C1XObjects::addStub(Runtime1::entry_for(Runtime1::slow_subtype_check_id))); |
283 set_long(env, config, "debugStub", C1XObjects::addStub((address)warning)); | 291 set_long(env, config, "debugStub", C1XObjects::addStub((address)warning)); |
284 set_long(env, config, "resolveStaticCallStub", C1XObjects::addStub(SharedRuntime::get_resolve_static_call_stub())); | 292 set_long(env, config, "resolveStaticCallStub", C1XObjects::addStub(SharedRuntime::get_resolve_static_call_stub())); |
293 set_long(env, config, "newInstanceStub", C1XObjects::addStub(Runtime1::entry_for(Runtime1::fast_new_instance_id))); | |
294 | |
285 jintArray arrayOffsets = env->NewIntArray(basicTypeCount); | 295 jintArray arrayOffsets = env->NewIntArray(basicTypeCount); |
286 for (int i=0; i<basicTypeCount; i++) { | 296 for (int i=0; i<basicTypeCount; i++) { |
287 jint offset = arrayOopDesc::base_offset_in_bytes(basicTypes[i]); | 297 jint offset = arrayOopDesc::base_offset_in_bytes(basicTypes[i]); |
288 env->SetIntArrayRegion(arrayOffsets, i, 1, &offset); | 298 env->SetIntArrayRegion(arrayOffsets, i, 1, &offset); |
289 } | 299 } |
508 arrayOop stack_map = (arrayOop)CiTargetMethod_Call::stackMap(site); | 518 arrayOop stack_map = (arrayOop)CiTargetMethod_Call::stackMap(site); |
509 arrayOop register_map = (arrayOop)CiTargetMethod_Call::registerMap(site); | 519 arrayOop register_map = (arrayOop)CiTargetMethod_Call::registerMap(site); |
510 | 520 |
511 assert((runtime_call ? 1 : 0) + (hotspot_method ? 1 : 0) + (symbol ? 1 : 0) + (global_stub ? 1 : 0) == 1, "Call site needs exactly one type"); | 521 assert((runtime_call ? 1 : 0) + (hotspot_method ? 1 : 0) + (symbol ? 1 : 0) + (global_stub ? 1 : 0) == 1, "Call site needs exactly one type"); |
512 | 522 |
523 address instruction = _instructions->start() + pc_offset; | |
524 address operand = Assembler::locate_operand(instruction, Assembler::call32_operand); | |
525 address next_instruction = Assembler::locate_next_instruction(instruction); | |
526 | |
513 if (runtime_call != NULL) { | 527 if (runtime_call != NULL) { |
528 if (runtime_call == CiRuntimeCall::Debug()) { | |
529 tty->print_cr("CiRuntimeCall::Debug()"); | |
530 } else { | |
531 runtime_call->print(); | |
532 } | |
514 tty->print_cr("runtime_call"); | 533 tty->print_cr("runtime_call"); |
515 } else if (global_stub != NULL) { | 534 } else if (global_stub != NULL) { |
516 tty->print_cr("global_stub_id"); | 535 assert(java_lang_boxing_object::is_instance(global_stub, T_LONG), "global_stub needs to be of type Long"); |
536 | |
537 jlong stub_id = global_stub->long_field(java_lang_boxing_object::value_offset_in_bytes(T_LONG)); | |
538 address dest = C1XObjects::getStub(stub_id); | |
539 long disp = dest - next_instruction; | |
540 assert(disp == (jint) disp, "disp doesn't fit in 32 bits"); | |
541 *((jint*)operand) = (jint)disp; | |
542 | |
543 _instructions->relocate(instruction, runtime_call_Relocation::spec(), Assembler::call32_operand); | |
544 tty->print_cr("relocating (stub) %016x/%016x", instruction, operand); | |
517 } else if (symbol != NULL) { | 545 } else if (symbol != NULL) { |
518 tty->print_cr("symbol"); | 546 tty->print_cr("symbol"); |
519 } else { // method != NULL | 547 } else { // method != NULL |
520 assert(hotspot_method->is_a(SystemDictionary::HotSpotMethod_klass()), "unexpected RiMethod subclass"); | 548 assert(hotspot_method->is_a(SystemDictionary::HotSpotMethod_klass()), "unexpected RiMethod subclass"); |
521 methodOop method = C1XObjects::get<methodOop>(HotSpotMethod::vmId(hotspot_method)); | 549 methodOop method = C1XObjects::get<methodOop>(HotSpotMethod::vmId(hotspot_method)); |
522 | 550 |
523 address instruction = _instructions->start() + pc_offset; | |
524 address operand = Assembler::locate_operand(instruction, Assembler::call32_operand); | |
525 address next_instruction = Assembler::locate_next_instruction(instruction); | |
526 jint next_pc_offset = next_instruction - _instructions->start(); | 551 jint next_pc_offset = next_instruction - _instructions->start(); |
527 | 552 |
528 assert(debug_info != NULL, "debug info expected"); | 553 assert(debug_info != NULL, "debug info expected"); |
529 _debug_recorder->add_safepoint(next_pc_offset, create_oop_map(_frame_size, _parameter_count, debug_info)); | 554 _debug_recorder->add_safepoint(next_pc_offset, create_oop_map(_frame_size, _parameter_count, debug_info)); |
530 oop code_pos = CiDebugInfo::codePos(debug_info); | 555 oop code_pos = CiDebugInfo::codePos(debug_info); |
532 record_frame(next_pc_offset, code_pos, frame); | 557 record_frame(next_pc_offset, code_pos, frame); |
533 | 558 |
534 if (method->is_static()) { | 559 if (method->is_static()) { |
535 tty->print_cr("static method"); | 560 tty->print_cr("static method"); |
536 | 561 |
537 | |
538 address dest = SharedRuntime::get_resolve_static_call_stub(); | 562 address dest = SharedRuntime::get_resolve_static_call_stub(); |
539 long disp = dest - next_instruction; | 563 long disp = dest - next_instruction; |
540 assert(disp == (jint) disp, "disp doesn't fit in 32 bits"); | 564 assert(disp == (jint) disp, "disp doesn't fit in 32 bits"); |
541 *((jint*)operand) = (jint)disp; | 565 *((jint*)operand) = (jint)disp; |
542 | 566 |
543 _instructions->relocate(instruction, relocInfo::static_call_type, Assembler::call32_operand); | 567 _instructions->relocate(instruction, relocInfo::static_call_type, Assembler::call32_operand); |
544 tty->print_cr("relocating (Long) %016x/%016x", instruction, operand); | 568 tty->print_cr("relocating (Long) %016x/%016x", instruction, operand); |
545 } else { | 569 } else { |
546 tty->print_cr("non-static method"); | 570 tty->print_cr("non-static method"); |
547 ShouldNotReachHere(); | 571 |
572 address dest = SharedRuntime::get_resolve_opt_virtual_call_stub(); | |
573 long disp = dest - next_instruction; | |
574 assert(disp == (jint) disp, "disp doesn't fit in 32 bits"); | |
575 *((jint*)operand) = (jint)disp; | |
576 | |
577 _instructions->relocate(instruction, relocInfo::opt_virtual_call_type, Assembler::call32_operand); | |
578 tty->print_cr("relocating (Long) %016x/%016x", instruction, operand); | |
548 } | 579 } |
549 | 580 |
550 _debug_recorder->end_safepoint(pc_offset); | 581 _debug_recorder->end_safepoint(pc_offset); |
551 } | 582 } |
552 } | 583 } |
554 void site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site) { | 585 void site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site) { |
555 oop constant = CiTargetMethod_DataPatch::constant(site); | 586 oop constant = CiTargetMethod_DataPatch::constant(site); |
556 oop kind = CiConstant::kind(constant); | 587 oop kind = CiConstant::kind(constant); |
557 | 588 |
558 address instruction = _instructions->start() + pc_offset; | 589 address instruction = _instructions->start() + pc_offset; |
559 address operand = Assembler::locate_operand(instruction, Assembler::disp32_operand); | |
560 address next_instruction = Assembler::locate_next_instruction(instruction); | |
561 | 590 |
562 switch(CiKind::typeChar(kind)) { | 591 switch(CiKind::typeChar(kind)) { |
563 case 'z': | 592 case 'z': |
564 case 'b': | 593 case 'b': |
565 case 's': | 594 case 's': |
568 fatal("int-sized values not expected in DataPatch"); | 597 fatal("int-sized values not expected in DataPatch"); |
569 break; | 598 break; |
570 case 'f': | 599 case 'f': |
571 case 'l': | 600 case 'l': |
572 case 'd': { | 601 case 'd': { |
602 address operand = Assembler::locate_operand(instruction, Assembler::disp32_operand); | |
603 address next_instruction = Assembler::locate_next_instruction(instruction); | |
573 // we don't care if this is a long/double/etc., the primitive field contains the right bits | 604 // we don't care if this is a long/double/etc., the primitive field contains the right bits |
574 address dest = _constants->end(); | 605 address dest = _constants->end(); |
575 *(jlong*)dest = CiConstant::primitive(constant); | 606 *(jlong*)dest = CiConstant::primitive(constant); |
576 _constants->set_end(dest + BytesPerLong); | 607 _constants->set_end(dest + BytesPerLong); |
577 | 608 |
581 | 612 |
582 _instructions->relocate(instruction, section_word_Relocation::spec((address)dest, CodeBuffer::SECT_CONSTS), Assembler::disp32_operand); | 613 _instructions->relocate(instruction, section_word_Relocation::spec((address)dest, CodeBuffer::SECT_CONSTS), Assembler::disp32_operand); |
583 tty->print_cr("relocating (Float/Long/Double) at %016x/%016x", instruction, operand); | 614 tty->print_cr("relocating (Float/Long/Double) at %016x/%016x", instruction, operand); |
584 break; | 615 break; |
585 } | 616 } |
586 case 'a': | 617 case 'a': { |
587 CiConstant::object(constant)->print(); | 618 address operand = Assembler::locate_operand(instruction, Assembler::imm_operand); |
588 tty->print_cr("DataPatch of object type"); | 619 oop obj = CiConstant::object(constant); |
620 | |
621 if (obj->is_a(HotSpotTypeResolved::klass())) { | |
622 *((jobject*)operand) = JNIHandles::make_local(C1XObjects::get<klassOop>(HotSpotTypeResolved::vmId(obj))); | |
623 _instructions->relocate(instruction, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); | |
624 tty->print_cr("relocating (HotSpotType) at %016x/%016x", instruction, operand); | |
625 } else { | |
626 assert(java_lang_boxing_object::is_instance(obj, T_LONG), "unexpected DataPatch object type"); | |
627 jlong id = obj->long_field(java_lang_boxing_object::value_offset_in_bytes(T_LONG)); | |
628 | |
629 assert((id & C1XObjects::TYPE_MASK) == C1XObjects::CONSTANT, "unexpected DataPatch type"); | |
630 | |
631 address operand = Assembler::locate_operand(instruction, Assembler::imm_operand); | |
632 | |
633 *((jobject*)operand) = JNIHandles::make_local(C1XObjects::get<oop>(id)); | |
634 _instructions->relocate(instruction, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); | |
635 tty->print_cr("relocating (oop constant) at %016x/%016x", instruction, operand); | |
636 } | |
637 | |
638 /* | |
639 jlong id = com_sun_hotspot_c1x_HotSpotProxy::get_id(obj); | |
640 switch (id & C1XObjects::TYPE_MASK) { | |
641 case C1XObjects::CONSTANT: { | |
642 address operand = Assembler::locate_operand(inst, Assembler::imm_operand); | |
643 | |
644 *((jobject*)operand) = JNIHandles::make_local(C1XObjects::get<oop>(id)); | |
645 instructions->relocate(inst, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); | |
646 tty->print_cr("relocating (HotSpotType) %02x at %016x/%016x", inst_byte, inst, operand); | |
647 break; | |
648 } | |
649 case C1XObjects::STUB: { | |
650 address operand = Assembler::locate_operand(inst, Assembler::call32_operand); | |
651 | |
652 long dest = (long)C1XObjects::getStub(id); | |
653 long disp = dest - (long)(operand + 4); | |
654 assert(disp == (int) disp, "disp doesn't fit in 32 bits"); | |
655 *((int*)operand) = (int)disp; | |
656 | |
657 instructions->relocate(inst, runtime_call_Relocation::spec(), Assembler::call32_operand); | |
658 tty->print_cr("relocating (Long) %02x at %016x/%016x", inst_byte, inst, operand); | |
659 break; | |
660 } | |
661 }*/ | |
589 break; | 662 break; |
663 } | |
590 default: | 664 default: |
591 fatal("unexpected CiKind in DataPatch"); | 665 fatal("unexpected CiKind in DataPatch"); |
592 break; | 666 break; |
593 } | 667 } |
594 } | 668 } |
788 {CC"RiConstantPool_lookupField", CC"("PROXY"I)"FIELD, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupField)}, | 862 {CC"RiConstantPool_lookupField", CC"("PROXY"I)"FIELD, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiConstantPool_1lookupField)}, |
789 {CC"RiType_constantPool", CC"("PROXY")"CONSTANT_POOL, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1constantPool)}, | 863 {CC"RiType_constantPool", CC"("PROXY")"CONSTANT_POOL, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1constantPool)}, |
790 {CC"RiType_isArrayClass", CC"("PROXY")Z", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1isArrayClass)}, | 864 {CC"RiType_isArrayClass", CC"("PROXY")Z", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1isArrayClass)}, |
791 {CC"RiType_isInstanceClass", CC"("PROXY")Z", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInstanceClass)}, | 865 {CC"RiType_isInstanceClass", CC"("PROXY")Z", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInstanceClass)}, |
792 {CC"RiType_isInterface", CC"("PROXY")Z", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInterface)}, | 866 {CC"RiType_isInterface", CC"("PROXY")Z", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1isInterface)}, |
867 {CC"RiType_instanceSize", CC"("PROXY")J", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_RiType_1instanceSize)}, | |
793 {CC"getConfiguration", CC"()"CONFIG, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getConfiguration)}, | 868 {CC"getConfiguration", CC"()"CONFIG, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_getConfiguration)}, |
794 {CC"installMethod", CC"("TARGET_METHOD")V", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installMethod)}, | 869 {CC"installMethod", CC"("TARGET_METHOD")V", FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installMethod)}, |
795 {CC"installStub", CC"("TARGET_METHOD")"PROXY, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installStub)} | 870 {CC"installStub", CC"("TARGET_METHOD")"PROXY, FN_PTR(Java_com_sun_hotspot_c1x_VMEntries_installStub)} |
796 }; | 871 }; |
797 | 872 |