comparison src/cpu/sparc/vm/c1_Runtime1_sparc.cpp @ 13086:096c224171c4

Merge with http://hg.openjdk.java.net/hsx/hsx25/hotspot/
author Doug Simon <doug.simon@oracle.com>
date Wed, 20 Nov 2013 00:10:38 +0100
parents 252d541466ea
children de6a9e811145
comparison
equal deleted inserted replaced
12782:92b7ec34ddfa 13086:096c224171c4
35 #include "runtime/sharedRuntime.hpp" 35 #include "runtime/sharedRuntime.hpp"
36 #include "runtime/signature.hpp" 36 #include "runtime/signature.hpp"
37 #include "runtime/vframeArray.hpp" 37 #include "runtime/vframeArray.hpp"
38 #include "utilities/macros.hpp" 38 #include "utilities/macros.hpp"
39 #include "vmreg_sparc.inline.hpp" 39 #include "vmreg_sparc.inline.hpp"
40 #if INCLUDE_ALL_GCS
41 #include "gc_implementation/g1/g1SATBCardTableModRefBS.hpp"
42 #endif
40 43
41 // Implementation of StubAssembler 44 // Implementation of StubAssembler
42 45
43 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry_point, int number_of_arguments) { 46 int StubAssembler::call_RT(Register oop_result1, Register metadata_result, address entry_point, int number_of_arguments) {
44 // for sparc changing the number of arguments doesn't change 47 // for sparc changing the number of arguments doesn't change
399 __ save_frame(0); 402 __ save_frame(0);
400 403
401 if (id == fast_new_instance_init_check_id) { 404 if (id == fast_new_instance_init_check_id) {
402 // make sure the klass is initialized 405 // make sure the klass is initialized
403 __ ldub(G5_klass, in_bytes(InstanceKlass::init_state_offset()), G3_t1); 406 __ ldub(G5_klass, in_bytes(InstanceKlass::init_state_offset()), G3_t1);
404 __ cmp_and_br_short(G3_t1, InstanceKlass::fully_initialized, Assembler::notEqual, Assembler::pn, slow_path); 407 __ cmp(G3_t1, InstanceKlass::fully_initialized);
408 __ br(Assembler::notEqual, false, Assembler::pn, slow_path);
409 __ delayed()->nop();
405 } 410 }
406 #ifdef ASSERT 411 #ifdef ASSERT
407 // assert object can be fast path allocated 412 // assert object can be fast path allocated
408 { 413 {
409 Label ok, not_ok; 414 Label ok, not_ok;
510 Register O1_t2 = O1; 515 Register O1_t2 = O1;
511 assert_different_registers(G5_klass, G4_length, G1_arr_size, G3_t1, O1_t2); 516 assert_different_registers(G5_klass, G4_length, G1_arr_size, G3_t1, O1_t2);
512 517
513 // check that array length is small enough for fast path 518 // check that array length is small enough for fast path
514 __ set(C1_MacroAssembler::max_array_allocation_length, G3_t1); 519 __ set(C1_MacroAssembler::max_array_allocation_length, G3_t1);
515 __ cmp_and_br_short(G4_length, G3_t1, Assembler::greaterUnsigned, Assembler::pn, slow_path); 520 __ cmp(G4_length, G3_t1);
521 __ br(Assembler::greaterUnsigned, false, Assembler::pn, slow_path);
522 __ delayed()->nop();
516 523
517 // if we got here then the TLAB allocation failed, so try 524 // if we got here then the TLAB allocation failed, so try
518 // refilling the TLAB or allocating directly from eden. 525 // refilling the TLAB or allocating directly from eden.
519 Label retry_tlab, try_eden; 526 Label retry_tlab, try_eden;
520 __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves G4_length and G5_klass 527 __ tlab_refill(retry_tlab, try_eden, slow_path); // preserves G4_length and G5_klass
910 Register cardtable = G5; 917 Register cardtable = G5;
911 Register tmp = G1_scratch; 918 Register tmp = G1_scratch;
912 Register tmp2 = G3_scratch; 919 Register tmp2 = G3_scratch;
913 jbyte* byte_map_base = ((CardTableModRefBS*)bs)->byte_map_base; 920 jbyte* byte_map_base = ((CardTableModRefBS*)bs)->byte_map_base;
914 921
915 Label not_already_dirty, restart, refill; 922 Label not_already_dirty, restart, refill, young_card;
916 923
917 #ifdef _LP64 924 #ifdef _LP64
918 __ srlx(addr, CardTableModRefBS::card_shift, addr); 925 __ srlx(addr, CardTableModRefBS::card_shift, addr);
919 #else 926 #else
920 __ srl(addr, CardTableModRefBS::card_shift, addr); 927 __ srl(addr, CardTableModRefBS::card_shift, addr);
922 929
923 AddressLiteral rs(byte_map_base); 930 AddressLiteral rs(byte_map_base);
924 __ set(rs, cardtable); // cardtable := <card table base> 931 __ set(rs, cardtable); // cardtable := <card table base>
925 __ ldub(addr, cardtable, tmp); // tmp := [addr + cardtable] 932 __ ldub(addr, cardtable, tmp); // tmp := [addr + cardtable]
926 933
934 __ cmp_and_br_short(tmp, G1SATBCardTableModRefBS::g1_young_card_val(), Assembler::equal, Assembler::pt, young_card);
935
936 __ membar(Assembler::Membar_mask_bits(Assembler::StoreLoad));
937 __ ldub(addr, cardtable, tmp); // tmp := [addr + cardtable]
938
927 assert(CardTableModRefBS::dirty_card_val() == 0, "otherwise check this code"); 939 assert(CardTableModRefBS::dirty_card_val() == 0, "otherwise check this code");
928 __ cmp_and_br_short(tmp, G0, Assembler::notEqual, Assembler::pt, not_already_dirty); 940 __ cmp_and_br_short(tmp, G0, Assembler::notEqual, Assembler::pt, not_already_dirty);
929 941
942 __ bind(young_card);
930 // We didn't take the branch, so we're already dirty: return. 943 // We didn't take the branch, so we're already dirty: return.
931 // Use return-from-leaf 944 // Use return-from-leaf
932 __ retl(); 945 __ retl();
933 __ delayed()->nop(); 946 __ delayed()->nop();
934 947
1065 default: ShouldNotReachHere(); 1078 default: ShouldNotReachHere();
1066 } 1079 }
1067 1080
1068 __ verify_not_null_oop(Oexception); 1081 __ verify_not_null_oop(Oexception);
1069 1082
1083 #ifdef ASSERT
1084 // check that fields in JavaThread for exception oop and issuing pc are
1085 // empty before writing to them
1086 Label oop_empty;
1087 Register scratch = I7; // We can use I7 here because it's overwritten later anyway.
1088 __ ld_ptr(Address(G2_thread, JavaThread::exception_oop_offset()), scratch);
1089 __ br_null(scratch, false, Assembler::pt, oop_empty);
1090 __ delayed()->nop();
1091 __ stop("exception oop already set");
1092 __ bind(oop_empty);
1093
1094 Label pc_empty;
1095 __ ld_ptr(Address(G2_thread, JavaThread::exception_pc_offset()), scratch);
1096 __ br_null(scratch, false, Assembler::pt, pc_empty);
1097 __ delayed()->nop();
1098 __ stop("exception pc already set");
1099 __ bind(pc_empty);
1100 #endif
1101
1070 // save the exception and issuing pc in the thread 1102 // save the exception and issuing pc in the thread
1071 __ st_ptr(Oexception, G2_thread, in_bytes(JavaThread::exception_oop_offset())); 1103 __ st_ptr(Oexception, G2_thread, in_bytes(JavaThread::exception_oop_offset()));
1072 __ st_ptr(Oissuing_pc, G2_thread, in_bytes(JavaThread::exception_pc_offset())); 1104 __ st_ptr(Oissuing_pc, G2_thread, in_bytes(JavaThread::exception_pc_offset()));
1073 1105
1074 // use the throwing pc as the return address to lookup (has bci & oop map) 1106 // use the throwing pc as the return address to lookup (has bci & oop map)