Mercurial > hg > graal-compiler
comparison src/cpu/x86/vm/x86_32.ad @ 1748:3e8fbc61cee8
6978355: renaming for 6961697
Summary: This is the renaming part of 6961697 to keep the actual changes small for review.
Reviewed-by: kvn, never
author | twisti |
---|---|
date | Wed, 25 Aug 2010 05:27:54 -0700 |
parents | f55c4f82ab9d |
children | ae065c367d93 |
comparison
equal
deleted
inserted
replaced
1747:53dbe853fb3a | 1748:3e8fbc61cee8 |
---|---|
348 #endif | 348 #endif |
349 | 349 |
350 // EMIT_RM() | 350 // EMIT_RM() |
351 void emit_rm(CodeBuffer &cbuf, int f1, int f2, int f3) { | 351 void emit_rm(CodeBuffer &cbuf, int f1, int f2, int f3) { |
352 unsigned char c = (unsigned char)((f1 << 6) | (f2 << 3) | f3); | 352 unsigned char c = (unsigned char)((f1 << 6) | (f2 << 3) | f3); |
353 *(cbuf.code_end()) = c; | 353 cbuf.insts()->emit_int8(c); |
354 cbuf.set_code_end(cbuf.code_end() + 1); | |
355 } | 354 } |
356 | 355 |
357 // EMIT_CC() | 356 // EMIT_CC() |
358 void emit_cc(CodeBuffer &cbuf, int f1, int f2) { | 357 void emit_cc(CodeBuffer &cbuf, int f1, int f2) { |
359 unsigned char c = (unsigned char)( f1 | f2 ); | 358 unsigned char c = (unsigned char)( f1 | f2 ); |
360 *(cbuf.code_end()) = c; | 359 cbuf.insts()->emit_int8(c); |
361 cbuf.set_code_end(cbuf.code_end() + 1); | |
362 } | 360 } |
363 | 361 |
364 // EMIT_OPCODE() | 362 // EMIT_OPCODE() |
365 void emit_opcode(CodeBuffer &cbuf, int code) { | 363 void emit_opcode(CodeBuffer &cbuf, int code) { |
366 *(cbuf.code_end()) = (unsigned char)code; | 364 cbuf.insts()->emit_int8((unsigned char) code); |
367 cbuf.set_code_end(cbuf.code_end() + 1); | |
368 } | 365 } |
369 | 366 |
370 // EMIT_OPCODE() w/ relocation information | 367 // EMIT_OPCODE() w/ relocation information |
371 void emit_opcode(CodeBuffer &cbuf, int code, relocInfo::relocType reloc, int offset = 0) { | 368 void emit_opcode(CodeBuffer &cbuf, int code, relocInfo::relocType reloc, int offset = 0) { |
372 cbuf.relocate(cbuf.inst_mark() + offset, reloc); | 369 cbuf.relocate(cbuf.insts_mark() + offset, reloc); |
373 emit_opcode(cbuf, code); | 370 emit_opcode(cbuf, code); |
374 } | 371 } |
375 | 372 |
376 // EMIT_D8() | 373 // EMIT_D8() |
377 void emit_d8(CodeBuffer &cbuf, int d8) { | 374 void emit_d8(CodeBuffer &cbuf, int d8) { |
378 *(cbuf.code_end()) = (unsigned char)d8; | 375 cbuf.insts()->emit_int8((unsigned char) d8); |
379 cbuf.set_code_end(cbuf.code_end() + 1); | |
380 } | 376 } |
381 | 377 |
382 // EMIT_D16() | 378 // EMIT_D16() |
383 void emit_d16(CodeBuffer &cbuf, int d16) { | 379 void emit_d16(CodeBuffer &cbuf, int d16) { |
384 *((short *)(cbuf.code_end())) = d16; | 380 cbuf.insts()->emit_int16(d16); |
385 cbuf.set_code_end(cbuf.code_end() + 2); | |
386 } | 381 } |
387 | 382 |
388 // EMIT_D32() | 383 // EMIT_D32() |
389 void emit_d32(CodeBuffer &cbuf, int d32) { | 384 void emit_d32(CodeBuffer &cbuf, int d32) { |
390 *((int *)(cbuf.code_end())) = d32; | 385 cbuf.insts()->emit_int32(d32); |
391 cbuf.set_code_end(cbuf.code_end() + 4); | |
392 } | 386 } |
393 | 387 |
394 // emit 32 bit value and construct relocation entry from relocInfo::relocType | 388 // emit 32 bit value and construct relocation entry from relocInfo::relocType |
395 void emit_d32_reloc(CodeBuffer &cbuf, int d32, relocInfo::relocType reloc, | 389 void emit_d32_reloc(CodeBuffer &cbuf, int d32, relocInfo::relocType reloc, |
396 int format) { | 390 int format) { |
397 cbuf.relocate(cbuf.inst_mark(), reloc, format); | 391 cbuf.relocate(cbuf.insts_mark(), reloc, format); |
398 | 392 cbuf.insts()->emit_int32(d32); |
399 *((int *)(cbuf.code_end())) = d32; | |
400 cbuf.set_code_end(cbuf.code_end() + 4); | |
401 } | 393 } |
402 | 394 |
403 // emit 32 bit value and construct relocation entry from RelocationHolder | 395 // emit 32 bit value and construct relocation entry from RelocationHolder |
404 void emit_d32_reloc(CodeBuffer &cbuf, int d32, RelocationHolder const& rspec, | 396 void emit_d32_reloc(CodeBuffer &cbuf, int d32, RelocationHolder const& rspec, |
405 int format) { | 397 int format) { |
406 #ifdef ASSERT | 398 #ifdef ASSERT |
407 if (rspec.reloc()->type() == relocInfo::oop_type && d32 != 0 && d32 != (int)Universe::non_oop_word()) { | 399 if (rspec.reloc()->type() == relocInfo::oop_type && d32 != 0 && d32 != (int)Universe::non_oop_word()) { |
408 assert(oop(d32)->is_oop() && (ScavengeRootsInCode || !oop(d32)->is_scavengable()), "cannot embed scavengable oops in code"); | 400 assert(oop(d32)->is_oop() && (ScavengeRootsInCode || !oop(d32)->is_scavengable()), "cannot embed scavengable oops in code"); |
409 } | 401 } |
410 #endif | 402 #endif |
411 cbuf.relocate(cbuf.inst_mark(), rspec, format); | 403 cbuf.relocate(cbuf.insts_mark(), rspec, format); |
412 | 404 cbuf.insts()->emit_int32(d32); |
413 *((int *)(cbuf.code_end())) = d32; | |
414 cbuf.set_code_end(cbuf.code_end() + 4); | |
415 } | 405 } |
416 | 406 |
417 // Access stack slot for load or store | 407 // Access stack slot for load or store |
418 void store_to_stackslot(CodeBuffer &cbuf, int opcode, int rm_field, int disp) { | 408 void store_to_stackslot(CodeBuffer &cbuf, int opcode, int rm_field, int disp) { |
419 emit_opcode( cbuf, opcode ); // (e.g., FILD [ESP+src]) | 409 emit_opcode( cbuf, opcode ); // (e.g., FILD [ESP+src]) |
611 } else { | 601 } else { |
612 emit_opcode(cbuf, 0x81); // sub SP,#framesize | 602 emit_opcode(cbuf, 0x81); // sub SP,#framesize |
613 emit_rm(cbuf, 0x3, 0x05, ESP_enc); | 603 emit_rm(cbuf, 0x3, 0x05, ESP_enc); |
614 emit_d32(cbuf, framesize); | 604 emit_d32(cbuf, framesize); |
615 } | 605 } |
616 C->set_frame_complete(cbuf.code_end() - cbuf.code_begin()); | 606 C->set_frame_complete(cbuf.insts_size()); |
617 | 607 |
618 #ifdef ASSERT | 608 #ifdef ASSERT |
619 if (VerifyStackAtCalls) { | 609 if (VerifyStackAtCalls) { |
620 Label L; | 610 Label L; |
621 MacroAssembler masm(&cbuf); | 611 MacroAssembler masm(&cbuf); |
693 } | 683 } |
694 | 684 |
695 emit_opcode(cbuf, 0x58 | EBP_enc); | 685 emit_opcode(cbuf, 0x58 | EBP_enc); |
696 | 686 |
697 if( do_polling() && C->is_method_compilation() ) { | 687 if( do_polling() && C->is_method_compilation() ) { |
698 cbuf.relocate(cbuf.code_end(), relocInfo::poll_return_type, 0); | 688 cbuf.relocate(cbuf.insts_end(), relocInfo::poll_return_type, 0); |
699 emit_opcode(cbuf,0x85); | 689 emit_opcode(cbuf,0x85); |
700 emit_rm(cbuf, 0x0, EAX_enc, 0x5); // EAX | 690 emit_rm(cbuf, 0x0, EAX_enc, 0x5); // EAX |
701 emit_d32(cbuf, (intptr_t)os::get_polling_page()); | 691 emit_d32(cbuf, (intptr_t)os::get_polling_page()); |
702 } | 692 } |
703 } | 693 } |
1209 // Stub is fixed up when the corresponding call is converted from calling | 1199 // Stub is fixed up when the corresponding call is converted from calling |
1210 // compiled code to calling interpreted code. | 1200 // compiled code to calling interpreted code. |
1211 // mov rbx,0 | 1201 // mov rbx,0 |
1212 // jmp -1 | 1202 // jmp -1 |
1213 | 1203 |
1214 address mark = cbuf.inst_mark(); // get mark within main instrs section | 1204 address mark = cbuf.insts_mark(); // get mark within main instrs section |
1215 | 1205 |
1216 // Note that the code buffer's inst_mark is always relative to insts. | 1206 // Note that the code buffer's insts_mark is always relative to insts. |
1217 // That's why we must use the macroassembler to generate a stub. | 1207 // That's why we must use the macroassembler to generate a stub. |
1218 MacroAssembler _masm(&cbuf); | 1208 MacroAssembler _masm(&cbuf); |
1219 | 1209 |
1220 address base = | 1210 address base = |
1221 __ start_a_stub(Compile::MAX_stubs_size); | 1211 __ start_a_stub(Compile::MAX_stubs_size); |
1226 __ movoop(rbx, (jobject)NULL); // method is zapped till fixup time | 1216 __ movoop(rbx, (jobject)NULL); // method is zapped till fixup time |
1227 // This is recognized as unresolved by relocs/nativeInst/ic code | 1217 // This is recognized as unresolved by relocs/nativeInst/ic code |
1228 __ jump(RuntimeAddress(__ pc())); | 1218 __ jump(RuntimeAddress(__ pc())); |
1229 | 1219 |
1230 __ end_a_stub(); | 1220 __ end_a_stub(); |
1231 // Update current stubs pointer and restore code_end. | 1221 // Update current stubs pointer and restore insts_end. |
1232 } | 1222 } |
1233 // size of call stub, compiled java to interpretor | 1223 // size of call stub, compiled java to interpretor |
1234 uint size_java_to_interp() { | 1224 uint size_java_to_interp() { |
1235 return 10; // movl; jmp | 1225 return 10; // movl; jmp |
1236 } | 1226 } |
1252 #endif | 1242 #endif |
1253 | 1243 |
1254 void MachUEPNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { | 1244 void MachUEPNode::emit(CodeBuffer &cbuf, PhaseRegAlloc *ra_) const { |
1255 MacroAssembler masm(&cbuf); | 1245 MacroAssembler masm(&cbuf); |
1256 #ifdef ASSERT | 1246 #ifdef ASSERT |
1257 uint code_size = cbuf.code_size(); | 1247 uint insts_size = cbuf.insts_size(); |
1258 #endif | 1248 #endif |
1259 masm.cmpptr(rax, Address(rcx, oopDesc::klass_offset_in_bytes())); | 1249 masm.cmpptr(rax, Address(rcx, oopDesc::klass_offset_in_bytes())); |
1260 masm.jump_cc(Assembler::notEqual, | 1250 masm.jump_cc(Assembler::notEqual, |
1261 RuntimeAddress(SharedRuntime::get_ic_miss_stub())); | 1251 RuntimeAddress(SharedRuntime::get_ic_miss_stub())); |
1262 /* WARNING these NOPs are critical so that verified entry point is properly | 1252 /* WARNING these NOPs are critical so that verified entry point is properly |
1264 int nops_cnt = 2; | 1254 int nops_cnt = 2; |
1265 if( !OptoBreakpoint ) // Leave space for int3 | 1255 if( !OptoBreakpoint ) // Leave space for int3 |
1266 nops_cnt += 1; | 1256 nops_cnt += 1; |
1267 masm.nop(nops_cnt); | 1257 masm.nop(nops_cnt); |
1268 | 1258 |
1269 assert(cbuf.code_size() - code_size == size(ra_), "checking code size of inline cache node"); | 1259 assert(cbuf.insts_size() - insts_size == size(ra_), "checking code size of inline cache node"); |
1270 } | 1260 } |
1271 | 1261 |
1272 uint MachUEPNode::size(PhaseRegAlloc *ra_) const { | 1262 uint MachUEPNode::size(PhaseRegAlloc *ra_) const { |
1273 return OptoBreakpoint ? 11 : 12; | 1263 return OptoBreakpoint ? 11 : 12; |
1274 } | 1264 } |
1286 | 1276 |
1287 // Emit exception handler code. Stuff framesize into a register | 1277 // Emit exception handler code. Stuff framesize into a register |
1288 // and call a VM stub routine. | 1278 // and call a VM stub routine. |
1289 int emit_exception_handler(CodeBuffer& cbuf) { | 1279 int emit_exception_handler(CodeBuffer& cbuf) { |
1290 | 1280 |
1291 // Note that the code buffer's inst_mark is always relative to insts. | 1281 // Note that the code buffer's insts_mark is always relative to insts. |
1292 // That's why we must use the macroassembler to generate a handler. | 1282 // That's why we must use the macroassembler to generate a handler. |
1293 MacroAssembler _masm(&cbuf); | 1283 MacroAssembler _masm(&cbuf); |
1294 address base = | 1284 address base = |
1295 __ start_a_stub(size_exception_handler()); | 1285 __ start_a_stub(size_exception_handler()); |
1296 if (base == NULL) return 0; // CodeBuffer::expand failed | 1286 if (base == NULL) return 0; // CodeBuffer::expand failed |
1297 int offset = __ offset(); | 1287 int offset = __ offset(); |
1298 __ jump(RuntimeAddress(OptoRuntime::exception_blob()->instructions_begin())); | 1288 __ jump(RuntimeAddress(OptoRuntime::exception_blob()->entry_point())); |
1299 assert(__ offset() - offset <= (int) size_exception_handler(), "overflow"); | 1289 assert(__ offset() - offset <= (int) size_exception_handler(), "overflow"); |
1300 __ end_a_stub(); | 1290 __ end_a_stub(); |
1301 return offset; | 1291 return offset; |
1302 } | 1292 } |
1303 | 1293 |
1311 } | 1301 } |
1312 | 1302 |
1313 // Emit deopt handler code. | 1303 // Emit deopt handler code. |
1314 int emit_deopt_handler(CodeBuffer& cbuf) { | 1304 int emit_deopt_handler(CodeBuffer& cbuf) { |
1315 | 1305 |
1316 // Note that the code buffer's inst_mark is always relative to insts. | 1306 // Note that the code buffer's insts_mark is always relative to insts. |
1317 // That's why we must use the macroassembler to generate a handler. | 1307 // That's why we must use the macroassembler to generate a handler. |
1318 MacroAssembler _masm(&cbuf); | 1308 MacroAssembler _masm(&cbuf); |
1319 address base = | 1309 address base = |
1320 __ start_a_stub(size_exception_handler()); | 1310 __ start_a_stub(size_exception_handler()); |
1321 if (base == NULL) return 0; // CodeBuffer::expand failed | 1311 if (base == NULL) return 0; // CodeBuffer::expand failed |
1726 else emit_d32(cbuf,con); | 1716 else emit_d32(cbuf,con); |
1727 %} | 1717 %} |
1728 | 1718 |
1729 enc_class Lbl (label labl) %{ // JMP, CALL | 1719 enc_class Lbl (label labl) %{ // JMP, CALL |
1730 Label *l = $labl$$label; | 1720 Label *l = $labl$$label; |
1731 emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.code_size()+4)) : 0); | 1721 emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size()+4)) : 0); |
1732 %} | 1722 %} |
1733 | 1723 |
1734 enc_class LblShort (label labl) %{ // JMP, CALL | 1724 enc_class LblShort (label labl) %{ // JMP, CALL |
1735 Label *l = $labl$$label; | 1725 Label *l = $labl$$label; |
1736 int disp = l ? (l->loc_pos() - (cbuf.code_size()+1)) : 0; | 1726 int disp = l ? (l->loc_pos() - (cbuf.insts_size()+1)) : 0; |
1737 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); | 1727 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); |
1738 emit_d8(cbuf, disp); | 1728 emit_d8(cbuf, disp); |
1739 %} | 1729 %} |
1740 | 1730 |
1741 enc_class OpcSReg (eRegI dst) %{ // BSWAP | 1731 enc_class OpcSReg (eRegI dst) %{ // BSWAP |
1762 | 1752 |
1763 enc_class Jcc (cmpOp cop, label labl) %{ // JCC | 1753 enc_class Jcc (cmpOp cop, label labl) %{ // JCC |
1764 Label *l = $labl$$label; | 1754 Label *l = $labl$$label; |
1765 $$$emit8$primary; | 1755 $$$emit8$primary; |
1766 emit_cc(cbuf, $secondary, $cop$$cmpcode); | 1756 emit_cc(cbuf, $secondary, $cop$$cmpcode); |
1767 emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.code_size()+4)) : 0); | 1757 emit_d32(cbuf, l ? (l->loc_pos() - (cbuf.insts_size()+4)) : 0); |
1768 %} | 1758 %} |
1769 | 1759 |
1770 enc_class JccShort (cmpOp cop, label labl) %{ // JCC | 1760 enc_class JccShort (cmpOp cop, label labl) %{ // JCC |
1771 Label *l = $labl$$label; | 1761 Label *l = $labl$$label; |
1772 emit_cc(cbuf, $primary, $cop$$cmpcode); | 1762 emit_cc(cbuf, $primary, $cop$$cmpcode); |
1773 int disp = l ? (l->loc_pos() - (cbuf.code_size()+1)) : 0; | 1763 int disp = l ? (l->loc_pos() - (cbuf.insts_size()+1)) : 0; |
1774 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); | 1764 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); |
1775 emit_d8(cbuf, disp); | 1765 emit_d8(cbuf, disp); |
1776 %} | 1766 %} |
1777 | 1767 |
1778 enc_class enc_cmov(cmpOp cop ) %{ // CMOV | 1768 enc_class enc_cmov(cmpOp cop ) %{ // CMOV |
1836 } | 1826 } |
1837 %} | 1827 %} |
1838 | 1828 |
1839 enc_class Java_To_Runtime (method meth) %{ // CALL Java_To_Runtime, Java_To_Runtime_Leaf | 1829 enc_class Java_To_Runtime (method meth) %{ // CALL Java_To_Runtime, Java_To_Runtime_Leaf |
1840 // This is the instruction starting address for relocation info. | 1830 // This is the instruction starting address for relocation info. |
1841 cbuf.set_inst_mark(); | 1831 cbuf.set_insts_mark(); |
1842 $$$emit8$primary; | 1832 $$$emit8$primary; |
1843 // CALL directly to the runtime | 1833 // CALL directly to the runtime |
1844 emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4), | 1834 emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4), |
1845 runtime_call_Relocation::spec(), RELOC_IMM32 ); | 1835 runtime_call_Relocation::spec(), RELOC_IMM32 ); |
1846 | 1836 |
1847 if (UseSSE >= 2) { | 1837 if (UseSSE >= 2) { |
1848 MacroAssembler _masm(&cbuf); | 1838 MacroAssembler _masm(&cbuf); |
1849 BasicType rt = tf()->return_type(); | 1839 BasicType rt = tf()->return_type(); |
1869 %} | 1859 %} |
1870 | 1860 |
1871 | 1861 |
1872 enc_class pre_call_FPU %{ | 1862 enc_class pre_call_FPU %{ |
1873 // If method sets FPU control word restore it here | 1863 // If method sets FPU control word restore it here |
1874 debug_only(int off0 = cbuf.code_size()); | 1864 debug_only(int off0 = cbuf.insts_size()); |
1875 if( Compile::current()->in_24_bit_fp_mode() ) { | 1865 if( Compile::current()->in_24_bit_fp_mode() ) { |
1876 MacroAssembler masm(&cbuf); | 1866 MacroAssembler masm(&cbuf); |
1877 masm.fldcw(ExternalAddress(StubRoutines::addr_fpu_cntrl_wrd_std())); | 1867 masm.fldcw(ExternalAddress(StubRoutines::addr_fpu_cntrl_wrd_std())); |
1878 } | 1868 } |
1879 debug_only(int off1 = cbuf.code_size()); | 1869 debug_only(int off1 = cbuf.insts_size()); |
1880 assert(off1 - off0 == pre_call_FPU_size(), "correct size prediction"); | 1870 assert(off1 - off0 == pre_call_FPU_size(), "correct size prediction"); |
1881 %} | 1871 %} |
1882 | 1872 |
1883 enc_class post_call_FPU %{ | 1873 enc_class post_call_FPU %{ |
1884 // If method sets FPU control word do it here also | 1874 // If method sets FPU control word do it here also |
1887 masm.fldcw(ExternalAddress(StubRoutines::addr_fpu_cntrl_wrd_24())); | 1877 masm.fldcw(ExternalAddress(StubRoutines::addr_fpu_cntrl_wrd_24())); |
1888 } | 1878 } |
1889 %} | 1879 %} |
1890 | 1880 |
1891 enc_class preserve_SP %{ | 1881 enc_class preserve_SP %{ |
1892 debug_only(int off0 = cbuf.code_size()); | 1882 debug_only(int off0 = cbuf.insts_size()); |
1893 MacroAssembler _masm(&cbuf); | 1883 MacroAssembler _masm(&cbuf); |
1894 // RBP is preserved across all calls, even compiled calls. | 1884 // RBP is preserved across all calls, even compiled calls. |
1895 // Use it to preserve RSP in places where the callee might change the SP. | 1885 // Use it to preserve RSP in places where the callee might change the SP. |
1896 __ movptr(rbp_mh_SP_save, rsp); | 1886 __ movptr(rbp_mh_SP_save, rsp); |
1897 debug_only(int off1 = cbuf.code_size()); | 1887 debug_only(int off1 = cbuf.insts_size()); |
1898 assert(off1 - off0 == preserve_SP_size(), "correct size prediction"); | 1888 assert(off1 - off0 == preserve_SP_size(), "correct size prediction"); |
1899 %} | 1889 %} |
1900 | 1890 |
1901 enc_class restore_SP %{ | 1891 enc_class restore_SP %{ |
1902 MacroAssembler _masm(&cbuf); | 1892 MacroAssembler _masm(&cbuf); |
1904 %} | 1894 %} |
1905 | 1895 |
1906 enc_class Java_Static_Call (method meth) %{ // JAVA STATIC CALL | 1896 enc_class Java_Static_Call (method meth) %{ // JAVA STATIC CALL |
1907 // CALL to fixup routine. Fixup routine uses ScopeDesc info to determine | 1897 // CALL to fixup routine. Fixup routine uses ScopeDesc info to determine |
1908 // who we intended to call. | 1898 // who we intended to call. |
1909 cbuf.set_inst_mark(); | 1899 cbuf.set_insts_mark(); |
1910 $$$emit8$primary; | 1900 $$$emit8$primary; |
1911 if ( !_method ) { | 1901 if ( !_method ) { |
1912 emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4), | 1902 emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4), |
1913 runtime_call_Relocation::spec(), RELOC_IMM32 ); | 1903 runtime_call_Relocation::spec(), RELOC_IMM32 ); |
1914 } else if(_optimized_virtual) { | 1904 } else if(_optimized_virtual) { |
1915 emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4), | 1905 emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4), |
1916 opt_virtual_call_Relocation::spec(), RELOC_IMM32 ); | 1906 opt_virtual_call_Relocation::spec(), RELOC_IMM32 ); |
1917 } else { | 1907 } else { |
1918 emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4), | 1908 emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4), |
1919 static_call_Relocation::spec(), RELOC_IMM32 ); | 1909 static_call_Relocation::spec(), RELOC_IMM32 ); |
1920 } | 1910 } |
1921 if( _method ) { // Emit stub for static call | 1911 if( _method ) { // Emit stub for static call |
1922 emit_java_to_interp(cbuf); | 1912 emit_java_to_interp(cbuf); |
1923 } | 1913 } |
1925 | 1915 |
1926 enc_class Java_Dynamic_Call (method meth) %{ // JAVA DYNAMIC CALL | 1916 enc_class Java_Dynamic_Call (method meth) %{ // JAVA DYNAMIC CALL |
1927 // !!!!! | 1917 // !!!!! |
1928 // Generate "Mov EAX,0x00", placeholder instruction to load oop-info | 1918 // Generate "Mov EAX,0x00", placeholder instruction to load oop-info |
1929 // emit_call_dynamic_prologue( cbuf ); | 1919 // emit_call_dynamic_prologue( cbuf ); |
1930 cbuf.set_inst_mark(); | 1920 cbuf.set_insts_mark(); |
1931 emit_opcode(cbuf, 0xB8 + EAX_enc); // mov EAX,-1 | 1921 emit_opcode(cbuf, 0xB8 + EAX_enc); // mov EAX,-1 |
1932 emit_d32_reloc(cbuf, (int)Universe::non_oop_word(), oop_Relocation::spec_for_immediate(), RELOC_IMM32); | 1922 emit_d32_reloc(cbuf, (int)Universe::non_oop_word(), oop_Relocation::spec_for_immediate(), RELOC_IMM32); |
1933 address virtual_call_oop_addr = cbuf.inst_mark(); | 1923 address virtual_call_oop_addr = cbuf.insts_mark(); |
1934 // CALL to fixup routine. Fixup routine uses ScopeDesc info to determine | 1924 // CALL to fixup routine. Fixup routine uses ScopeDesc info to determine |
1935 // who we intended to call. | 1925 // who we intended to call. |
1936 cbuf.set_inst_mark(); | 1926 cbuf.set_insts_mark(); |
1937 $$$emit8$primary; | 1927 $$$emit8$primary; |
1938 emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.code_end()) - 4), | 1928 emit_d32_reloc(cbuf, ($meth$$method - (int)(cbuf.insts_end()) - 4), |
1939 virtual_call_Relocation::spec(virtual_call_oop_addr), RELOC_IMM32 ); | 1929 virtual_call_Relocation::spec(virtual_call_oop_addr), RELOC_IMM32 ); |
1940 %} | 1930 %} |
1941 | 1931 |
1942 enc_class Java_Compiled_Call (method meth) %{ // JAVA COMPILED CALL | 1932 enc_class Java_Compiled_Call (method meth) %{ // JAVA COMPILED CALL |
1943 int disp = in_bytes(methodOopDesc::from_compiled_offset()); | 1933 int disp = in_bytes(methodOopDesc::from_compiled_offset()); |
1944 assert( -128 <= disp && disp <= 127, "compiled_code_offset isn't small"); | 1934 assert( -128 <= disp && disp <= 127, "compiled_code_offset isn't small"); |
1945 | 1935 |
1946 // CALL *[EAX+in_bytes(methodOopDesc::from_compiled_code_entry_point_offset())] | 1936 // CALL *[EAX+in_bytes(methodOopDesc::from_compiled_code_entry_point_offset())] |
1947 cbuf.set_inst_mark(); | 1937 cbuf.set_insts_mark(); |
1948 $$$emit8$primary; | 1938 $$$emit8$primary; |
1949 emit_rm(cbuf, 0x01, $secondary, EAX_enc ); // R/M byte | 1939 emit_rm(cbuf, 0x01, $secondary, EAX_enc ); // R/M byte |
1950 emit_d8(cbuf, disp); // Displacement | 1940 emit_d8(cbuf, disp); // Displacement |
1951 | 1941 |
1952 %} | 1942 %} |
1974 // // xor rbp,ebp | 1964 // // xor rbp,ebp |
1975 // emit_opcode(cbuf, 0x33); | 1965 // emit_opcode(cbuf, 0x33); |
1976 // emit_rm(cbuf, 0x3, EBP_enc, EBP_enc); | 1966 // emit_rm(cbuf, 0x3, EBP_enc, EBP_enc); |
1977 // | 1967 // |
1978 // // CALL to interpreter. | 1968 // // CALL to interpreter. |
1979 // cbuf.set_inst_mark(); | 1969 // cbuf.set_insts_mark(); |
1980 // $$$emit8$primary; | 1970 // $$$emit8$primary; |
1981 // emit_d32_reloc(cbuf, ($labl$$label - (int)(cbuf.code_end()) - 4), | 1971 // emit_d32_reloc(cbuf, ($labl$$label - (int)(cbuf.insts_end()) - 4), |
1982 // runtime_call_Relocation::spec(), RELOC_IMM32 ); | 1972 // runtime_call_Relocation::spec(), RELOC_IMM32 ); |
1983 // %} | 1973 // %} |
1984 | 1974 |
1985 enc_class RegOpcImm (eRegI dst, immI8 shift) %{ // SHL, SAR, SHR | 1975 enc_class RegOpcImm (eRegI dst, immI8 shift) %{ // SHL, SAR, SHR |
1986 $$$emit8$primary; | 1976 $$$emit8$primary; |
2085 emit_rm(cbuf, 0x0, $dst$$reg, 0x5); | 2075 emit_rm(cbuf, 0x0, $dst$$reg, 0x5); |
2086 emit_double_constant(cbuf, $con$$constant); | 2076 emit_double_constant(cbuf, $con$$constant); |
2087 %} | 2077 %} |
2088 | 2078 |
2089 enc_class Opc_MemImm_F(immF src) %{ | 2079 enc_class Opc_MemImm_F(immF src) %{ |
2090 cbuf.set_inst_mark(); | 2080 cbuf.set_insts_mark(); |
2091 $$$emit8$primary; | 2081 $$$emit8$primary; |
2092 emit_rm(cbuf, 0x0, $secondary, 0x5); | 2082 emit_rm(cbuf, 0x0, $secondary, 0x5); |
2093 emit_float_constant(cbuf, $src$$constant); | 2083 emit_float_constant(cbuf, $src$$constant); |
2094 %} | 2084 %} |
2095 | 2085 |
2278 emit_d32( cbuf, 1 ); | 2268 emit_d32( cbuf, 1 ); |
2279 // fail: | 2269 // fail: |
2280 %} | 2270 %} |
2281 | 2271 |
2282 enc_class set_instruction_start( ) %{ | 2272 enc_class set_instruction_start( ) %{ |
2283 cbuf.set_inst_mark(); // Mark start of opcode for reloc info in mem operand | 2273 cbuf.set_insts_mark(); // Mark start of opcode for reloc info in mem operand |
2284 %} | 2274 %} |
2285 | 2275 |
2286 enc_class RegMem (eRegI ereg, memory mem) %{ // emit_reg_mem | 2276 enc_class RegMem (eRegI ereg, memory mem) %{ // emit_reg_mem |
2287 int reg_encoding = $ereg$$reg; | 2277 int reg_encoding = $ereg$$reg; |
2288 int base = $mem$$base; | 2278 int base = $mem$$base; |
2427 if( $src$$reg != FPR1L_enc ) { | 2417 if( $src$$reg != FPR1L_enc ) { |
2428 reg_encoding = 0x3; // Store & pop | 2418 reg_encoding = 0x3; // Store & pop |
2429 emit_opcode( cbuf, 0xD9 ); // FLD (i.e., push it) | 2419 emit_opcode( cbuf, 0xD9 ); // FLD (i.e., push it) |
2430 emit_d8( cbuf, 0xC0-1+$src$$reg ); | 2420 emit_d8( cbuf, 0xC0-1+$src$$reg ); |
2431 } | 2421 } |
2432 cbuf.set_inst_mark(); // Mark start of opcode for reloc info in mem operand | 2422 cbuf.set_insts_mark(); // Mark start of opcode for reloc info in mem operand |
2433 emit_opcode(cbuf,$primary); | 2423 emit_opcode(cbuf,$primary); |
2434 encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, disp_is_oop); | 2424 encode_RegMem(cbuf, reg_encoding, base, index, scale, displace, disp_is_oop); |
2435 %} | 2425 %} |
2436 | 2426 |
2437 enc_class neg_reg(eRegI dst) %{ | 2427 enc_class neg_reg(eRegI dst) %{ |
2472 emit_rm(cbuf, 0x3, $p$$reg, $q$$reg); | 2462 emit_rm(cbuf, 0x3, $p$$reg, $q$$reg); |
2473 // SBB $tmp,$tmp | 2463 // SBB $tmp,$tmp |
2474 emit_opcode(cbuf,0x1B); | 2464 emit_opcode(cbuf,0x1B); |
2475 emit_rm(cbuf, 0x3, tmpReg, tmpReg); | 2465 emit_rm(cbuf, 0x3, tmpReg, tmpReg); |
2476 // AND $tmp,$y | 2466 // AND $tmp,$y |
2477 cbuf.set_inst_mark(); // Mark start of opcode for reloc info in mem operand | 2467 cbuf.set_insts_mark(); // Mark start of opcode for reloc info in mem operand |
2478 emit_opcode(cbuf,0x23); | 2468 emit_opcode(cbuf,0x23); |
2479 int reg_encoding = tmpReg; | 2469 int reg_encoding = tmpReg; |
2480 int base = $mem$$base; | 2470 int base = $mem$$base; |
2481 int index = $mem$$index; | 2471 int index = $mem$$index; |
2482 int scale = $mem$$scale; | 2472 int scale = $mem$$scale; |
3155 // PUSH src2.hi | 3145 // PUSH src2.hi |
3156 emit_opcode(cbuf, HIGH_FROM_LOW(0x50+$src2$$reg) ); | 3146 emit_opcode(cbuf, HIGH_FROM_LOW(0x50+$src2$$reg) ); |
3157 // PUSH src2.lo | 3147 // PUSH src2.lo |
3158 emit_opcode(cbuf, 0x50+$src2$$reg ); | 3148 emit_opcode(cbuf, 0x50+$src2$$reg ); |
3159 // CALL directly to the runtime | 3149 // CALL directly to the runtime |
3160 cbuf.set_inst_mark(); | 3150 cbuf.set_insts_mark(); |
3161 emit_opcode(cbuf,0xE8); // Call into runtime | 3151 emit_opcode(cbuf,0xE8); // Call into runtime |
3162 emit_d32_reloc(cbuf, (CAST_FROM_FN_PTR(address, SharedRuntime::ldiv) - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 ); | 3152 emit_d32_reloc(cbuf, (CAST_FROM_FN_PTR(address, SharedRuntime::ldiv) - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 ); |
3163 // Restore stack | 3153 // Restore stack |
3164 emit_opcode(cbuf, 0x83); // add SP, #framesize | 3154 emit_opcode(cbuf, 0x83); // add SP, #framesize |
3165 emit_rm(cbuf, 0x3, 0x00, ESP_enc); | 3155 emit_rm(cbuf, 0x3, 0x00, ESP_enc); |
3166 emit_d8(cbuf, 4*4); | 3156 emit_d8(cbuf, 4*4); |
3167 %} | 3157 %} |
3174 // PUSH src2.hi | 3164 // PUSH src2.hi |
3175 emit_opcode(cbuf, HIGH_FROM_LOW(0x50+$src2$$reg) ); | 3165 emit_opcode(cbuf, HIGH_FROM_LOW(0x50+$src2$$reg) ); |
3176 // PUSH src2.lo | 3166 // PUSH src2.lo |
3177 emit_opcode(cbuf, 0x50+$src2$$reg ); | 3167 emit_opcode(cbuf, 0x50+$src2$$reg ); |
3178 // CALL directly to the runtime | 3168 // CALL directly to the runtime |
3179 cbuf.set_inst_mark(); | 3169 cbuf.set_insts_mark(); |
3180 emit_opcode(cbuf,0xE8); // Call into runtime | 3170 emit_opcode(cbuf,0xE8); // Call into runtime |
3181 emit_d32_reloc(cbuf, (CAST_FROM_FN_PTR(address, SharedRuntime::lrem ) - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 ); | 3171 emit_d32_reloc(cbuf, (CAST_FROM_FN_PTR(address, SharedRuntime::lrem ) - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 ); |
3182 // Restore stack | 3172 // Restore stack |
3183 emit_opcode(cbuf, 0x83); // add SP, #framesize | 3173 emit_opcode(cbuf, 0x83); // add SP, #framesize |
3184 emit_rm(cbuf, 0x3, 0x00, ESP_enc); | 3174 emit_rm(cbuf, 0x3, 0x00, ESP_enc); |
3185 emit_d8(cbuf, 4*4); | 3175 emit_d8(cbuf, 4*4); |
3186 %} | 3176 %} |
3822 enc_class enc_pop_rdx() %{ | 3812 enc_class enc_pop_rdx() %{ |
3823 emit_opcode(cbuf,0x5A); | 3813 emit_opcode(cbuf,0x5A); |
3824 %} | 3814 %} |
3825 | 3815 |
3826 enc_class enc_rethrow() %{ | 3816 enc_class enc_rethrow() %{ |
3827 cbuf.set_inst_mark(); | 3817 cbuf.set_insts_mark(); |
3828 emit_opcode(cbuf, 0xE9); // jmp entry | 3818 emit_opcode(cbuf, 0xE9); // jmp entry |
3829 emit_d32_reloc(cbuf, (int)OptoRuntime::rethrow_stub() - ((int)cbuf.code_end())-4, | 3819 emit_d32_reloc(cbuf, (int)OptoRuntime::rethrow_stub() - ((int)cbuf.insts_end())-4, |
3830 runtime_call_Relocation::spec(), RELOC_IMM32 ); | 3820 runtime_call_Relocation::spec(), RELOC_IMM32 ); |
3831 %} | 3821 %} |
3832 | 3822 |
3833 | 3823 |
3834 // Convert a double to an int. Java semantics require we do complex | 3824 // Convert a double to an int. Java semantics require we do complex |
3871 emit_d8 (cbuf,0x07); // Size of slow_call | 3861 emit_d8 (cbuf,0x07); // Size of slow_call |
3872 // Push src onto stack slow-path | 3862 // Push src onto stack slow-path |
3873 emit_opcode(cbuf,0xD9 ); // FLD ST(i) | 3863 emit_opcode(cbuf,0xD9 ); // FLD ST(i) |
3874 emit_d8 (cbuf,0xC0-1+$src$$reg ); | 3864 emit_d8 (cbuf,0xC0-1+$src$$reg ); |
3875 // CALL directly to the runtime | 3865 // CALL directly to the runtime |
3876 cbuf.set_inst_mark(); | 3866 cbuf.set_insts_mark(); |
3877 emit_opcode(cbuf,0xE8); // Call into runtime | 3867 emit_opcode(cbuf,0xE8); // Call into runtime |
3878 emit_d32_reloc(cbuf, (StubRoutines::d2i_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 ); | 3868 emit_d32_reloc(cbuf, (StubRoutines::d2i_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 ); |
3879 // Carry on here... | 3869 // Carry on here... |
3880 %} | 3870 %} |
3881 | 3871 |
3882 enc_class D2L_encoding( regD src ) %{ | 3872 enc_class D2L_encoding( regD src ) %{ |
3883 emit_opcode(cbuf,0xD9); // FLDCW trunc | 3873 emit_opcode(cbuf,0xD9); // FLDCW trunc |
3913 emit_d8 (cbuf,0x07); // Size of slow_call | 3903 emit_d8 (cbuf,0x07); // Size of slow_call |
3914 // Push src onto stack slow-path | 3904 // Push src onto stack slow-path |
3915 emit_opcode(cbuf,0xD9 ); // FLD ST(i) | 3905 emit_opcode(cbuf,0xD9 ); // FLD ST(i) |
3916 emit_d8 (cbuf,0xC0-1+$src$$reg ); | 3906 emit_d8 (cbuf,0xC0-1+$src$$reg ); |
3917 // CALL directly to the runtime | 3907 // CALL directly to the runtime |
3918 cbuf.set_inst_mark(); | 3908 cbuf.set_insts_mark(); |
3919 emit_opcode(cbuf,0xE8); // Call into runtime | 3909 emit_opcode(cbuf,0xE8); // Call into runtime |
3920 emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 ); | 3910 emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 ); |
3921 // Carry on here... | 3911 // Carry on here... |
3922 %} | 3912 %} |
3923 | 3913 |
3924 enc_class X2L_encoding( regX src ) %{ | 3914 enc_class X2L_encoding( regX src ) %{ |
3925 // Allocate a word | 3915 // Allocate a word |
3986 emit_opcode(cbuf,0x83); // ADD ESP,4 | 3976 emit_opcode(cbuf,0x83); // ADD ESP,4 |
3987 emit_opcode(cbuf,0xC4); | 3977 emit_opcode(cbuf,0xC4); |
3988 emit_d8(cbuf,0x04); | 3978 emit_d8(cbuf,0x04); |
3989 | 3979 |
3990 // CALL directly to the runtime | 3980 // CALL directly to the runtime |
3991 cbuf.set_inst_mark(); | 3981 cbuf.set_insts_mark(); |
3992 emit_opcode(cbuf,0xE8); // Call into runtime | 3982 emit_opcode(cbuf,0xE8); // Call into runtime |
3993 emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 ); | 3983 emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 ); |
3994 // Carry on here... | 3984 // Carry on here... |
3995 %} | 3985 %} |
3996 | 3986 |
3997 enc_class XD2L_encoding( regXD src ) %{ | 3987 enc_class XD2L_encoding( regXD src ) %{ |
3998 // Allocate a word | 3988 // Allocate a word |
4060 emit_opcode(cbuf,0x83); // ADD ESP,8 | 4050 emit_opcode(cbuf,0x83); // ADD ESP,8 |
4061 emit_opcode(cbuf,0xC4); | 4051 emit_opcode(cbuf,0xC4); |
4062 emit_d8(cbuf,0x08); | 4052 emit_d8(cbuf,0x08); |
4063 | 4053 |
4064 // CALL directly to the runtime | 4054 // CALL directly to the runtime |
4065 cbuf.set_inst_mark(); | 4055 cbuf.set_insts_mark(); |
4066 emit_opcode(cbuf,0xE8); // Call into runtime | 4056 emit_opcode(cbuf,0xE8); // Call into runtime |
4067 emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 ); | 4057 emit_d32_reloc(cbuf, (StubRoutines::d2l_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 ); |
4068 // Carry on here... | 4058 // Carry on here... |
4069 %} | 4059 %} |
4070 | 4060 |
4071 enc_class D2X_encoding( regX dst, regD src ) %{ | 4061 enc_class D2X_encoding( regX dst, regD src ) %{ |
4072 // Allocate a word | 4062 // Allocate a word |
4120 emit_opcode(cbuf,0x83); // ADD ESP,4 | 4110 emit_opcode(cbuf,0x83); // ADD ESP,4 |
4121 emit_opcode(cbuf,0xC4); | 4111 emit_opcode(cbuf,0xC4); |
4122 emit_d8(cbuf, $primary ? 0x8 : 0x4); | 4112 emit_d8(cbuf, $primary ? 0x8 : 0x4); |
4123 | 4113 |
4124 // CALL directly to the runtime | 4114 // CALL directly to the runtime |
4125 cbuf.set_inst_mark(); | 4115 cbuf.set_insts_mark(); |
4126 emit_opcode(cbuf,0xE8); // Call into runtime | 4116 emit_opcode(cbuf,0xE8); // Call into runtime |
4127 emit_d32_reloc(cbuf, (StubRoutines::d2i_wrapper() - cbuf.code_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 ); | 4117 emit_d32_reloc(cbuf, (StubRoutines::d2i_wrapper() - cbuf.insts_end()) - 4, runtime_call_Relocation::spec(), RELOC_IMM32 ); |
4128 | 4118 |
4129 // Carry on here... | 4119 // Carry on here... |
4130 %} | 4120 %} |
4131 | 4121 |
4132 enc_class X2D_encoding( regD dst, regX src ) %{ | 4122 enc_class X2D_encoding( regD dst, regX src ) %{ |
4319 // the FP TOS and then do a 64-bit FIST. Has to probe the | 4309 // the FP TOS and then do a 64-bit FIST. Has to probe the |
4320 // target address before the store (for null-ptr checks) | 4310 // target address before the store (for null-ptr checks) |
4321 // so the memory operand is used twice in the encoding. | 4311 // so the memory operand is used twice in the encoding. |
4322 enc_class enc_storeL_volatile( memory mem, stackSlotL src ) %{ | 4312 enc_class enc_storeL_volatile( memory mem, stackSlotL src ) %{ |
4323 store_to_stackslot( cbuf, 0x0DF, 0x05, $src$$disp ); | 4313 store_to_stackslot( cbuf, 0x0DF, 0x05, $src$$disp ); |
4324 cbuf.set_inst_mark(); // Mark start of FIST in case $mem has an oop | 4314 cbuf.set_insts_mark(); // Mark start of FIST in case $mem has an oop |
4325 emit_opcode(cbuf,0xDF); | 4315 emit_opcode(cbuf,0xDF); |
4326 int rm_byte_opcode = 0x07; | 4316 int rm_byte_opcode = 0x07; |
4327 int base = $mem$$base; | 4317 int base = $mem$$base; |
4328 int index = $mem$$index; | 4318 int index = $mem$$index; |
4329 int scale = $mem$$scale; | 4319 int scale = $mem$$scale; |
4343 int scale = $src$$scale; | 4333 int scale = $src$$scale; |
4344 int displace = $src$$disp; | 4334 int displace = $src$$disp; |
4345 bool disp_is_oop = $src->disp_is_oop(); // disp-as-oop when working with static globals | 4335 bool disp_is_oop = $src->disp_is_oop(); // disp-as-oop when working with static globals |
4346 encode_RegMem(cbuf, $tmp$$reg, base, index, scale, displace, disp_is_oop); | 4336 encode_RegMem(cbuf, $tmp$$reg, base, index, scale, displace, disp_is_oop); |
4347 } | 4337 } |
4348 cbuf.set_inst_mark(); // Mark start of MOVSD in case $mem has an oop | 4338 cbuf.set_insts_mark(); // Mark start of MOVSD in case $mem has an oop |
4349 { // MOVSD $mem,$tmp ! atomic long store | 4339 { // MOVSD $mem,$tmp ! atomic long store |
4350 emit_opcode(cbuf,0xF2); | 4340 emit_opcode(cbuf,0xF2); |
4351 emit_opcode(cbuf,0x0F); | 4341 emit_opcode(cbuf,0x0F); |
4352 emit_opcode(cbuf,0x11); | 4342 emit_opcode(cbuf,0x11); |
4353 int base = $mem$$base; | 4343 int base = $mem$$base; |
4376 emit_opcode(cbuf,0x66); | 4366 emit_opcode(cbuf,0x66); |
4377 emit_opcode(cbuf,0x0F); | 4367 emit_opcode(cbuf,0x0F); |
4378 emit_opcode(cbuf,0x62); | 4368 emit_opcode(cbuf,0x62); |
4379 emit_rm(cbuf, 0x3, $tmp$$reg, $tmp2$$reg); | 4369 emit_rm(cbuf, 0x3, $tmp$$reg, $tmp2$$reg); |
4380 } | 4370 } |
4381 cbuf.set_inst_mark(); // Mark start of MOVSD in case $mem has an oop | 4371 cbuf.set_insts_mark(); // Mark start of MOVSD in case $mem has an oop |
4382 { // MOVSD $mem,$tmp ! atomic long store | 4372 { // MOVSD $mem,$tmp ! atomic long store |
4383 emit_opcode(cbuf,0xF2); | 4373 emit_opcode(cbuf,0xF2); |
4384 emit_opcode(cbuf,0x0F); | 4374 emit_opcode(cbuf,0x0F); |
4385 emit_opcode(cbuf,0x11); | 4375 emit_opcode(cbuf,0x11); |
4386 int base = $mem$$base; | 4376 int base = $mem$$base; |
4397 // in the process | 4387 // in the process |
4398 // We current use TESTL [spp],EDI | 4388 // We current use TESTL [spp],EDI |
4399 // A better choice might be TESTB [spp + pagesize() - CacheLineSize()],0 | 4389 // A better choice might be TESTB [spp + pagesize() - CacheLineSize()],0 |
4400 | 4390 |
4401 enc_class Safepoint_Poll() %{ | 4391 enc_class Safepoint_Poll() %{ |
4402 cbuf.relocate(cbuf.inst_mark(), relocInfo::poll_type, 0); | 4392 cbuf.relocate(cbuf.insts_mark(), relocInfo::poll_type, 0); |
4403 emit_opcode(cbuf,0x85); | 4393 emit_opcode(cbuf,0x85); |
4404 emit_rm (cbuf, 0x0, 0x7, 0x5); | 4394 emit_rm (cbuf, 0x0, 0x7, 0x5); |
4405 emit_d32(cbuf, (intptr_t)os::get_polling_page()); | 4395 emit_d32(cbuf, (intptr_t)os::get_polling_page()); |
4406 %} | 4396 %} |
4407 %} | 4397 %} |
12930 emit_cc(cbuf, $secondary, Assembler::parity); | 12920 emit_cc(cbuf, $secondary, Assembler::parity); |
12931 int parity_disp = -1; | 12921 int parity_disp = -1; |
12932 bool ok = false; | 12922 bool ok = false; |
12933 if ($cop$$cmpcode == Assembler::notEqual) { | 12923 if ($cop$$cmpcode == Assembler::notEqual) { |
12934 // the two jumps 6 bytes apart so the jump distances are too | 12924 // the two jumps 6 bytes apart so the jump distances are too |
12935 parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0; | 12925 parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0; |
12936 } else if ($cop$$cmpcode == Assembler::equal) { | 12926 } else if ($cop$$cmpcode == Assembler::equal) { |
12937 parity_disp = 6; | 12927 parity_disp = 6; |
12938 ok = true; | 12928 ok = true; |
12939 } else { | 12929 } else { |
12940 ShouldNotReachHere(); | 12930 ShouldNotReachHere(); |
12941 } | 12931 } |
12942 emit_d32(cbuf, parity_disp); | 12932 emit_d32(cbuf, parity_disp); |
12943 $$$emit8$primary; | 12933 $$$emit8$primary; |
12944 emit_cc(cbuf, $secondary, $cop$$cmpcode); | 12934 emit_cc(cbuf, $secondary, $cop$$cmpcode); |
12945 int disp = l ? (l->loc_pos() - (cbuf.code_size() + 4)) : 0; | 12935 int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 4)) : 0; |
12946 emit_d32(cbuf, disp); | 12936 emit_d32(cbuf, disp); |
12947 %} | 12937 %} |
12948 ins_pipe(pipe_jcc); | 12938 ins_pipe(pipe_jcc); |
12949 ins_pc_relative(1); | 12939 ins_pc_relative(1); |
12950 %} | 12940 %} |
13126 ins_encode %{ | 13116 ins_encode %{ |
13127 Label* l = $labl$$label; | 13117 Label* l = $labl$$label; |
13128 emit_cc(cbuf, $primary, Assembler::parity); | 13118 emit_cc(cbuf, $primary, Assembler::parity); |
13129 int parity_disp = -1; | 13119 int parity_disp = -1; |
13130 if ($cop$$cmpcode == Assembler::notEqual) { | 13120 if ($cop$$cmpcode == Assembler::notEqual) { |
13131 parity_disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0; | 13121 parity_disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0; |
13132 } else if ($cop$$cmpcode == Assembler::equal) { | 13122 } else if ($cop$$cmpcode == Assembler::equal) { |
13133 parity_disp = 2; | 13123 parity_disp = 2; |
13134 } else { | 13124 } else { |
13135 ShouldNotReachHere(); | 13125 ShouldNotReachHere(); |
13136 } | 13126 } |
13137 emit_d8(cbuf, parity_disp); | 13127 emit_d8(cbuf, parity_disp); |
13138 emit_cc(cbuf, $primary, $cop$$cmpcode); | 13128 emit_cc(cbuf, $primary, $cop$$cmpcode); |
13139 int disp = l ? (l->loc_pos() - (cbuf.code_size() + 1)) : 0; | 13129 int disp = l ? (l->loc_pos() - (cbuf.insts_size() + 1)) : 0; |
13140 emit_d8(cbuf, disp); | 13130 emit_d8(cbuf, disp); |
13141 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); | 13131 assert(-128 <= disp && disp <= 127, "Displacement too large for short jmp"); |
13142 assert(-128 <= parity_disp && parity_disp <= 127, "Displacement too large for short jmp"); | 13132 assert(-128 <= parity_disp && parity_disp <= 127, "Displacement too large for short jmp"); |
13143 %} | 13133 %} |
13144 ins_pipe(pipe_jcc); | 13134 ins_pipe(pipe_jcc); |