Skip to content
Permalink
Browse files
8241006: Cleanup TemplateInterpreter initialization
Reviewed-by: coleenp
  • Loading branch information
cl4es committed Mar 13, 2020
1 parent afbe228 commit 37629673e715481cf8a9480b0f6b373cbb2e1fcf
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
@@ -56,7 +56,7 @@
// Implementation of platform independent aspects of Interpreter

void AbstractInterpreter::initialize() {
if (_code != NULL) return;
assert(_code == NULL, "must only initialize once");

// make sure 'imported' classes are initialized
if (CountBytecodes || TraceBytecodes || StopInterpreterAt) BytecodeCounter::reset();
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
@@ -40,8 +40,8 @@
# define __ _masm->

void TemplateInterpreter::initialize() {
if (_code != NULL) return;
// assertions
assert(_code == NULL, "must only initialize once");
assert((int)Bytecodes::number_of_codes <= (int)DispatchTable::length,
"dispatch table too small");

@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
@@ -26,7 +26,6 @@
#include "gc/shared/barrierSet.hpp"
#include "interpreter/interp_masm.hpp"
#include "interpreter/templateTable.hpp"
#include "runtime/timerTrace.hpp"

#ifdef CC_INTERP

@@ -168,13 +167,11 @@ void TemplateTable::transition(TosState tos_in, TosState tos_out) {
//----------------------------------------------------------------------------------------------------
// Implementation of TemplateTable: Initialization

bool TemplateTable::_is_initialized = false;
Template TemplateTable::_template_table [Bytecodes::number_of_codes];
Template TemplateTable::_template_table_wide[Bytecodes::number_of_codes];

Template* TemplateTable::_desc;
InterpreterMacroAssembler* TemplateTable::_masm;
BarrierSet* TemplateTable::_bs;


void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(), char filler) {
@@ -185,9 +182,6 @@ void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState o

void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState out, void (*gen)(int arg), int arg) {
// should factor out these constants
const int ubcp = 1 << Template::uses_bcp_bit;
const int disp = 1 << Template::does_dispatch_bit;
const int clvm = 1 << Template::calls_vm_bit;
const int iswd = 1 << Template::wide_bit;
// determine which table to use
bool is_wide = (flags & iswd) != 0;
@@ -223,12 +217,11 @@ void TemplateTable::def(Bytecodes::Code code, int flags, TosState in, TosState o
}

void TemplateTable::initialize() {
if (_is_initialized) return;

// Initialize table
TraceTime timer("TemplateTable initialization", TRACETIME_LOG(Info, startuptime));

_bs = BarrierSet::barrier_set();
#ifdef ASSERT
static bool is_initialized = false;
assert(!is_initialized, "must only initialize once");
is_initialized = true;
#endif

// For better readability
const char _ = ' ';
@@ -507,15 +500,8 @@ void TemplateTable::initialize() {
def(Bytecodes::_shouldnotreachhere , ____|____|____|____, vtos, vtos, shouldnotreachhere , _ );
// platform specific bytecodes
pd_initialize();

_is_initialized = true;
}

void templateTable_init() {
TemplateTable::initialize();
}


void TemplateTable::unimplemented_bc() {
_masm->unimplemented( Bytecodes::name(_desc->bytecode()));
}
@@ -36,7 +36,6 @@
// and the snippet generator, a template is assigned to each bytecode which can be
// used to generate the bytecode's implementation if needed.

class BarrierSet;
class InterpreterMacroAssembler;

// A Template describes the properties of a code template for a given bytecode
@@ -87,14 +86,11 @@ class TemplateTable: AllStatic {
enum RewriteControl { may_rewrite, may_not_rewrite }; // control for fast code under CDS

private:
static bool _is_initialized; // true if TemplateTable has been initialized
static Template _template_table [Bytecodes::number_of_codes];
static Template _template_table_wide[Bytecodes::number_of_codes];

static Template* _desc; // the current template to be generated
static Bytecodes::Code bytecode() { return _desc->bytecode(); }

static BarrierSet* _bs; // Cache the barrier set.
public:
//%note templates_1
static InterpreterMacroAssembler* _masm; // the assembler used when generating templates
@@ -852,12 +852,10 @@ bool universe_post_init() {
assert(!is_init_completed(), "Error: initialization not yet completed!");
Universe::_fully_initialized = true;
EXCEPTION_MARK;
{ ResourceMark rm;
Interpreter::initialize(); // needed for interpreter entry points
if (!UseSharedSpaces) {
Universe::reinitialize_vtables(CHECK_false);
Universe::reinitialize_itables(CHECK_false);
}
if (!UseSharedSpaces) {
ResourceMark rm;
Universe::reinitialize_vtables(CHECK_false);
Universe::reinitialize_itables(CHECK_false);
}

HandleMark hm(THREAD);
@@ -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.
*
* This code is free software; you can redistribute it and/or modify it
@@ -69,7 +69,6 @@ void gc_barrier_stubs_init();
void interpreter_init(); // before any methods loaded
void invocationCounter_init(); // before any methods loaded
void accessFlags_init();
void templateTable_init();
void InterfaceSupport_init();
void universe2_init(); // dependent on codeCache_init and stubRoutines_init, loads primordial classes
void referenceProcessor_init();
@@ -123,7 +122,6 @@ jint init_globals() {
interpreter_init(); // before any methods loaded
invocationCounter_init(); // before any methods loaded
accessFlags_init();
templateTable_init();
InterfaceSupport_init();
VMRegImpl::set_regName(); // need this before generate_stubs (for printing oop maps).
SharedRuntime::generate_stubs();

0 comments on commit 3762967

Please sign in to comment.