165 break;
166 }
167 default: ShouldNotReachHere();
168 }
169 }
170 return r;
171 }
172
173 void MacroAssembler::resolve_jobject(Register value, Register tmp) {
174 Label done, not_weak;
175 br_null(value, false, Assembler::pn, done); // Use NULL as-is.
176 delayed()->andcc(value, JNIHandles::weak_tag_mask, G0); // Test for jweak
177 brx(Assembler::zero, true, Assembler::pt, not_weak);
178 delayed()->nop();
179 access_load_at(T_OBJECT, IN_NATIVE | ON_PHANTOM_OOP_REF,
180 Address(value, -JNIHandles::weak_tag_value), value, tmp);
181 verify_oop(value);
182 br (Assembler::always, true, Assembler::pt, done);
183 delayed()->nop();
184 bind(not_weak);
185 access_load_at(T_OBJECT, IN_CONCURRENT_ROOT,
186 Address(value, 0), value, tmp);
187 verify_oop(value);
188 bind(done);
189 }
190
191 void MacroAssembler::null_check(Register reg, int offset) {
192 if (needs_explicit_null_check((intptr_t)offset)) {
193 // provoke OS NULL exception if reg = NULL by
194 // accessing M[reg] w/o changing any registers
195 ld_ptr(reg, 0, G0);
196 }
197 else {
198 // nothing to do, (later) access of M[reg + offset]
199 // will provoke OS NULL exception if reg = NULL
200 }
201 }
202
203 // Ring buffer jumps
204
205
206 void MacroAssembler::jmp2(Register r1, Register r2, const char* file, int line ) {
3385 void MacroAssembler::reserved_stack_check() {
3386 // testing if reserved zone needs to be enabled
3387 Label no_reserved_zone_enabling;
3388
3389 ld_ptr(G2_thread, JavaThread::reserved_stack_activation_offset(), G4_scratch);
3390 cmp_and_brx_short(SP, G4_scratch, Assembler::lessUnsigned, Assembler::pt, no_reserved_zone_enabling);
3391
3392 call_VM_leaf(L0, CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), G2_thread);
3393
3394 AddressLiteral stub(StubRoutines::throw_delayed_StackOverflowError_entry());
3395 jump_to(stub, G4_scratch);
3396 delayed()->restore();
3397
3398 should_not_reach_here();
3399
3400 bind(no_reserved_zone_enabling);
3401 }
3402 // ((OopHandle)result).resolve();
3403 void MacroAssembler::resolve_oop_handle(Register result, Register tmp) {
3404 // OopHandle::resolve is an indirection.
3405 access_load_at(T_OBJECT, IN_CONCURRENT_ROOT,
3406 Address(result, 0), result, tmp);
3407 }
3408
3409 void MacroAssembler::load_mirror(Register mirror, Register method, Register tmp) {
3410 const int mirror_offset = in_bytes(Klass::java_mirror_offset());
3411 ld_ptr(method, in_bytes(Method::const_offset()), mirror);
3412 ld_ptr(mirror, in_bytes(ConstMethod::constants_offset()), mirror);
3413 ld_ptr(mirror, ConstantPool::pool_holder_offset_in_bytes(), mirror);
3414 ld_ptr(mirror, mirror_offset, mirror);
3415 resolve_oop_handle(mirror, tmp);
3416 }
3417
3418 void MacroAssembler::load_klass(Register src_oop, Register klass) {
3419 // The number of bytes in this code is used by
3420 // MachCallDynamicJavaNode::ret_addr_offset()
3421 // if this changes, change that.
3422 if (UseCompressedClassPointers) {
3423 lduw(src_oop, oopDesc::klass_offset_in_bytes(), klass);
3424 decode_klass_not_null(klass);
3425 } else {
3426 ld_ptr(src_oop, oopDesc::klass_offset_in_bytes(), klass);
|
165 break;
166 }
167 default: ShouldNotReachHere();
168 }
169 }
170 return r;
171 }
172
173 void MacroAssembler::resolve_jobject(Register value, Register tmp) {
174 Label done, not_weak;
175 br_null(value, false, Assembler::pn, done); // Use NULL as-is.
176 delayed()->andcc(value, JNIHandles::weak_tag_mask, G0); // Test for jweak
177 brx(Assembler::zero, true, Assembler::pt, not_weak);
178 delayed()->nop();
179 access_load_at(T_OBJECT, IN_NATIVE | ON_PHANTOM_OOP_REF,
180 Address(value, -JNIHandles::weak_tag_value), value, tmp);
181 verify_oop(value);
182 br (Assembler::always, true, Assembler::pt, done);
183 delayed()->nop();
184 bind(not_weak);
185 access_load_at(T_OBJECT, IN_NATIVE, Address(value, 0), value, tmp);
186 verify_oop(value);
187 bind(done);
188 }
189
190 void MacroAssembler::null_check(Register reg, int offset) {
191 if (needs_explicit_null_check((intptr_t)offset)) {
192 // provoke OS NULL exception if reg = NULL by
193 // accessing M[reg] w/o changing any registers
194 ld_ptr(reg, 0, G0);
195 }
196 else {
197 // nothing to do, (later) access of M[reg + offset]
198 // will provoke OS NULL exception if reg = NULL
199 }
200 }
201
202 // Ring buffer jumps
203
204
205 void MacroAssembler::jmp2(Register r1, Register r2, const char* file, int line ) {
3384 void MacroAssembler::reserved_stack_check() {
3385 // testing if reserved zone needs to be enabled
3386 Label no_reserved_zone_enabling;
3387
3388 ld_ptr(G2_thread, JavaThread::reserved_stack_activation_offset(), G4_scratch);
3389 cmp_and_brx_short(SP, G4_scratch, Assembler::lessUnsigned, Assembler::pt, no_reserved_zone_enabling);
3390
3391 call_VM_leaf(L0, CAST_FROM_FN_PTR(address, SharedRuntime::enable_stack_reserved_zone), G2_thread);
3392
3393 AddressLiteral stub(StubRoutines::throw_delayed_StackOverflowError_entry());
3394 jump_to(stub, G4_scratch);
3395 delayed()->restore();
3396
3397 should_not_reach_here();
3398
3399 bind(no_reserved_zone_enabling);
3400 }
3401 // ((OopHandle)result).resolve();
3402 void MacroAssembler::resolve_oop_handle(Register result, Register tmp) {
3403 // OopHandle::resolve is an indirection.
3404 access_load_at(T_OBJECT, IN_NATIVE, Address(result, 0), result, tmp);
3405 }
3406
3407 void MacroAssembler::load_mirror(Register mirror, Register method, Register tmp) {
3408 const int mirror_offset = in_bytes(Klass::java_mirror_offset());
3409 ld_ptr(method, in_bytes(Method::const_offset()), mirror);
3410 ld_ptr(mirror, in_bytes(ConstMethod::constants_offset()), mirror);
3411 ld_ptr(mirror, ConstantPool::pool_holder_offset_in_bytes(), mirror);
3412 ld_ptr(mirror, mirror_offset, mirror);
3413 resolve_oop_handle(mirror, tmp);
3414 }
3415
3416 void MacroAssembler::load_klass(Register src_oop, Register klass) {
3417 // The number of bytes in this code is used by
3418 // MachCallDynamicJavaNode::ret_addr_offset()
3419 // if this changes, change that.
3420 if (UseCompressedClassPointers) {
3421 lduw(src_oop, oopDesc::klass_offset_in_bytes(), klass);
3422 decode_klass_not_null(klass);
3423 } else {
3424 ld_ptr(src_oop, oopDesc::klass_offset_in_bytes(), klass);
|