< prev index next >
src/hotspot/cpu/x86/sharedRuntime_x86_64.cpp
Print this page
*** 1023,1032 ****
--- 1023,1047 ----
// both caller and callee would be compiled methods, and neither would
// clean up the stack pointer changes performed by the two adapters.
// If this happens, control eventually transfers back to the compiled
// caller, but with an uncorrected stack, causing delayed havoc.
+ Label value_arg_is_null;
+ bool has_null_check = false;
+ if (EnableValhalla) {
+ for (int i = 0; i < sig_extended.length(); i++) {
+ BasicType bt = sig_extended.at(i)._bt;
+ if (bt == T_VALUETYPEPTR) {
+ // Add null check for value type argument
+ int ld_off = (sig_extended.length() - i) * Interpreter::stackElementSize;
+ __ cmpptr(Address(rsp, ld_off), 0);
+ __ jcc(Assembler::equal, value_arg_is_null);
+ has_null_check = true;
+ }
+ }
+ }
+
// Pick up the return address
__ movptr(rax, Address(rsp, 0));
if (VerifyAdapterCalls &&
(Interpreter::code() != NULL || StubRoutines::code1() != NULL)) {
*** 1178,1187 ****
--- 1193,1209 ----
// put Method* where a c2i would expect should we end up there
// only needed because of c2 resolve stubs return Method* as a result in
// rax
__ mov(rax, rbx);
__ jmp(r11);
+
+ if (has_null_check) {
+ __ bind(value_arg_is_null);
+ // TODO For now, we just call the interpreter if a value type argument is NULL
+ __ movptr(r11, Address(rbx, in_bytes(Method::interpreter_entry_offset())));
+ __ jmp(r11);
+ }
}
// ---------------------------------------------------------------
AdapterHandlerEntry* SharedRuntime::generate_i2c2i_adapters(MacroAssembler *masm,
int comp_args_on_stack,
< prev index next >