comparison src/cpu/x86/vm/x86_64.ad @ 10171:78603aa58b1e

Merge
author jiangli
date Fri, 26 Apr 2013 16:58:18 -0400
parents 35c15dad89ea e10e43e58e92
children 740e263c80c6
comparison
equal deleted inserted replaced
10146:57ac6a688ae6 10171:78603aa58b1e
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");
2076 (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4), 2034 (int) ($meth$$method - ((intptr_t) cbuf.insts_end()) - 4),
2077 static_call_Relocation::spec(), 2035 static_call_Relocation::spec(),
2078 RELOC_DISP32); 2036 RELOC_DISP32);
2079 } 2037 }
2080 if (_method) { 2038 if (_method) {
2081 // Emit stub for static call 2039 // Emit stub for static call.
2082 emit_java_to_interp(cbuf); 2040 CompiledStaticCall::emit_to_interp_stub(cbuf);
2083 } 2041 }
2084 %} 2042 %}
2085 2043
2086 enc_class Java_Dynamic_Call(method meth) %{ 2044 enc_class Java_Dynamic_Call(method meth) %{
2087 MacroAssembler _masm(&cbuf); 2045 MacroAssembler _masm(&cbuf);