< prev index next >

src/hotspot/cpu/s390/c1_MacroAssembler_s390.cpp

Print this page

 61   z_br(Z_R1_scratch);
 62   align(CodeEntryAlignment);
 63   bind(ic_hit);
 64 }
 65 
 66 void C1_MacroAssembler::explicit_null_check(Register base) {
 67   ShouldNotCallThis(); // unused
 68 }
 69 
 70 void C1_MacroAssembler::build_frame(int frame_size_in_bytes, int bang_size_in_bytes) {
 71   assert(bang_size_in_bytes >= frame_size_in_bytes, "stack bang size incorrect");
 72   generate_stack_overflow_check(bang_size_in_bytes);
 73   save_return_pc();
 74   push_frame(frame_size_in_bytes);
 75 }
 76 
 77 void C1_MacroAssembler::verified_entry(bool breakAtEntry) {
 78   if (breakAtEntry) z_illtrap(0xC1);
 79 }
 80 
 81 void C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr, Label& slow_case) {
 82   const int hdr_offset = oopDesc::mark_offset_in_bytes();
 83   assert_different_registers(hdr, obj, disp_hdr);
 84   NearLabel done;
 85 
 86   verify_oop(obj, FILE_AND_LINE);
 87 
 88   // Load object header.
 89   z_lg(hdr, Address(obj, hdr_offset));
 90 
 91   // Save object being locked into the BasicObjectLock...
 92   z_stg(obj, Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes()));
 93 
 94   if (DiagnoseSyncOnValueBasedClasses != 0) {
 95     load_klass(Z_R1_scratch, obj);
 96     testbit(Address(Z_R1_scratch, Klass::access_flags_offset()), exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
 97     z_btrue(slow_case);
 98   }
 99 
100   // and mark it as unlocked.
101   z_oill(hdr, markWord::unlocked_value);
102   // Save unlocked object header into the displaced header location on the stack.
103   z_stg(hdr, Address(disp_hdr, (intptr_t)0));
104   // Test if object header is still the same (i.e. unlocked), and if so, store the
105   // displaced header address in the object header. If it is not the same, get the
106   // object header instead.
107   z_csg(hdr, disp_hdr, hdr_offset, obj);
108   // If the object header was the same, we're done.
109   branch_optimized(Assembler::bcondEqual, done);
110   // If the object header was not the same, it is now in the hdr register.
111   // => Test if it is a stack pointer into the same stack (recursive locking), i.e.:
112   //
113   // 1) (hdr & markWord::lock_mask_in_place) == 0
114   // 2) rsp <= hdr
115   // 3) hdr <= rsp + page_size
116   //
117   // These 3 tests can be done by evaluating the following expression:
118   //
119   // (hdr - Z_SP) & (~(page_size-1) | markWord::lock_mask_in_place)
120   //
121   // assuming both the stack pointer and page_size have their least
122   // significant 2 bits cleared and page_size is a power of 2
123   z_sgr(hdr, Z_SP);
124 
125   load_const_optimized(Z_R0_scratch, (~(os::vm_page_size()-1) | markWord::lock_mask_in_place));
126   z_ngr(hdr, Z_R0_scratch); // AND sets CC (result eq/ne 0).
127   // For recursive locking, the result is zero. => Save it in the displaced header
128   // location (NULL in the displaced hdr location indicates recursive locking).
129   z_stg(hdr, Address(disp_hdr, (intptr_t)0));
130   // Otherwise we don't care about the result and handle locking via runtime call.
131   branch_optimized(Assembler::bcondNotZero, slow_case);
132   // done
133   bind(done);
134 }
135 
136 void C1_MacroAssembler::unlock_object(Register hdr, Register obj, Register disp_hdr, Label& slow_case) {
137   const int aligned_mask = BytesPerWord -1;
138   const int hdr_offset = oopDesc::mark_offset_in_bytes();
139   assert_different_registers(hdr, obj, disp_hdr);
140   NearLabel done;
141 
142   // Load displaced header.
143   z_ltg(hdr, Address(disp_hdr, (intptr_t)0));
144   // If the loaded hdr is NULL we had recursive locking, and we are done.
145   z_bre(done);
146   // Load object.
147   z_lg(obj, Address(disp_hdr, BasicObjectLock::obj_offset_in_bytes()));
148   verify_oop(obj, FILE_AND_LINE);
149   // Test if object header is pointing to the displaced header, and if so, restore
150   // the displaced header in the object. If the object header is not pointing to
151   // the displaced header, get the object header instead.
152   z_csg(disp_hdr, hdr, hdr_offset, obj);
153   // If the object header was not pointing to the displaced header,
154   // we do unlocking via runtime call.
155   branch_optimized(Assembler::bcondNotEqual, slow_case);
156   // done
157   bind(done);
158 }
159 
160 void C1_MacroAssembler::try_allocate(
161   Register obj,                        // result: Pointer to object after successful allocation.
162   Register var_size_in_bytes,          // Object size in bytes if unknown at compile time; invalid otherwise.
163   int      con_size_in_bytes,          // Object size in bytes if   known at compile time.
164   Register t1,                         // Temp register: Must be global register for incr_allocated_bytes.
165   Label&   slow_case                   // Continuation point if fast allocation fails.
166 ) {
167   if (UseTLAB) {
168     tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, slow_case);
169   } else {
170     // Allocation in shared Eden not implemented, because sapjvm allocation trace does not allow it.
171     z_brul(slow_case);
172   }
173 }
174 
175 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register Rzero, Register t1) {
176   assert_different_registers(obj, klass, len, t1, Rzero);
177   // This assumes that all prototype bits fit in an int32_t.
178   load_const_optimized(t1, (intx)markWord::prototype().value());
179   z_stg(t1, Address(obj, oopDesc::mark_offset_in_bytes()));

 61   z_br(Z_R1_scratch);
 62   align(CodeEntryAlignment);
 63   bind(ic_hit);
 64 }
 65 
 66 void C1_MacroAssembler::explicit_null_check(Register base) {
 67   ShouldNotCallThis(); // unused
 68 }
 69 
 70 void C1_MacroAssembler::build_frame(int frame_size_in_bytes, int bang_size_in_bytes) {
 71   assert(bang_size_in_bytes >= frame_size_in_bytes, "stack bang size incorrect");
 72   generate_stack_overflow_check(bang_size_in_bytes);
 73   save_return_pc();
 74   push_frame(frame_size_in_bytes);
 75 }
 76 
 77 void C1_MacroAssembler::verified_entry(bool breakAtEntry) {
 78   if (breakAtEntry) z_illtrap(0xC1);
 79 }
 80 















































































 81 void C1_MacroAssembler::try_allocate(
 82   Register obj,                        // result: Pointer to object after successful allocation.
 83   Register var_size_in_bytes,          // Object size in bytes if unknown at compile time; invalid otherwise.
 84   int      con_size_in_bytes,          // Object size in bytes if   known at compile time.
 85   Register t1,                         // Temp register: Must be global register for incr_allocated_bytes.
 86   Label&   slow_case                   // Continuation point if fast allocation fails.
 87 ) {
 88   if (UseTLAB) {
 89     tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, slow_case);
 90   } else {
 91     // Allocation in shared Eden not implemented, because sapjvm allocation trace does not allow it.
 92     z_brul(slow_case);
 93   }
 94 }
 95 
 96 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register Rzero, Register t1) {
 97   assert_different_registers(obj, klass, len, t1, Rzero);
 98   // This assumes that all prototype bits fit in an int32_t.
 99   load_const_optimized(t1, (intx)markWord::prototype().value());
100   z_stg(t1, Address(obj, oopDesc::mark_offset_in_bytes()));
< prev index next >