comparison src/cpu/x86/vm/x86_64.ad @ 10168:a6e09d6dd8e5

8003853: specify offset of IC load in java_to_interp stub Summary: refactored code to allow platform-specific differences Reviewed-by: dlong, twisti Contributed-by: Goetz Lindenmaier <goetz.lindenmaier@sap.com>
author dlong
date Wed, 24 Apr 2013 20:55:28 -0400
parents e961c11b85fe
children e10e43e58e92
comparison
equal deleted inserted replaced
10106:42a42da29fd7 10168:a6e09d6dd8e5
1386 int offset = ra_->reg2offset(in_RegMask(0).find_first_elem()); 1386 int offset = ra_->reg2offset(in_RegMask(0).find_first_elem());
1387 return (offset < 0x80) ? 5 : 8; // REX 1387 return (offset < 0x80) ? 5 : 8; // REX
1388 } 1388 }
1389 1389
1390 //============================================================================= 1390 //=============================================================================
1391
1392 // emit call stub, compiled java to interpreter
1393 void emit_java_to_interp(CodeBuffer& cbuf)
1394 {
1395 // Stub is fixed up when the corresponding call is converted from
1396 // calling compiled code to calling interpreted code.
1397 // movq rbx, 0
1398 // jmp -5 # to self
1399
1400 address mark = cbuf.insts_mark(); // get mark within main instrs section
1401
1402 // Note that the code buffer's insts_mark is always relative to insts.
1403 // That's why we must use the macroassembler to generate a stub.
1404 MacroAssembler _masm(&cbuf);
1405
1406 address base =
1407 __ start_a_stub(Compile::MAX_stubs_size);
1408 if (base == NULL) return; // CodeBuffer::expand failed
1409 // static stub relocation stores the instruction address of the call
1410 __ relocate(static_stub_Relocation::spec(mark), RELOC_IMM64);
1411 // static stub relocation also tags the Method* in the code-stream.
1412 __ mov_metadata(rbx, (Metadata*) NULL); // method is zapped till fixup time
1413 // This is recognized as unresolved by relocs/nativeinst/ic code
1414 __ jump(RuntimeAddress(__ pc()));
1415
1416 // Update current stubs pointer and restore insts_end.
1417 __ end_a_stub();
1418 }
1419
1420 // size of call stub, compiled java to interpretor
1421 uint size_java_to_interp()
1422 {
1423 return 15; // movq (1+1+8); jmp (1+4)
1424 }
1425
1426 // relocation entries for call stub, compiled java to interpretor
1427 uint reloc_java_to_interp()
1428 {
1429 return 4; // 3 in emit_java_to_interp + 1 in Java_Static_Call
1430 }
1431
1432 //=============================================================================
1433 #ifndef PRODUCT 1391 #ifndef PRODUCT
1434 void MachUEPNode::format(PhaseRegAlloc* ra_, outputStream* st) const 1392 void MachUEPNode::format(PhaseRegAlloc* ra_, outputStream* st) const
1435 { 1393 {
1436 if (UseCompressedKlassPointers) { 1394 if (UseCompressedKlassPointers) {
1437 st->print_cr("movl rscratch1, [j_rarg0 + oopDesc::klass_offset_in_bytes()]\t# compressed klass"); 1395 st->print_cr("movl rscratch1, [j_rarg0 + oopDesc::klass_offset_in_bytes()]\t# compressed klass");
2087 (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4), 2045 (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4),
2088 static_call_Relocation::spec(), 2046 static_call_Relocation::spec(),
2089 RELOC_DISP32); 2047 RELOC_DISP32);
2090 } 2048 }
2091 if (_method) { 2049 if (_method) {
2092 // Emit stub for static call 2050 // Emit stub for static call.
2093 emit_java_to_interp(cbuf); 2051 CompiledStaticCall::emit_to_interp_stub(cbuf);
2094 } 2052 }
2095 %} 2053 %}
2096 2054
2097 enc_class Java_Dynamic_Call(method meth) %{ 2055 enc_class Java_Dynamic_Call(method meth) %{
2098 MacroAssembler _masm(&cbuf); 2056 MacroAssembler _masm(&cbuf);