< prev index next >

src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp

Print this page

 75   const Register return_pc = R20;
 76   mflr(return_pc);
 77 
 78   // Make sure there is enough stack space for this method's activation.
 79   assert(bang_size_in_bytes >= frame_size_in_bytes, "stack bang size incorrect");
 80   generate_stack_overflow_check(bang_size_in_bytes);
 81 
 82   std(return_pc, _abi0(lr), R1_SP);     // SP->lr = return_pc
 83   push_frame(frame_size_in_bytes, R0); // SP -= frame_size_in_bytes
 84 
 85   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
 86   bs->nmethod_entry_barrier(this, R20);
 87 }
 88 
 89 
 90 void C1_MacroAssembler::verified_entry(bool breakAtEntry) {
 91   if (breakAtEntry) illtrap();
 92   // build frame
 93 }
 94 
 95 
 96 void C1_MacroAssembler::lock_object(Register Rmark, Register Roop, Register Rbox, Register Rscratch, Label& slow_case) {
 97   assert_different_registers(Rmark, Roop, Rbox, Rscratch);
 98 
 99   Label done, cas_failed, slow_int;
100 
101   // The following move must be the first instruction of emitted since debug
102   // information may be generated for it.
103   // Load object header.
104   ld(Rmark, oopDesc::mark_offset_in_bytes(), Roop);
105 
106   verify_oop(Roop, FILE_AND_LINE);
107 
108   // Save object being locked into the BasicObjectLock...
109   std(Roop, BasicObjectLock::obj_offset_in_bytes(), Rbox);
110 
111   if (DiagnoseSyncOnValueBasedClasses != 0) {
112     load_klass(Rscratch, Roop);
113     lwz(Rscratch, in_bytes(Klass::access_flags_offset()), Rscratch);
114     testbitdi(CCR0, R0, Rscratch, exact_log2(JVM_ACC_IS_VALUE_BASED_CLASS));
115     bne(CCR0, slow_int);
116   }
117 
118   // ... and mark it unlocked.
119   ori(Rmark, Rmark, markWord::unlocked_value);
120 
121   // Save unlocked object header into the displaced header location on the stack.
122   std(Rmark, BasicLock::displaced_header_offset_in_bytes(), Rbox);
123 
124   // Compare object markWord with Rmark and if equal exchange Rscratch with object markWord.
125   assert(oopDesc::mark_offset_in_bytes() == 0, "cas must take a zero displacement");
126   cmpxchgd(/*flag=*/CCR0,
127            /*current_value=*/Rscratch,
128            /*compare_value=*/Rmark,
129            /*exchange_value=*/Rbox,
130            /*where=*/Roop/*+0==mark_offset_in_bytes*/,
131            MacroAssembler::MemBarRel | MacroAssembler::MemBarAcq,
132            MacroAssembler::cmpxchgx_hint_acquire_lock(),
133            noreg,
134            &cas_failed,
135            /*check without membar and ldarx first*/true);
136   // If compare/exchange succeeded we found an unlocked object and we now have locked it
137   // hence we are done.
138   b(done);
139 
140   bind(slow_int);
141   b(slow_case); // far
142 
143   bind(cas_failed);
144   // We did not find an unlocked object so see if this is a recursive case.
145   sub(Rscratch, Rscratch, R1_SP);
146   load_const_optimized(R0, (~(os::vm_page_size()-1) | markWord::lock_mask_in_place));
147   and_(R0/*==0?*/, Rscratch, R0);
148   std(R0/*==0, perhaps*/, BasicLock::displaced_header_offset_in_bytes(), Rbox);
149   bne(CCR0, slow_int);
150 
151   bind(done);
152 }
153 
154 
155 void C1_MacroAssembler::unlock_object(Register Rmark, Register Roop, Register Rbox, Label& slow_case) {
156   assert_different_registers(Rmark, Roop, Rbox);
157 
158   Label slow_int, done;
159 
160   Address mark_addr(Roop, oopDesc::mark_offset_in_bytes());
161   assert(mark_addr.disp() == 0, "cas must take a zero displacement");
162 
163   // Test first it it is a fast recursive unlock.
164   ld(Rmark, BasicLock::displaced_header_offset_in_bytes(), Rbox);
165   cmpdi(CCR0, Rmark, 0);
166   beq(CCR0, done);
167 
168   // Load object.
169   ld(Roop, BasicObjectLock::obj_offset_in_bytes(), Rbox);
170   verify_oop(Roop, FILE_AND_LINE);
171 
172   // Check if it is still a light weight lock, this is is true if we see
173   // the stack address of the basicLock in the markWord of the object.
174   cmpxchgd(/*flag=*/CCR0,
175            /*current_value=*/R0,
176            /*compare_value=*/Rbox,
177            /*exchange_value=*/Rmark,
178            /*where=*/Roop,
179            MacroAssembler::MemBarRel,
180            MacroAssembler::cmpxchgx_hint_release_lock(),
181            noreg,
182            &slow_int);
183   b(done);
184   bind(slow_int);
185   b(slow_case); // far
186 
187   // Done
188   bind(done);
189 }
190 
191 
192 void C1_MacroAssembler::try_allocate(
193   Register obj,                        // result: pointer to object after successful allocation
194   Register var_size_in_bytes,          // object size in bytes if unknown at compile time; invalid otherwise
195   int      con_size_in_bytes,          // object size in bytes if   known at compile time
196   Register t1,                         // temp register, must be global register for incr_allocated_bytes
197   Register t2,                         // temp register
198   Label&   slow_case                   // continuation point if fast allocation fails
199 ) {
200   if (UseTLAB) {
201     tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, slow_case);
202   } else {
203     b(slow_case);
204   }
205 }
206 
207 
208 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) {
209   assert_different_registers(obj, klass, len, t1, t2);
210   load_const_optimized(t1, (intx)markWord::prototype().value());
211   std(t1, oopDesc::mark_offset_in_bytes(), obj);

 75   const Register return_pc = R20;
 76   mflr(return_pc);
 77 
 78   // Make sure there is enough stack space for this method's activation.
 79   assert(bang_size_in_bytes >= frame_size_in_bytes, "stack bang size incorrect");
 80   generate_stack_overflow_check(bang_size_in_bytes);
 81 
 82   std(return_pc, _abi0(lr), R1_SP);     // SP->lr = return_pc
 83   push_frame(frame_size_in_bytes, R0); // SP -= frame_size_in_bytes
 84 
 85   BarrierSetAssembler* bs = BarrierSet::barrier_set()->barrier_set_assembler();
 86   bs->nmethod_entry_barrier(this, R20);
 87 }
 88 
 89 
 90 void C1_MacroAssembler::verified_entry(bool breakAtEntry) {
 91   if (breakAtEntry) illtrap();
 92   // build frame
 93 }
 94 

































































































 95 void C1_MacroAssembler::try_allocate(
 96   Register obj,                        // result: pointer to object after successful allocation
 97   Register var_size_in_bytes,          // object size in bytes if unknown at compile time; invalid otherwise
 98   int      con_size_in_bytes,          // object size in bytes if   known at compile time
 99   Register t1,                         // temp register, must be global register for incr_allocated_bytes
100   Register t2,                         // temp register
101   Label&   slow_case                   // continuation point if fast allocation fails
102 ) {
103   if (UseTLAB) {
104     tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, t1, slow_case);
105   } else {
106     b(slow_case);
107   }
108 }
109 
110 
111 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register t1, Register t2) {
112   assert_different_registers(obj, klass, len, t1, t2);
113   load_const_optimized(t1, (intx)markWord::prototype().value());
114   std(t1, oopDesc::mark_offset_in_bytes(), obj);
< prev index next >