Mercurial > hg > truffle
comparison src/cpu/x86/vm/assembler_x86.cpp @ 2044:06f017f7daa7
Merge.
author | Thomas Wuerthinger <wuerthinger@ssw.jku.at> |
---|---|
date | Fri, 07 Jan 2011 18:18:08 +0100 |
parents | 2d26b0046e0d 4de5f4101cfd |
children | 91fe28b03d6a |
comparison
equal
deleted
inserted
replaced
1942:00bc9eaf0e24 | 2044:06f017f7daa7 |
---|---|
20 * or visit www.oracle.com if you need additional information or have any | 20 * or visit www.oracle.com if you need additional information or have any |
21 * questions. | 21 * questions. |
22 * | 22 * |
23 */ | 23 */ |
24 | 24 |
25 #include "incls/_precompiled.incl" | 25 #include "precompiled.hpp" |
26 #include "incls/_assembler_x86.cpp.incl" | 26 #include "assembler_x86.inline.hpp" |
27 #include "gc_interface/collectedHeap.inline.hpp" | |
28 #include "interpreter/interpreter.hpp" | |
29 #include "memory/cardTableModRefBS.hpp" | |
30 #include "memory/resourceArea.hpp" | |
31 #include "prims/methodHandles.hpp" | |
32 #include "runtime/biasedLocking.hpp" | |
33 #include "runtime/interfaceSupport.hpp" | |
34 #include "runtime/objectMonitor.hpp" | |
35 #include "runtime/os.hpp" | |
36 #include "runtime/sharedRuntime.hpp" | |
37 #include "runtime/stubRoutines.hpp" | |
38 #ifndef SERIALGC | |
39 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" | |
40 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" | |
41 #include "gc_implementation/g1/heapRegion.hpp" | |
42 #endif | |
27 | 43 |
28 // Implementation of AddressLiteral | 44 // Implementation of AddressLiteral |
29 | 45 |
30 AddressLiteral::AddressLiteral(address target, relocInfo::relocType rtype) { | 46 AddressLiteral::AddressLiteral(address target, relocInfo::relocType rtype) { |
31 _is_lval = false; | 47 _is_lval = false; |
2631 emit_byte(0x0F); | 2647 emit_byte(0x0F); |
2632 emit_byte(0x51); | 2648 emit_byte(0x51); |
2633 emit_byte(0xC0 | encode); | 2649 emit_byte(0xC0 | encode); |
2634 } | 2650 } |
2635 | 2651 |
2652 void Assembler::sqrtsd(XMMRegister dst, Address src) { | |
2653 NOT_LP64(assert(VM_Version::supports_sse2(), "")); | |
2654 InstructionMark im(this); | |
2655 emit_byte(0xF2); | |
2656 prefix(src, dst); | |
2657 emit_byte(0x0F); | |
2658 emit_byte(0x51); | |
2659 emit_operand(dst, src); | |
2660 } | |
2661 | |
2662 void Assembler::sqrtss(XMMRegister dst, XMMRegister src) { | |
2663 // HMM Table D-1 says sse2 | |
2664 // NOT_LP64(assert(VM_Version::supports_sse(), "")); | |
2665 NOT_LP64(assert(VM_Version::supports_sse2(), "")); | |
2666 emit_byte(0xF3); | |
2667 int encode = prefix_and_encode(dst->encoding(), src->encoding()); | |
2668 emit_byte(0x0F); | |
2669 emit_byte(0x51); | |
2670 emit_byte(0xC0 | encode); | |
2671 } | |
2672 | |
2673 void Assembler::sqrtss(XMMRegister dst, Address src) { | |
2674 NOT_LP64(assert(VM_Version::supports_sse2(), "")); | |
2675 InstructionMark im(this); | |
2676 emit_byte(0xF3); | |
2677 prefix(src, dst); | |
2678 emit_byte(0x0F); | |
2679 emit_byte(0x51); | |
2680 emit_operand(dst, src); | |
2681 } | |
2682 | |
2636 void Assembler::stmxcsr( Address dst) { | 2683 void Assembler::stmxcsr( Address dst) { |
2637 NOT_LP64(assert(VM_Version::supports_sse(), "")); | 2684 NOT_LP64(assert(VM_Version::supports_sse(), "")); |
2638 InstructionMark im(this); | 2685 InstructionMark im(this); |
2639 prefix(dst); | 2686 prefix(dst); |
2640 emit_byte(0x0F); | 2687 emit_byte(0x0F); |
4338 | 4385 |
4339 void Assembler::shrq(Register dst) { | 4386 void Assembler::shrq(Register dst) { |
4340 int encode = prefixq_and_encode(dst->encoding()); | 4387 int encode = prefixq_and_encode(dst->encoding()); |
4341 emit_byte(0xD3); | 4388 emit_byte(0xD3); |
4342 emit_byte(0xE8 | encode); | 4389 emit_byte(0xE8 | encode); |
4343 } | |
4344 | |
4345 void Assembler::sqrtsd(XMMRegister dst, Address src) { | |
4346 NOT_LP64(assert(VM_Version::supports_sse2(), "")); | |
4347 InstructionMark im(this); | |
4348 emit_byte(0xF2); | |
4349 prefix(src, dst); | |
4350 emit_byte(0x0F); | |
4351 emit_byte(0x51); | |
4352 emit_operand(dst, src); | |
4353 } | 4390 } |
4354 | 4391 |
4355 void Assembler::subq(Address dst, int32_t imm32) { | 4392 void Assembler::subq(Address dst, int32_t imm32) { |
4356 InstructionMark im(this); | 4393 InstructionMark im(this); |
4357 prefixq(dst); | 4394 prefixq(dst); |
4911 void MacroAssembler::movptr(Address dst, intptr_t src) { | 4948 void MacroAssembler::movptr(Address dst, intptr_t src) { |
4912 movl(dst, src); | 4949 movl(dst, src); |
4913 } | 4950 } |
4914 | 4951 |
4915 | 4952 |
4916 void MacroAssembler::movsd(XMMRegister dst, AddressLiteral src) { | |
4917 movsd(dst, as_Address(src)); | |
4918 } | |
4919 | |
4920 void MacroAssembler::pop_callee_saved_registers() { | 4953 void MacroAssembler::pop_callee_saved_registers() { |
4921 pop(rcx); | 4954 pop(rcx); |
4922 pop(rdx); | 4955 pop(rdx); |
4923 pop(rdi); | 4956 pop(rdi); |
4924 pop(rsi); | 4957 pop(rsi); |
5521 call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64))); | 5554 call(RuntimeAddress(CAST_FROM_FN_PTR(address, MacroAssembler::debug64))); |
5522 hlt(); | 5555 hlt(); |
5523 } | 5556 } |
5524 | 5557 |
5525 void MacroAssembler::warn(const char* msg) { | 5558 void MacroAssembler::warn(const char* msg) { |
5526 push(r12); | 5559 push(rsp); |
5527 movq(r12, rsp); | |
5528 andq(rsp, -16); // align stack as required by push_CPU_state and call | 5560 andq(rsp, -16); // align stack as required by push_CPU_state and call |
5529 | 5561 |
5530 push_CPU_state(); // keeps alignment at 16 bytes | 5562 push_CPU_state(); // keeps alignment at 16 bytes |
5531 lea(c_rarg0, ExternalAddress((address) msg)); | 5563 lea(c_rarg0, ExternalAddress((address) msg)); |
5532 mov64(rax, 0); | 5564 mov64(rax, 0); |
5533 call_VM_leaf(CAST_FROM_FN_PTR(address, warning), c_rarg0); | 5565 call_VM_leaf(CAST_FROM_FN_PTR(address, warning), c_rarg0); |
5534 pop_CPU_state(); | 5566 pop_CPU_state(); |
5535 | 5567 pop(rsp); |
5536 movq(rsp, r12); | |
5537 pop(r12); | |
5538 } | 5568 } |
5539 | 5569 |
5540 #ifndef PRODUCT | 5570 #ifndef PRODUCT |
5541 extern "C" void findpc(intptr_t x); | 5571 extern "C" void findpc(intptr_t x); |
5542 #endif | 5572 #endif |
5844 last_java_sp = rsp; | 5874 last_java_sp = rsp; |
5845 } | 5875 } |
5846 // debugging support | 5876 // debugging support |
5847 assert(number_of_arguments >= 0 , "cannot have negative number of arguments"); | 5877 assert(number_of_arguments >= 0 , "cannot have negative number of arguments"); |
5848 LP64_ONLY(assert(java_thread == r15_thread, "unexpected register")); | 5878 LP64_ONLY(assert(java_thread == r15_thread, "unexpected register")); |
5879 #ifdef ASSERT | |
5880 LP64_ONLY(if (UseCompressedOops) verify_heapbase("call_VM_base");) | |
5881 #endif // ASSERT | |
5882 | |
5849 assert(java_thread != oop_result , "cannot use the same register for java_thread & oop_result"); | 5883 assert(java_thread != oop_result , "cannot use the same register for java_thread & oop_result"); |
5850 assert(java_thread != last_java_sp, "cannot use the same register for java_thread & last_java_sp"); | 5884 assert(java_thread != last_java_sp, "cannot use the same register for java_thread & last_java_sp"); |
5851 | 5885 |
5852 // push java thread (becomes first argument of C function) | 5886 // push java thread (becomes first argument of C function) |
5853 | 5887 |