Skip to content
Permalink
Browse files
8275586: Zero: Simplify interpreter initialization
Reviewed-by: aph, adinn
  • Loading branch information
shipilev committed Nov 4, 2021
1 parent c62b347 commit 3613ce7c7d5bc8b7d603e1cf6a123588339aed3f
Showing with 22 additions and 63 deletions.
  1. +4 −0 src/hotspot/cpu/zero/vm_version_zero.cpp
  2. +0 −8 src/hotspot/cpu/zero/zeroInterpreter_zero.cpp
  3. +18 −55 src/hotspot/share/interpreter/zero/bytecodeInterpreter.cpp
@@ -117,4 +117,8 @@ void VM_Version::initialize() {

// Not implemented
UNSUPPORTED_OPTION(CriticalJNINatives);
UNSUPPORTED_OPTION(UseCompiler);
#ifdef ASSERT
UNSUPPORTED_OPTION(CountCompiledCalls);
#endif
}
@@ -68,14 +68,6 @@ void ZeroInterpreter::initialize_code() {
ZeroInterpreterGenerator g(_code);
if (PrintInterpreter) print();
}

// Allow c++ interpreter to do one initialization now that switches are set, etc.
BytecodeInterpreter start_msg(BytecodeInterpreter::initialize);
if (JvmtiExport::can_post_interpreter_events()) {
BytecodeInterpreter::run<true>(&start_msg);
} else {
BytecodeInterpreter::run<false>(&start_msg);
}
}

void ZeroInterpreter::invoke_method(Method* method, address entry_point, TRAPS) {
@@ -403,25 +403,25 @@ template void BytecodeInterpreter::run<false>(interpreterState istate);

template<bool JVMTI_ENABLED>
void BytecodeInterpreter::run(interpreterState istate) {

// In order to simplify some tests based on switches set at runtime
// we invoke the interpreter a single time after switches are enabled
// and set simpler to to test variables rather than method calls or complex
// boolean expressions.

static int initialized = 0;
static int checkit = 0;
static intptr_t* c_addr = NULL;
static intptr_t c_value;

if (checkit && *c_addr != c_value) {
os::breakpoint();
}
intptr_t* topOfStack = (intptr_t *)istate->stack(); /* access with STACK macros */
address pc = istate->bcp();
jubyte opcode;
intptr_t* locals = istate->locals();
ConstantPoolCache* cp = istate->constants(); // method()->constants()->cache()
#ifdef LOTS_OF_REGS
JavaThread* THREAD = istate->thread();
#else
#undef THREAD
#define THREAD istate->thread()
#endif

#ifdef ASSERT
if (istate->_msg != initialize) {
assert(labs(istate->_stack_base - istate->_stack_limit) == (istate->_method->max_stack() + 1), "bad stack limit");
}
assert(labs(istate->stack_base() - istate->stack_limit()) == (istate->method()->max_stack() + 1),
"Bad stack limit");
/* QQQ this should be a stack method so we don't know actual direction */
assert(topOfStack >= istate->stack_limit() && topOfStack < istate->stack_base(),
"Stack top out of range");

// Verify linkages.
interpreterState l = istate;
do {
@@ -433,18 +433,6 @@ void BytecodeInterpreter::run(interpreterState istate) {
interpreterState orig = istate;
#endif

intptr_t* topOfStack = (intptr_t *)istate->stack(); /* access with STACK macros */
address pc = istate->bcp();
jubyte opcode;
intptr_t* locals = istate->locals();
ConstantPoolCache* cp = istate->constants(); // method()->constants()->cache()
#ifdef LOTS_OF_REGS
JavaThread* THREAD = istate->thread();
#else
#undef THREAD
#define THREAD istate->thread()
#endif

#ifdef USELABELS
const static void* const opclabels_data[256] = {
/* 0x00 */ &&opc_nop, &&opc_aconst_null, &&opc_iconst_m1, &&opc_iconst_0,
@@ -531,38 +519,13 @@ void BytecodeInterpreter::run(interpreterState istate) {
uintptr_t *dispatch_table = (uintptr_t*)&opclabels_data[0];
#endif /* USELABELS */

#ifdef ASSERT
// this will trigger a VERIFY_OOP on entry
if (istate->msg() != initialize && ! METHOD->is_static()) {
oop rcvr = LOCALS_OBJECT(0);
VERIFY_OOP(rcvr);
}
#endif

/* QQQ this should be a stack method so we don't know actual direction */
guarantee(istate->msg() == initialize ||
topOfStack >= istate->stack_limit() &&
topOfStack < istate->stack_base(),
"Stack top out of range");

assert(!UseCompiler, "Zero does not support compilers");
assert(!CountCompiledCalls, "Zero does not support counting compiled calls");

switch (istate->msg()) {
case initialize: {
if (initialized++) ShouldNotReachHere(); // Only one initialize call.
ShouldNotCallThis();
return;
}
break;
case method_entry: {
THREAD->set_do_not_unlock();
// count invocations
assert(initialized, "Interpreter not initialized");

if ((istate->_stack_base - istate->_stack_limit) != istate->method()->max_stack() + 1) {
// initialize
os::breakpoint();
}

// Lock method if synchronized.
if (METHOD->is_synchronized()) {

1 comment on commit 3613ce7

@openjdk-notifier
Copy link

@openjdk-notifier openjdk-notifier bot commented on 3613ce7 Nov 4, 2021

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please sign in to comment.