< prev index next >

src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.cpp

Print this page

150     bind(done);
151   }
152 
153   decrement(Address(xthread, JavaThread::held_monitor_count_offset()));
154 }
155 
156 // Defines obj, preserves var_size_in_bytes
157 void C1_MacroAssembler::try_allocate(Register obj, Register var_size_in_bytes, int con_size_in_bytes, Register tmp1, Register tmp2, Label& slow_case) {
158   if (UseTLAB) {
159     tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, tmp1, tmp2, slow_case, /* is_far */ true);
160   } else {
161     j(slow_case);
162   }
163 }
164 
165 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register tmp1, Register tmp2) {
166   assert_different_registers(obj, klass, len, tmp1, tmp2);
167   // This assumes that all prototype bits fitr in an int32_t
168   mv(tmp1, (int32_t)(intptr_t)markWord::prototype().value());
169   sd(tmp1, Address(obj, oopDesc::mark_offset_in_bytes()));
170 
171   if (UseCompressedClassPointers) { // Take care not to kill klass
172     encode_klass_not_null(tmp1, klass, tmp2);
173     sw(tmp1, Address(obj, oopDesc::klass_offset_in_bytes()));
174   } else {
175     sd(klass, Address(obj, oopDesc::klass_offset_in_bytes()));
176   }
177 
178   if (len->is_valid()) {
179     sw(len, Address(obj, arrayOopDesc::length_offset_in_bytes()));
180     int base_offset = arrayOopDesc::length_offset_in_bytes() + BytesPerInt;
181     if (!is_aligned(base_offset, BytesPerWord)) {
182       assert(is_aligned(base_offset, BytesPerInt), "must be 4-byte aligned");
183       // Clear gap/first 4 bytes following the length field.
184       sw(zr, Address(obj, base_offset));
185     }
186   } else if (UseCompressedClassPointers) {
187     store_klass_gap(obj, zr);
188   }
189 }
190 

150     bind(done);
151   }
152 
153   decrement(Address(xthread, JavaThread::held_monitor_count_offset()));
154 }
155 
156 // Defines obj, preserves var_size_in_bytes
157 void C1_MacroAssembler::try_allocate(Register obj, Register var_size_in_bytes, int con_size_in_bytes, Register tmp1, Register tmp2, Label& slow_case) {
158   if (UseTLAB) {
159     tlab_allocate(obj, var_size_in_bytes, con_size_in_bytes, tmp1, tmp2, slow_case, /* is_far */ true);
160   } else {
161     j(slow_case);
162   }
163 }
164 
165 void C1_MacroAssembler::initialize_header(Register obj, Register klass, Register len, Register tmp1, Register tmp2) {
166   assert_different_registers(obj, klass, len, tmp1, tmp2);
167   // This assumes that all prototype bits fitr in an int32_t
168   mv(tmp1, (int32_t)(intptr_t)markWord::prototype().value());
169   sd(tmp1, Address(obj, oopDesc::mark_offset_in_bytes()));
170 // Todo UseCompactObjectHeaders
171   if (UseCompressedClassPointers) { // Take care not to kill klass
172     encode_klass_not_null(tmp1, klass, tmp2);
173     sw(tmp1, Address(obj, oopDesc::klass_offset_in_bytes()));
174   } else {
175     sd(klass, Address(obj, oopDesc::klass_offset_in_bytes()));
176   }
177 
178   if (len->is_valid()) {
179     sw(len, Address(obj, arrayOopDesc::length_offset_in_bytes()));
180     int base_offset = arrayOopDesc::length_offset_in_bytes() + BytesPerInt;
181     if (!is_aligned(base_offset, BytesPerWord)) {
182       assert(is_aligned(base_offset, BytesPerInt), "must be 4-byte aligned");
183       // Clear gap/first 4 bytes following the length field.
184       sw(zr, Address(obj, base_offset));
185     }
186   } else if (UseCompressedClassPointers) {
187     store_klass_gap(obj, zr);
188   }
189 }
190 
< prev index next >