8172020: Internal Error (cpu/arm/vm/frame_arm.cpp:571): assert(obj == __null || Universe::heap()->is_in(obj)) failed: sanity check #
Summary: do check_and_handle_earlyret() on method return
Reviewed-by: sspitsyn, aph, adinn, simonis
--- a/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/aarch64/vm/interp_masm_aarch64.hpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2015, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -54,9 +54,6 @@
int number_of_arguments,
bool check_exceptions);
- virtual void check_and_handle_popframe(Register java_thread);
- virtual void check_and_handle_earlyret(Register java_thread);
-
// base routine for all dispatches
void dispatch_base(TosState state, address* table, bool verifyoop = true);
@@ -67,6 +64,9 @@
void jump_to_entry(address entry);
+ virtual void check_and_handle_popframe(Register java_thread);
+ virtual void check_and_handle_earlyret(Register java_thread);
+
// Interpreter-specific registers
void save_bcp() {
str(rbcp, Address(rfp, frame::interpreter_frame_bcp_offset * wordSize));
--- a/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/aarch64/vm/macroAssembler_aarch64.hpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, 2015, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -77,12 +77,6 @@
bool check_exceptions // whether to check for pending exceptions after return
);
- // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
- // The implementation is only non-empty for the InterpreterMacroAssembler,
- // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
- virtual void check_and_handle_popframe(Register java_thread);
- virtual void check_and_handle_earlyret(Register java_thread);
-
void call_VM_helper(Register oop_result, address entry_point, int number_of_arguments, bool check_exceptions = true);
// Maximum size of class area in Metaspace when compressed
@@ -97,6 +91,12 @@
> (1u << log2_intptr(CompressedClassSpaceSize))));
}
+ // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
+ // The implementation is only non-empty for the InterpreterMacroAssembler,
+ // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
+ virtual void check_and_handle_popframe(Register java_thread);
+ virtual void check_and_handle_earlyret(Register java_thread);
+
// Biased locking support
// lock_reg and obj_reg must be loaded up with the appropriate values.
// swap_reg is killed.
--- a/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/aarch64/vm/templateInterpreterGenerator_aarch64.cpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -436,6 +436,10 @@
__ notify(Assembler::method_reentry);
}
#endif
+
+ __ check_and_handle_popframe(rthread);
+ __ check_and_handle_earlyret(rthread);
+
__ get_dispatch();
__ dispatch_next(state, step);
--- a/hotspot/src/cpu/arm/vm/interp_masm_arm.hpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/arm/vm/interp_masm_arm.hpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -53,9 +53,6 @@
// Template interpreter specific version of call_VM_helper
virtual void call_VM_helper(Register oop_result, address entry_point, int number_of_arguments, bool check_exceptions);
- virtual void check_and_handle_popframe();
- virtual void check_and_handle_earlyret();
-
// base routine for all dispatches
typedef enum { DispatchDefault, DispatchNormal } DispatchTableMode;
void dispatch_base(TosState state, DispatchTableMode table_mode, bool verifyoop = true);
@@ -63,6 +60,9 @@
public:
InterpreterMacroAssembler(CodeBuffer* code);
+ virtual void check_and_handle_popframe();
+ virtual void check_and_handle_earlyret();
+
// Interpreter-specific registers
#if defined(AARCH64) && defined(ASSERT)
--- a/hotspot/src/cpu/arm/vm/macroAssembler_arm.hpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/arm/vm/macroAssembler_arm.hpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -206,6 +206,9 @@
// may customize this version by overriding it for its purposes (e.g., to save/restore
// additional registers when doing a VM call).
virtual void call_VM_helper(Register oop_result, address entry_point, int number_of_arguments, bool check_exceptions);
+public:
+
+ MacroAssembler(CodeBuffer* code) : Assembler(code) {}
// These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
// The implementation is only non-empty for the InterpreterMacroAssembler,
@@ -213,10 +216,6 @@
virtual void check_and_handle_popframe() {}
virtual void check_and_handle_earlyret() {}
-public:
-
- MacroAssembler(CodeBuffer* code) : Assembler(code) {}
-
// By default, we do not need relocation information for non
// patchable absolute addresses. However, when needed by some
// extensions, ignore_non_patchable_relocations can be modified,
--- a/hotspot/src/cpu/arm/vm/templateInterpreterGenerator_arm.cpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/arm/vm/templateInterpreterGenerator_arm.cpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2008, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2008, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -304,6 +304,9 @@
__ convert_retval_to_tos(state);
#endif // !AARCH64
+ __ check_and_handle_popframe();
+ __ check_and_handle_earlyret();
+
__ dispatch_next(state, step);
return entry;
--- a/hotspot/src/cpu/ppc/vm/interp_masm_ppc.hpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/ppc/vm/interp_masm_ppc.hpp Tue Feb 28 10:51:47 2017 -0800
@@ -45,8 +45,8 @@
#define thread_(field_name) in_bytes(JavaThread::field_name ## _offset()), R16_thread
#define method_(field_name) in_bytes(Method::field_name ## _offset()), R19_method
- virtual void check_and_handle_popframe(Register java_thread);
- virtual void check_and_handle_earlyret(Register java_thread);
+ virtual void check_and_handle_popframe(Register scratch_reg);
+ virtual void check_and_handle_earlyret(Register scratch_reg);
// Base routine for all dispatches.
void dispatch_base(TosState state, address* table);
--- a/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/ppc/vm/templateInterpreterGenerator_ppc.cpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2014, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -689,6 +689,10 @@
#endif
__ sldi(size, size, Interpreter::logStackElementSize);
__ add(R15_esp, R15_esp, size);
+
+ __ check_and_handle_popframe(R11_scratch1);
+ __ check_and_handle_earlyret(R11_scratch1);
+
__ dispatch_next(state, step);
return entry;
}
--- a/hotspot/src/cpu/s390/vm/interp_masm_s390.hpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/s390/vm/interp_masm_s390.hpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -48,9 +48,6 @@
bool allow_relocation,
bool check_exceptions);
- virtual void check_and_handle_popframe(Register java_thread);
- virtual void check_and_handle_earlyret(Register java_thread);
-
// Base routine for all dispatches.
void dispatch_base(TosState state, address* table);
@@ -58,6 +55,9 @@
InterpreterMacroAssembler(CodeBuffer* c)
: MacroAssembler(c) {}
+ virtual void check_and_handle_popframe(Register java_thread);
+ virtual void check_and_handle_earlyret(Register java_thread);
+
void jump_to_entry(address entry, Register Rscratch);
virtual void load_earlyret_value(TosState state);
--- a/hotspot/src/cpu/s390/vm/templateInterpreterGenerator_s390.cpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/s390/vm/templateInterpreterGenerator_s390.cpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2017, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2016 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -676,6 +676,10 @@
__ z_llgc(size, Address(cache, offset, flags_offset+(sizeof(size_t)-1)));
__ z_sllg(size, size, Interpreter::logStackElementSize); // Each argument size in bytes.
__ z_agr(Z_esp, size); // Pop arguments.
+
+ __ check_and_handle_popframe(Z_thread);
+ __ check_and_handle_earlyret(Z_thread);
+
__ dispatch_next(state, step);
BLOCK_COMMENT("} return_entry");
--- a/hotspot/src/cpu/sparc/vm/interp_masm_sparc.hpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/sparc/vm/interp_masm_sparc.hpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -70,9 +70,6 @@
bool check_exception=true
);
- virtual void check_and_handle_popframe(Register java_thread);
- virtual void check_and_handle_earlyret(Register java_thread);
-
// base routine for all dispatches
void dispatch_base(TosState state, address* table);
@@ -80,6 +77,9 @@
InterpreterMacroAssembler(CodeBuffer* c)
: MacroAssembler(c) {}
+ virtual void check_and_handle_popframe(Register scratch_reg);
+ virtual void check_and_handle_earlyret(Register scratch_reg);
+
void jump_to_entry(address entry);
virtual void load_earlyret_value(TosState state);
--- a/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/sparc/vm/macroAssembler_sparc.hpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -604,15 +604,15 @@
bool check_exception=true // flag which indicates if exception should be checked
);
+ public:
+ MacroAssembler(CodeBuffer* code) : Assembler(code) {}
+
// This routine should emit JVMTI PopFrame and ForceEarlyReturn handling code.
// The implementation is only non-empty for the InterpreterMacroAssembler,
// as only the interpreter handles and ForceEarlyReturn PopFrame requests.
virtual void check_and_handle_popframe(Register scratch_reg);
virtual void check_and_handle_earlyret(Register scratch_reg);
- public:
- MacroAssembler(CodeBuffer* code) : Assembler(code) {}
-
// Support for NULL-checks
//
// Generates code that causes a NULL OS exception if the content of reg is NULL.
--- a/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/sparc/vm/templateInterpreterGenerator_sparc.cpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -374,6 +374,10 @@
__ and3(flags, ConstantPoolCacheEntry::parameter_size_mask, parameter_size); // argument size in words
__ sll(parameter_size, Interpreter::logStackElementSize, parameter_size); // each argument size in bytes
__ add(Lesp, parameter_size, Lesp); // pop arguments
+
+ __ check_and_handle_popframe(Gtemp);
+ __ check_and_handle_earlyret(Gtemp);
+
__ dispatch_next(state, step);
return entry;
--- a/hotspot/src/cpu/x86/vm/interp_masm_x86.hpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/x86/vm/interp_masm_x86.hpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2015, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -48,9 +48,6 @@
int number_of_arguments,
bool check_exceptions);
- virtual void check_and_handle_popframe(Register java_thread);
- virtual void check_and_handle_earlyret(Register java_thread);
-
// base routine for all dispatches
void dispatch_base(TosState state, address* table, bool verifyoop = true);
@@ -61,6 +58,9 @@
void jump_to_entry(address entry);
+ virtual void check_and_handle_popframe(Register java_thread);
+ virtual void check_and_handle_earlyret(Register java_thread);
+
void load_earlyret_value(TosState state);
// Interpreter-specific registers
--- a/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/x86/vm/macroAssembler_x86.hpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 1997, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 1997, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -71,12 +71,6 @@
bool check_exceptions // whether to check for pending exceptions after return
);
- // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
- // The implementation is only non-empty for the InterpreterMacroAssembler,
- // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
- virtual void check_and_handle_popframe(Register java_thread);
- virtual void check_and_handle_earlyret(Register java_thread);
-
void call_VM_helper(Register oop_result, address entry_point, int number_of_arguments, bool check_exceptions = true);
// helpers for FPU flag access
@@ -87,6 +81,12 @@
public:
MacroAssembler(CodeBuffer* code) : Assembler(code) {}
+ // These routines should emit JVMTI PopFrame and ForceEarlyReturn handling code.
+ // The implementation is only non-empty for the InterpreterMacroAssembler,
+ // as only the interpreter handles PopFrame and ForceEarlyReturn requests.
+ virtual void check_and_handle_popframe(Register java_thread);
+ virtual void check_and_handle_earlyret(Register java_thread);
+
// Support for NULL-checks
//
// Generates code that causes a NULL OS exception if the content of reg is NULL.
--- a/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp Thu Feb 16 00:50:19 2017 -0800
+++ b/hotspot/src/cpu/x86/vm/templateInterpreterGenerator_x86.cpp Tue Feb 28 10:51:47 2017 -0800
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2003, 2016, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2003, 2017, Oracle and/or its affiliates. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* This code is free software; you can redistribute it and/or modify it
@@ -220,6 +220,17 @@
__ movl(flags, Address(cache, index, Address::times_ptr, ConstantPoolCache::base_offset() + ConstantPoolCacheEntry::flags_offset()));
__ andl(flags, ConstantPoolCacheEntry::parameter_size_mask);
__ lea(rsp, Address(rsp, flags, Interpreter::stackElementScale()));
+
+ const Register java_thread = NOT_LP64(rcx) LP64_ONLY(r15_thread);
+ if (JvmtiExport::can_pop_frame()) {
+ NOT_LP64(__ get_thread(java_thread));
+ __ check_and_handle_popframe(java_thread);
+ }
+ if (JvmtiExport::can_force_early_return()) {
+ NOT_LP64(__ get_thread(java_thread));
+ __ check_and_handle_earlyret(java_thread);
+ }
+
__ dispatch_next(state, step);
return entry;