8239492: [x86] Turn MacroAssembler::verify_oop into macro recording file and line
Reviewed-by: rrich, vlivanov, pliden
This commit is contained in:
parent
8167fe956f
commit
649a4d0613
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -304,7 +304,7 @@ void ZBarrierSetAssembler::generate_c1_load_barrier_stub(LIR_Assembler* ce,
|
|||||||
__ addptr(rsp, 2 * BytesPerWord);
|
__ addptr(rsp, 2 * BytesPerWord);
|
||||||
|
|
||||||
// Verify result
|
// Verify result
|
||||||
__ verify_oop(rax, "Bad oop");
|
__ verify_oop(rax);
|
||||||
|
|
||||||
// Move result into place
|
// Move result into place
|
||||||
if (ref != rax) {
|
if (ref != rax) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2018, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -51,7 +51,7 @@ void InterpreterMacroAssembler::jump_to_entry(address entry) {
|
|||||||
void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
|
void InterpreterMacroAssembler::profile_obj_type(Register obj, const Address& mdo_addr) {
|
||||||
Label update, next, none;
|
Label update, next, none;
|
||||||
|
|
||||||
verify_oop(obj);
|
interp_verify_oop(obj, atos);
|
||||||
|
|
||||||
testptr(obj, obj);
|
testptr(obj, obj);
|
||||||
jccb(Assembler::notZero, update);
|
jccb(Assembler::notZero, update);
|
||||||
@ -349,7 +349,7 @@ void InterpreterMacroAssembler::load_earlyret_value(TosState state) {
|
|||||||
switch (state) {
|
switch (state) {
|
||||||
case atos: movptr(rax, oop_addr);
|
case atos: movptr(rax, oop_addr);
|
||||||
movptr(oop_addr, (int32_t)NULL_WORD);
|
movptr(oop_addr, (int32_t)NULL_WORD);
|
||||||
verify_oop(rax, state); break;
|
interp_verify_oop(rax, state); break;
|
||||||
case ltos: movptr(rax, val_addr); break;
|
case ltos: movptr(rax, val_addr); break;
|
||||||
case btos: // fall through
|
case btos: // fall through
|
||||||
case ztos: // fall through
|
case ztos: // fall through
|
||||||
@ -370,7 +370,7 @@ void InterpreterMacroAssembler::load_earlyret_value(TosState state) {
|
|||||||
switch (state) {
|
switch (state) {
|
||||||
case atos: movptr(rax, oop_addr);
|
case atos: movptr(rax, oop_addr);
|
||||||
movptr(oop_addr, NULL_WORD);
|
movptr(oop_addr, NULL_WORD);
|
||||||
verify_oop(rax, state); break;
|
interp_verify_oop(rax, state); break;
|
||||||
case ltos:
|
case ltos:
|
||||||
movl(rdx, val_addr1); // fall through
|
movl(rdx, val_addr1); // fall through
|
||||||
case btos: // fall through
|
case btos: // fall through
|
||||||
@ -656,11 +656,11 @@ void InterpreterMacroAssembler::pop(TosState state) {
|
|||||||
case vtos: /* nothing to do */ break;
|
case vtos: /* nothing to do */ break;
|
||||||
default: ShouldNotReachHere();
|
default: ShouldNotReachHere();
|
||||||
}
|
}
|
||||||
verify_oop(rax, state);
|
interp_verify_oop(rax, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
void InterpreterMacroAssembler::push(TosState state) {
|
void InterpreterMacroAssembler::push(TosState state) {
|
||||||
verify_oop(rax, state);
|
interp_verify_oop(rax, state);
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case atos: push_ptr(); break;
|
case atos: push_ptr(); break;
|
||||||
case btos:
|
case btos:
|
||||||
@ -722,7 +722,7 @@ void InterpreterMacroAssembler::pop(TosState state) {
|
|||||||
case vtos: /* nothing to do */ break;
|
case vtos: /* nothing to do */ break;
|
||||||
default : ShouldNotReachHere();
|
default : ShouldNotReachHere();
|
||||||
}
|
}
|
||||||
verify_oop(rax, state);
|
interp_verify_oop(rax, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -745,7 +745,7 @@ void InterpreterMacroAssembler::push_d() {
|
|||||||
|
|
||||||
|
|
||||||
void InterpreterMacroAssembler::push(TosState state) {
|
void InterpreterMacroAssembler::push(TosState state) {
|
||||||
verify_oop(rax, state);
|
interp_verify_oop(rax, state);
|
||||||
switch (state) {
|
switch (state) {
|
||||||
case atos: push_ptr(rax); break;
|
case atos: push_ptr(rax); break;
|
||||||
case btos: // fall through
|
case btos: // fall through
|
||||||
@ -844,7 +844,7 @@ void InterpreterMacroAssembler::dispatch_base(TosState state,
|
|||||||
bind(L);
|
bind(L);
|
||||||
}
|
}
|
||||||
if (verifyoop) {
|
if (verifyoop) {
|
||||||
verify_oop(rax, state);
|
interp_verify_oop(rax, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
address* const safepoint_table = Interpreter::safept_table(state);
|
address* const safepoint_table = Interpreter::safept_table(state);
|
||||||
@ -1959,9 +1959,9 @@ void InterpreterMacroAssembler::profile_switch_case(Register index,
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
void InterpreterMacroAssembler::verify_oop(Register reg, TosState state) {
|
void InterpreterMacroAssembler::_interp_verify_oop(Register reg, TosState state, const char* file, int line) {
|
||||||
if (state == atos) {
|
if (state == atos) {
|
||||||
MacroAssembler::verify_oop(reg);
|
MacroAssembler::_verify_oop(reg, "broken oop", file, line);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -280,7 +280,8 @@ class InterpreterMacroAssembler: public MacroAssembler {
|
|||||||
|
|
||||||
// Debugging
|
// Debugging
|
||||||
// only if +VerifyOops && state == atos
|
// only if +VerifyOops && state == atos
|
||||||
void verify_oop(Register reg, TosState state = atos);
|
#define interp_verify_oop(reg, state) _interp_verify_oop(reg, state, __FILE__, __LINE__);
|
||||||
|
void _interp_verify_oop(Register reg, TosState state, const char* file, int line);
|
||||||
// only if +VerifyFPU && (state == ftos || state == dtos)
|
// only if +VerifyFPU && (state == ftos || state == dtos)
|
||||||
void verify_FPU(int stack_depth, TosState state = ftos);
|
void verify_FPU(int stack_depth, TosState state = ftos);
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -2447,7 +2447,7 @@ void MacroAssembler::super_call_VM_leaf(address entry_point, Register arg_0, Reg
|
|||||||
void MacroAssembler::get_vm_result(Register oop_result, Register java_thread) {
|
void MacroAssembler::get_vm_result(Register oop_result, Register java_thread) {
|
||||||
movptr(oop_result, Address(java_thread, JavaThread::vm_result_offset()));
|
movptr(oop_result, Address(java_thread, JavaThread::vm_result_offset()));
|
||||||
movptr(Address(java_thread, JavaThread::vm_result_offset()), NULL_WORD);
|
movptr(Address(java_thread, JavaThread::vm_result_offset()), NULL_WORD);
|
||||||
verify_oop(oop_result, "broken oop in call_VM_base");
|
verify_oop_msg(oop_result, "broken oop in call_VM_base");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroAssembler::get_vm_result_2(Register metadata_result, Register java_thread) {
|
void MacroAssembler::get_vm_result_2(Register metadata_result, Register java_thread) {
|
||||||
@ -4638,7 +4638,7 @@ void MacroAssembler::cmov32(Condition cc, Register dst, Register src) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroAssembler::verify_oop(Register reg, const char* s) {
|
void MacroAssembler::_verify_oop(Register reg, const char* s, const char* file, int line) {
|
||||||
if (!VerifyOops) return;
|
if (!VerifyOops) return;
|
||||||
|
|
||||||
// Pass register number to verify_oop_subroutine
|
// Pass register number to verify_oop_subroutine
|
||||||
@ -4646,7 +4646,7 @@ void MacroAssembler::verify_oop(Register reg, const char* s) {
|
|||||||
{
|
{
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
stringStream ss;
|
stringStream ss;
|
||||||
ss.print("verify_oop: %s: %s", reg->name(), s);
|
ss.print("verify_oop: %s: %s (%s:%d)", reg->name(), s, file, line);
|
||||||
b = code_string(ss.as_string());
|
b = code_string(ss.as_string());
|
||||||
}
|
}
|
||||||
BLOCK_COMMENT("verify_oop {");
|
BLOCK_COMMENT("verify_oop {");
|
||||||
@ -4728,7 +4728,7 @@ Address MacroAssembler::argument_address(RegisterOrConstant arg_slot,
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void MacroAssembler::verify_oop_addr(Address addr, const char* s) {
|
void MacroAssembler::_verify_oop_addr(Address addr, const char* s, const char* file, int line) {
|
||||||
if (!VerifyOops) return;
|
if (!VerifyOops) return;
|
||||||
|
|
||||||
// Address adjust(addr.base(), addr.index(), addr.scale(), addr.disp() + BytesPerWord);
|
// Address adjust(addr.base(), addr.index(), addr.scale(), addr.disp() + BytesPerWord);
|
||||||
@ -4737,7 +4737,7 @@ void MacroAssembler::verify_oop_addr(Address addr, const char* s) {
|
|||||||
{
|
{
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
stringStream ss;
|
stringStream ss;
|
||||||
ss.print("verify_oop_addr: %s", s);
|
ss.print("verify_oop_addr: %s (%s:%d)", s, file, line);
|
||||||
b = code_string(ss.as_string());
|
b = code_string(ss.as_string());
|
||||||
}
|
}
|
||||||
#ifdef _LP64
|
#ifdef _LP64
|
||||||
@ -5333,7 +5333,7 @@ void MacroAssembler::encode_heap_oop(Register r) {
|
|||||||
#ifdef ASSERT
|
#ifdef ASSERT
|
||||||
verify_heapbase("MacroAssembler::encode_heap_oop: heap base corrupted?");
|
verify_heapbase("MacroAssembler::encode_heap_oop: heap base corrupted?");
|
||||||
#endif
|
#endif
|
||||||
verify_oop(r, "broken oop in encode_heap_oop");
|
verify_oop_msg(r, "broken oop in encode_heap_oop");
|
||||||
if (CompressedOops::base() == NULL) {
|
if (CompressedOops::base() == NULL) {
|
||||||
if (CompressedOops::shift() != 0) {
|
if (CompressedOops::shift() != 0) {
|
||||||
assert (LogMinObjAlignmentInBytes == CompressedOops::shift(), "decode alg wrong");
|
assert (LogMinObjAlignmentInBytes == CompressedOops::shift(), "decode alg wrong");
|
||||||
@ -5358,7 +5358,7 @@ void MacroAssembler::encode_heap_oop_not_null(Register r) {
|
|||||||
bind(ok);
|
bind(ok);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
verify_oop(r, "broken oop in encode_heap_oop_not_null");
|
verify_oop_msg(r, "broken oop in encode_heap_oop_not_null");
|
||||||
if (CompressedOops::base() != NULL) {
|
if (CompressedOops::base() != NULL) {
|
||||||
subq(r, r12_heapbase);
|
subq(r, r12_heapbase);
|
||||||
}
|
}
|
||||||
@ -5379,7 +5379,7 @@ void MacroAssembler::encode_heap_oop_not_null(Register dst, Register src) {
|
|||||||
bind(ok);
|
bind(ok);
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
verify_oop(src, "broken oop in encode_heap_oop_not_null2");
|
verify_oop_msg(src, "broken oop in encode_heap_oop_not_null2");
|
||||||
if (dst != src) {
|
if (dst != src) {
|
||||||
movq(dst, src);
|
movq(dst, src);
|
||||||
}
|
}
|
||||||
@ -5408,7 +5408,7 @@ void MacroAssembler::decode_heap_oop(Register r) {
|
|||||||
addq(r, r12_heapbase);
|
addq(r, r12_heapbase);
|
||||||
bind(done);
|
bind(done);
|
||||||
}
|
}
|
||||||
verify_oop(r, "broken oop in decode_heap_oop");
|
verify_oop_msg(r, "broken oop in decode_heap_oop");
|
||||||
}
|
}
|
||||||
|
|
||||||
void MacroAssembler::decode_heap_oop_not_null(Register r) {
|
void MacroAssembler::decode_heap_oop_not_null(Register r) {
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -599,14 +599,16 @@ class MacroAssembler: public Assembler {
|
|||||||
// Debugging
|
// Debugging
|
||||||
|
|
||||||
// only if +VerifyOops
|
// only if +VerifyOops
|
||||||
// TODO: Make these macros with file and line like sparc version!
|
void _verify_oop(Register reg, const char* s, const char* file, int line);
|
||||||
void verify_oop(Register reg, const char* s = "broken oop");
|
void _verify_oop_addr(Address addr, const char* s, const char* file, int line);
|
||||||
void verify_oop_addr(Address addr, const char * s = "broken oop addr");
|
|
||||||
|
|
||||||
// TODO: verify method and klass metadata (compare against vptr?)
|
// TODO: verify method and klass metadata (compare against vptr?)
|
||||||
void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {}
|
void _verify_method_ptr(Register reg, const char * msg, const char * file, int line) {}
|
||||||
void _verify_klass_ptr(Register reg, const char * msg, const char * file, int line){}
|
void _verify_klass_ptr(Register reg, const char * msg, const char * file, int line){}
|
||||||
|
|
||||||
|
#define verify_oop(reg) _verify_oop(reg, "broken oop " #reg, __FILE__, __LINE__)
|
||||||
|
#define verify_oop_msg(reg, msg) _verify_oop(reg, "broken oop " #reg ", " #msg, __FILE__, __LINE__)
|
||||||
|
#define verify_oop_addr(addr) _verify_oop_addr(addr, "broken oop addr " #addr, __FILE__, __LINE__)
|
||||||
#define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__)
|
#define verify_method_ptr(reg) _verify_method_ptr(reg, "broken method " #reg, __FILE__, __LINE__)
|
||||||
#define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__)
|
#define verify_klass_ptr(reg) _verify_klass_ptr(reg, "broken klass " #reg, __FILE__, __LINE__)
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved.
|
* Copyright (c) 2019, 2020, Oracle and/or its affiliates. All rights reserved.
|
||||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||||
*
|
*
|
||||||
* This code is free software; you can redistribute it and/or modify it
|
* This code is free software; you can redistribute it and/or modify it
|
||||||
@ -36,7 +36,7 @@
|
|||||||
|
|
||||||
#define BAD_OOP_ARG(o, p) "Bad oop " PTR_FORMAT " found at " PTR_FORMAT, p2i(o), p2i(p)
|
#define BAD_OOP_ARG(o, p) "Bad oop " PTR_FORMAT " found at " PTR_FORMAT, p2i(o), p2i(p)
|
||||||
|
|
||||||
static void verify_oop(oop* p) {
|
static void z_verify_oop(oop* p) {
|
||||||
const oop o = RawAccess<>::oop_load(p);
|
const oop o = RawAccess<>::oop_load(p);
|
||||||
if (o != NULL) {
|
if (o != NULL) {
|
||||||
const uintptr_t addr = ZOop::to_address(o);
|
const uintptr_t addr = ZOop::to_address(o);
|
||||||
@ -45,7 +45,7 @@ static void verify_oop(oop* p) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static void verify_possibly_weak_oop(oop* p) {
|
static void z_verify_possibly_weak_oop(oop* p) {
|
||||||
const oop o = RawAccess<>::oop_load(p);
|
const oop o = RawAccess<>::oop_load(p);
|
||||||
if (o != NULL) {
|
if (o != NULL) {
|
||||||
const uintptr_t addr = ZOop::to_address(o);
|
const uintptr_t addr = ZOop::to_address(o);
|
||||||
@ -57,7 +57,7 @@ static void verify_possibly_weak_oop(oop* p) {
|
|||||||
class ZVerifyRootClosure : public ZRootsIteratorClosure {
|
class ZVerifyRootClosure : public ZRootsIteratorClosure {
|
||||||
public:
|
public:
|
||||||
virtual void do_oop(oop* p) {
|
virtual void do_oop(oop* p) {
|
||||||
verify_oop(p);
|
z_verify_oop(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
virtual void do_oop(narrowOop*) {
|
virtual void do_oop(narrowOop*) {
|
||||||
@ -76,11 +76,11 @@ public:
|
|||||||
|
|
||||||
virtual void do_oop(oop* p) {
|
virtual void do_oop(oop* p) {
|
||||||
if (_verify_weaks) {
|
if (_verify_weaks) {
|
||||||
verify_possibly_weak_oop(p);
|
z_verify_possibly_weak_oop(p);
|
||||||
} else {
|
} else {
|
||||||
// We should never encounter finalizable oops through strong
|
// We should never encounter finalizable oops through strong
|
||||||
// paths. This assumes we have only visited strong roots.
|
// paths. This assumes we have only visited strong roots.
|
||||||
verify_oop(p);
|
z_verify_oop(p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user