Mercurial > hg > truffle
comparison src/cpu/sparc/vm/assembler_sparc.cpp @ 3753:cba7b5c2d53f
7045514: SPARC assembly code for JSR 292 ricochet frames
Reviewed-by: kvn, jrose
author | never |
---|---|
date | Fri, 03 Jun 2011 22:31:43 -0700 |
parents | e1162778c1c8 |
children | 3d42f82cd811 |
comparison
equal
deleted
inserted
replaced
3752:f918d6096e23 | 3753:cba7b5c2d53f |
---|---|
38 #include "runtime/stubRoutines.hpp" | 38 #include "runtime/stubRoutines.hpp" |
39 #ifndef SERIALGC | 39 #ifndef SERIALGC |
40 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" | 40 #include "gc_implementation/g1/g1CollectedHeap.inline.hpp" |
41 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" | 41 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp" |
42 #include "gc_implementation/g1/heapRegion.hpp" | 42 #include "gc_implementation/g1/heapRegion.hpp" |
43 #endif | |
44 | |
45 #ifdef PRODUCT | |
46 #define BLOCK_COMMENT(str) /* nothing */ | |
47 #else | |
48 #define BLOCK_COMMENT(str) block_comment(str) | |
43 #endif | 49 #endif |
44 | 50 |
45 // Convert the raw encoding form into the form expected by the | 51 // Convert the raw encoding form into the form expected by the |
46 // constructor for Address. | 52 // constructor for Address. |
47 Address Address::make_raw(int base, int index, int scale, int disp, bool disp_is_oop) { | 53 Address Address::make_raw(int base, int index, int scale, int disp, bool disp_is_oop) { |
1070 // check for pending exceptions. use Gtemp as scratch register. | 1076 // check for pending exceptions. use Gtemp as scratch register. |
1071 if (check_exceptions) { | 1077 if (check_exceptions) { |
1072 check_and_forward_exception(Gtemp); | 1078 check_and_forward_exception(Gtemp); |
1073 } | 1079 } |
1074 | 1080 |
1081 #ifdef ASSERT | |
1082 set(badHeapWordVal, G3); | |
1083 set(badHeapWordVal, G4); | |
1084 set(badHeapWordVal, G5); | |
1085 #endif | |
1086 | |
1075 // get oop result if there is one and reset the value in the thread | 1087 // get oop result if there is one and reset the value in the thread |
1076 if (oop_result->is_valid()) { | 1088 if (oop_result->is_valid()) { |
1077 get_vm_result(oop_result); | 1089 get_vm_result(oop_result); |
1078 } | 1090 } |
1079 } | 1091 } |
1175 save_thread(thread_cache); | 1187 save_thread(thread_cache); |
1176 // do the call | 1188 // do the call |
1177 call(entry_point, relocInfo::runtime_call_type); | 1189 call(entry_point, relocInfo::runtime_call_type); |
1178 delayed()->nop(); | 1190 delayed()->nop(); |
1179 restore_thread(thread_cache); | 1191 restore_thread(thread_cache); |
1192 #ifdef ASSERT | |
1193 set(badHeapWordVal, G3); | |
1194 set(badHeapWordVal, G4); | |
1195 set(badHeapWordVal, G5); | |
1196 #endif | |
1180 } | 1197 } |
1181 | 1198 |
1182 | 1199 |
1183 void MacroAssembler::call_VM_leaf(Register thread_cache, address entry_point, int number_of_arguments) { | 1200 void MacroAssembler::call_VM_leaf(Register thread_cache, address entry_point, int number_of_arguments) { |
1184 call_VM_leaf_base(thread_cache, entry_point, number_of_arguments); | 1201 call_VM_leaf_base(thread_cache, entry_point, number_of_arguments); |
1516 | 1533 |
1517 | 1534 |
1518 // save_frame: given number of "extra" words in frame, | 1535 // save_frame: given number of "extra" words in frame, |
1519 // issue approp. save instruction (p 200, v8 manual) | 1536 // issue approp. save instruction (p 200, v8 manual) |
1520 | 1537 |
1521 void MacroAssembler::save_frame(int extraWords = 0) { | 1538 void MacroAssembler::save_frame(int extraWords) { |
1522 int delta = -total_frame_size_in_bytes(extraWords); | 1539 int delta = -total_frame_size_in_bytes(extraWords); |
1523 if (is_simm13(delta)) { | 1540 if (is_simm13(delta)) { |
1524 save(SP, delta, SP); | 1541 save(SP, delta, SP); |
1525 } else { | 1542 } else { |
1526 set(delta, G3_scratch); | 1543 set(delta, G3_scratch); |
1728 // plausibility check for oops | 1745 // plausibility check for oops |
1729 if (!VerifyOops) return; | 1746 if (!VerifyOops) return; |
1730 | 1747 |
1731 if (reg == G0) return; // always NULL, which is always an oop | 1748 if (reg == G0) return; // always NULL, which is always an oop |
1732 | 1749 |
1750 BLOCK_COMMENT("verify_oop {"); | |
1733 char buffer[64]; | 1751 char buffer[64]; |
1734 #ifdef COMPILER1 | 1752 #ifdef COMPILER1 |
1735 if (CommentedAssembly) { | 1753 if (CommentedAssembly) { |
1736 snprintf(buffer, sizeof(buffer), "verify_oop at %d", offset()); | 1754 snprintf(buffer, sizeof(buffer), "verify_oop at %d", offset()); |
1737 block_comment(buffer); | 1755 block_comment(buffer); |
1766 // Register call to verify_oop_subroutine | 1784 // Register call to verify_oop_subroutine |
1767 callr(O7, G0); | 1785 callr(O7, G0); |
1768 delayed()->nop(); | 1786 delayed()->nop(); |
1769 // recover frame size | 1787 // recover frame size |
1770 add(SP, 8*8,SP); | 1788 add(SP, 8*8,SP); |
1789 BLOCK_COMMENT("} verify_oop"); | |
1771 } | 1790 } |
1772 | 1791 |
1773 void MacroAssembler::_verify_oop_addr(Address addr, const char* msg, const char * file, int line) { | 1792 void MacroAssembler::_verify_oop_addr(Address addr, const char* msg, const char * file, int line) { |
1774 // plausibility check for oops | 1793 // plausibility check for oops |
1775 if (!VerifyOops) return; | 1794 if (!VerifyOops) return; |
2038 } | 2057 } |
2039 ThreadStateTransition::transition(JavaThread::current(), _thread_in_vm, saved_state); | 2058 ThreadStateTransition::transition(JavaThread::current(), _thread_in_vm, saved_state); |
2040 } | 2059 } |
2041 else | 2060 else |
2042 ::tty->print_cr("=============== DEBUG MESSAGE: %s ================\n", msg); | 2061 ::tty->print_cr("=============== DEBUG MESSAGE: %s ================\n", msg); |
2043 assert(false, "error"); | 2062 assert(false, err_msg("DEBUG MESSAGE: %s", msg)); |
2044 } | 2063 } |
2045 | 2064 |
2046 | 2065 |
2047 #ifndef PRODUCT | 2066 #ifndef PRODUCT |
2048 void MacroAssembler::test() { | 2067 void MacroAssembler::test() { |
3228 } | 3247 } |
3229 } | 3248 } |
3230 | 3249 |
3231 | 3250 |
3232 RegisterOrConstant MacroAssembler::argument_offset(RegisterOrConstant arg_slot, | 3251 RegisterOrConstant MacroAssembler::argument_offset(RegisterOrConstant arg_slot, |
3252 Register temp_reg, | |
3233 int extra_slot_offset) { | 3253 int extra_slot_offset) { |
3234 // cf. TemplateTable::prepare_invoke(), if (load_receiver). | 3254 // cf. TemplateTable::prepare_invoke(), if (load_receiver). |
3235 int stackElementSize = Interpreter::stackElementSize; | 3255 int stackElementSize = Interpreter::stackElementSize; |
3236 int offset = extra_slot_offset * stackElementSize; | 3256 int offset = extra_slot_offset * stackElementSize; |
3237 if (arg_slot.is_constant()) { | 3257 if (arg_slot.is_constant()) { |
3238 offset += arg_slot.as_constant() * stackElementSize; | 3258 offset += arg_slot.as_constant() * stackElementSize; |
3239 return offset; | 3259 return offset; |
3240 } else { | 3260 } else { |
3241 Register temp = arg_slot.as_register(); | 3261 assert(temp_reg != noreg, "must specify"); |
3242 sll_ptr(temp, exact_log2(stackElementSize), temp); | 3262 sll_ptr(arg_slot.as_register(), exact_log2(stackElementSize), temp_reg); |
3243 if (offset != 0) | 3263 if (offset != 0) |
3244 add(temp, offset, temp); | 3264 add(temp_reg, offset, temp_reg); |
3245 return temp; | 3265 return temp_reg; |
3246 } | 3266 } |
3247 } | 3267 } |
3248 | 3268 |
3249 | 3269 |
3250 Address MacroAssembler::argument_address(RegisterOrConstant arg_slot, | 3270 Address MacroAssembler::argument_address(RegisterOrConstant arg_slot, |
3271 Register temp_reg, | |
3251 int extra_slot_offset) { | 3272 int extra_slot_offset) { |
3252 return Address(Gargs, argument_offset(arg_slot, extra_slot_offset)); | 3273 return Address(Gargs, argument_offset(arg_slot, temp_reg, extra_slot_offset)); |
3253 } | 3274 } |
3254 | 3275 |
3255 | 3276 |
3256 void MacroAssembler::biased_locking_enter(Register obj_reg, Register mark_reg, | 3277 void MacroAssembler::biased_locking_enter(Register obj_reg, Register mark_reg, |
3257 Register temp_reg, | 3278 Register temp_reg, |
4904 delayed()->lduw(ary1, limit, chr1); // hoisted | 4925 delayed()->lduw(ary1, limit, chr1); // hoisted |
4905 | 4926 |
4906 // Caller should set it: | 4927 // Caller should set it: |
4907 // add(G0, 1, result); // equals | 4928 // add(G0, 1, result); // equals |
4908 } | 4929 } |
4909 |