mirror of
https://github.com/openjdk/jdk.git
synced 2025-08-26 22:34:27 +02:00
8009981: nashorn tests fail with -XX:+VerifyStack
Nmethod::preserve_callee_argument_oops() must take appendix into account. Reviewed-by: kvn, twisti
This commit is contained in:
parent
337a9c1432
commit
6a17746b6c
6 changed files with 32 additions and 17 deletions
|
@ -1976,11 +1976,10 @@ void nmethod::preserve_callee_argument_oops(frame fr, const RegisterMap *reg_map
|
||||||
if (!method()->is_native()) {
|
if (!method()->is_native()) {
|
||||||
SimpleScopeDesc ssd(this, fr.pc());
|
SimpleScopeDesc ssd(this, fr.pc());
|
||||||
Bytecode_invoke call(ssd.method(), ssd.bci());
|
Bytecode_invoke call(ssd.method(), ssd.bci());
|
||||||
// compiled invokedynamic call sites have an implicit receiver at
|
bool has_receiver = call.has_receiver();
|
||||||
// resolution time, so make sure it gets GC'ed.
|
bool has_appendix = call.has_appendix();
|
||||||
bool has_receiver = !call.is_invokestatic();
|
|
||||||
Symbol* signature = call.signature();
|
Symbol* signature = call.signature();
|
||||||
fr.oops_compiled_arguments_do(signature, has_receiver, reg_map, f);
|
fr.oops_compiled_arguments_do(signature, has_receiver, has_appendix, reg_map, f);
|
||||||
}
|
}
|
||||||
#endif // !SHARK
|
#endif // !SHARK
|
||||||
}
|
}
|
||||||
|
|
|
@ -635,18 +635,22 @@ JRT_LEAF(BasicType, Deoptimization::unpack_frames(JavaThread* thread, int exec_m
|
||||||
// at an uncommon trap for an invoke (where the compiler
|
// at an uncommon trap for an invoke (where the compiler
|
||||||
// generates debug info before the invoke has executed)
|
// generates debug info before the invoke has executed)
|
||||||
Bytecodes::Code cur_code = str.next();
|
Bytecodes::Code cur_code = str.next();
|
||||||
if (cur_code == Bytecodes::_invokevirtual ||
|
if (cur_code == Bytecodes::_invokevirtual ||
|
||||||
cur_code == Bytecodes::_invokespecial ||
|
cur_code == Bytecodes::_invokespecial ||
|
||||||
cur_code == Bytecodes::_invokestatic ||
|
cur_code == Bytecodes::_invokestatic ||
|
||||||
cur_code == Bytecodes::_invokeinterface) {
|
cur_code == Bytecodes::_invokeinterface ||
|
||||||
|
cur_code == Bytecodes::_invokedynamic) {
|
||||||
Bytecode_invoke invoke(mh, iframe->interpreter_frame_bci());
|
Bytecode_invoke invoke(mh, iframe->interpreter_frame_bci());
|
||||||
Symbol* signature = invoke.signature();
|
Symbol* signature = invoke.signature();
|
||||||
ArgumentSizeComputer asc(signature);
|
ArgumentSizeComputer asc(signature);
|
||||||
cur_invoke_parameter_size = asc.size();
|
cur_invoke_parameter_size = asc.size();
|
||||||
if (cur_code != Bytecodes::_invokestatic) {
|
if (invoke.has_receiver()) {
|
||||||
// Add in receiver
|
// Add in receiver
|
||||||
++cur_invoke_parameter_size;
|
++cur_invoke_parameter_size;
|
||||||
}
|
}
|
||||||
|
if (i != 0 && !invoke.is_invokedynamic() && MethodHandles::has_member_arg(invoke.klass(), invoke.name())) {
|
||||||
|
callee_size_of_parameters++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (str.bci() < max_bci) {
|
if (str.bci() < max_bci) {
|
||||||
Bytecodes::Code bc = str.next();
|
Bytecodes::Code bc = str.next();
|
||||||
|
@ -661,6 +665,7 @@ JRT_LEAF(BasicType, Deoptimization::unpack_frames(JavaThread* thread, int exec_m
|
||||||
case Bytecodes::_invokespecial:
|
case Bytecodes::_invokespecial:
|
||||||
case Bytecodes::_invokestatic:
|
case Bytecodes::_invokestatic:
|
||||||
case Bytecodes::_invokeinterface:
|
case Bytecodes::_invokeinterface:
|
||||||
|
case Bytecodes::_invokedynamic:
|
||||||
case Bytecodes::_athrow:
|
case Bytecodes::_athrow:
|
||||||
break;
|
break;
|
||||||
default: {
|
default: {
|
||||||
|
|
|
@ -1008,6 +1008,7 @@ class CompiledArgumentOopFinder: public SignatureInfo {
|
||||||
OopClosure* _f;
|
OopClosure* _f;
|
||||||
int _offset; // the current offset, incremented with each argument
|
int _offset; // the current offset, incremented with each argument
|
||||||
bool _has_receiver; // true if the callee has a receiver
|
bool _has_receiver; // true if the callee has a receiver
|
||||||
|
bool _has_appendix; // true if the call has an appendix
|
||||||
frame _fr;
|
frame _fr;
|
||||||
RegisterMap* _reg_map;
|
RegisterMap* _reg_map;
|
||||||
int _arg_size;
|
int _arg_size;
|
||||||
|
@ -1027,19 +1028,20 @@ class CompiledArgumentOopFinder: public SignatureInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
public:
|
public:
|
||||||
CompiledArgumentOopFinder(Symbol* signature, bool has_receiver, OopClosure* f, frame fr, const RegisterMap* reg_map)
|
CompiledArgumentOopFinder(Symbol* signature, bool has_receiver, bool has_appendix, OopClosure* f, frame fr, const RegisterMap* reg_map)
|
||||||
: SignatureInfo(signature) {
|
: SignatureInfo(signature) {
|
||||||
|
|
||||||
// initialize CompiledArgumentOopFinder
|
// initialize CompiledArgumentOopFinder
|
||||||
_f = f;
|
_f = f;
|
||||||
_offset = 0;
|
_offset = 0;
|
||||||
_has_receiver = has_receiver;
|
_has_receiver = has_receiver;
|
||||||
|
_has_appendix = has_appendix;
|
||||||
_fr = fr;
|
_fr = fr;
|
||||||
_reg_map = (RegisterMap*)reg_map;
|
_reg_map = (RegisterMap*)reg_map;
|
||||||
_arg_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0);
|
_arg_size = ArgumentSizeComputer(signature).size() + (has_receiver ? 1 : 0) + (has_appendix ? 1 : 0);
|
||||||
|
|
||||||
int arg_size;
|
int arg_size;
|
||||||
_regs = SharedRuntime::find_callee_arguments(signature, has_receiver, &arg_size);
|
_regs = SharedRuntime::find_callee_arguments(signature, has_receiver, has_appendix, &arg_size);
|
||||||
assert(arg_size == _arg_size, "wrong arg size");
|
assert(arg_size == _arg_size, "wrong arg size");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1049,12 +1051,16 @@ class CompiledArgumentOopFinder: public SignatureInfo {
|
||||||
_offset++;
|
_offset++;
|
||||||
}
|
}
|
||||||
iterate_parameters();
|
iterate_parameters();
|
||||||
|
if (_has_appendix) {
|
||||||
|
handle_oop_offset();
|
||||||
|
_offset++;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
void frame::oops_compiled_arguments_do(Symbol* signature, bool has_receiver, const RegisterMap* reg_map, OopClosure* f) {
|
void frame::oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix, const RegisterMap* reg_map, OopClosure* f) {
|
||||||
ResourceMark rm;
|
ResourceMark rm;
|
||||||
CompiledArgumentOopFinder finder(signature, has_receiver, f, *this, reg_map);
|
CompiledArgumentOopFinder finder(signature, has_receiver, has_appendix, f, *this, reg_map);
|
||||||
finder.oops_do();
|
finder.oops_do();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -411,7 +411,7 @@ class frame VALUE_OBJ_CLASS_SPEC {
|
||||||
oop* oopmapreg_to_location(VMReg reg, const RegisterMap* regmap) const;
|
oop* oopmapreg_to_location(VMReg reg, const RegisterMap* regmap) const;
|
||||||
|
|
||||||
// Oops-do's
|
// Oops-do's
|
||||||
void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, const RegisterMap* reg_map, OopClosure* f);
|
void oops_compiled_arguments_do(Symbol* signature, bool has_receiver, bool has_appendix, const RegisterMap* reg_map, OopClosure* f);
|
||||||
void oops_interpreted_do(OopClosure* f, CLDToOopClosure* cld_f, const RegisterMap* map, bool query_oop_map_cache = true);
|
void oops_interpreted_do(OopClosure* f, CLDToOopClosure* cld_f, const RegisterMap* map, bool query_oop_map_cache = true);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
|
@ -2726,7 +2726,7 @@ VMReg SharedRuntime::name_for_receiver() {
|
||||||
return regs.first();
|
return regs.first();
|
||||||
}
|
}
|
||||||
|
|
||||||
VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver, int* arg_size) {
|
VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver, bool has_appendix, int* arg_size) {
|
||||||
// This method is returning a data structure allocating as a
|
// This method is returning a data structure allocating as a
|
||||||
// ResourceObject, so do not put any ResourceMarks in here.
|
// ResourceObject, so do not put any ResourceMarks in here.
|
||||||
char *s = sig->as_C_string();
|
char *s = sig->as_C_string();
|
||||||
|
@ -2770,6 +2770,11 @@ VMRegPair *SharedRuntime::find_callee_arguments(Symbol* sig, bool has_receiver,
|
||||||
default : ShouldNotReachHere();
|
default : ShouldNotReachHere();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (has_appendix) {
|
||||||
|
sig_bt[cnt++] = T_OBJECT;
|
||||||
|
}
|
||||||
|
|
||||||
assert( cnt < 256, "grow table size" );
|
assert( cnt < 256, "grow table size" );
|
||||||
|
|
||||||
int comp_args_on_stack;
|
int comp_args_on_stack;
|
||||||
|
|
|
@ -410,7 +410,7 @@ class SharedRuntime: AllStatic {
|
||||||
|
|
||||||
// Convert a sig into a calling convention register layout
|
// Convert a sig into a calling convention register layout
|
||||||
// and find interesting things about it.
|
// and find interesting things about it.
|
||||||
static VMRegPair* find_callee_arguments(Symbol* sig, bool has_receiver, int *arg_size);
|
static VMRegPair* find_callee_arguments(Symbol* sig, bool has_receiver, bool has_appendix, int *arg_size);
|
||||||
static VMReg name_for_receiver();
|
static VMReg name_for_receiver();
|
||||||
|
|
||||||
// "Top of Stack" slots that may be unused by the calling convention but must
|
// "Top of Stack" slots that may be unused by the calling convention but must
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue