Skip to content
Permalink
Browse files
8263002: Remove CDS MiscCode region
Reviewed-by: coleenp, dholmes
  • Loading branch information
iklam committed Mar 10, 2021
1 parent 67ea3bd commit d8a9c3ca92cb09fe98092735f91bbe0f3ed3e5bb
Show file tree
Hide file tree
Showing 39 changed files with 116 additions and 641 deletions.
@@ -240,15 +240,6 @@ bool SharedRuntime::is_wide_vector(int size) {
return size > 8;
}

size_t SharedRuntime::trampoline_size() {
return 16;
}

void SharedRuntime::generate_trampoline(MacroAssembler *masm, address destination) {
__ mov(rscratch1, destination);
__ br(rscratch1);
}

// The java_calling_convention describes stack locations as ideal slots on
// a frame with no abi restrictions. Since we must observe abi restrictions
// (like the placement of the register window) the slots must be biased by
@@ -251,16 +251,6 @@ bool SharedRuntime::is_wide_vector(int size) {
return false;
}

size_t SharedRuntime::trampoline_size() {
return 16;
}

void SharedRuntime::generate_trampoline(MacroAssembler *masm, address destination) {
InlinedAddress dest(destination);
__ indirect_jump(dest, Rtemp);
__ bind_literal(dest);
}

int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
VMRegPair *regs,
VMRegPair *regs2,
@@ -564,17 +564,6 @@ bool SharedRuntime::is_wide_vector(int size) {
return size > 8;
}

size_t SharedRuntime::trampoline_size() {
return Assembler::load_const_size + 8;
}

void SharedRuntime::generate_trampoline(MacroAssembler *masm, address destination) {
Register Rtemp = R12;
__ load_const(Rtemp, destination);
__ mtctr(Rtemp);
__ bctr();
}

static int reg2slot(VMReg r) {
return r->reg2stack() + SharedRuntime::out_preserve_stack_slots();
}
@@ -556,16 +556,6 @@ void RegisterSaver::restore_result_registers(MacroAssembler* masm) {
}
}

size_t SharedRuntime::trampoline_size() {
return MacroAssembler::load_const_size() + 2;
}

void SharedRuntime::generate_trampoline(MacroAssembler *masm, address destination) {
// Think about using pc-relative branch.
__ load_const(Z_R1_scratch, destination);
__ z_br(Z_R1_scratch);
}

// ---------------------------------------------------------------------------
void SharedRuntime::save_native_result(MacroAssembler * masm,
BasicType ret_type,
@@ -371,14 +371,6 @@ bool SharedRuntime::is_wide_vector(int size) {
return size > 16;
}

size_t SharedRuntime::trampoline_size() {
return 16;
}

void SharedRuntime::generate_trampoline(MacroAssembler *masm, address destination) {
__ jump(RuntimeAddress(destination));
}

// The java_calling_convention describes stack locations as ideal slots on
// a frame with no abi restrictions. Since we must observe abi restrictions
// (like the placement of the register window) the slots must be biased by
@@ -423,14 +423,6 @@ bool SharedRuntime::is_wide_vector(int size) {
return size > 16;
}

size_t SharedRuntime::trampoline_size() {
return 16;
}

void SharedRuntime::generate_trampoline(MacroAssembler *masm, address destination) {
__ jump(RuntimeAddress(destination));
}

// The java_calling_convention describes stack locations as ideal slots on
// a frame with no abi restrictions. Since we must observe abi restrictions
// (like the placement of the register window) the slots must be biased by
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2015, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, Oracle and/or its affiliates. All rights reserved.
* Copyright 2007, 2008, 2009, 2010, 2011 Red Hat, Inc.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@@ -119,16 +119,6 @@ RuntimeStub* SharedRuntime::generate_resolve_blob(address destination, const cha
return generate_empty_runtime_stub("resolve_blob");
}

size_t SharedRuntime::trampoline_size() {
ShouldNotCallThis();
return 0;
}

void SharedRuntime::generate_trampoline(MacroAssembler *masm, address destination) {
ShouldNotCallThis();
return;
}

int SharedRuntime::c_calling_convention(const BasicType *sig_bt,
VMRegPair *regs,
VMRegPair *regs2,
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, 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
@@ -67,12 +67,6 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
return false;
}

if (MetaspaceShared::is_in_trampoline_frame(addr)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}

frame ret_frame(ret_sp, ret_fp, addr);
if (!ret_frame.safe_for_sender(this)) {
#if COMPILER2_OR_JVMCI
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, 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.
*
@@ -68,12 +68,6 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
return false;
}

if (MetaspaceShared::is_in_trampoline_frame(addr)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}

frame ret_frame(ret_sp, ret_fp, addr);
if (!ret_frame.safe_for_sender(this)) {
#ifdef COMPILER2
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2008, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2008, 2021, 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
@@ -101,12 +101,6 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
return false;
}

if (MetaspaceShared::is_in_trampoline_frame(addr)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}

frame ret_frame(ret_sp, ret_fp, addr);
if (!ret_frame.safe_for_sender(this)) {
#ifdef COMPILER2
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, 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
@@ -68,12 +68,6 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
return false;
}

if (MetaspaceShared::is_in_trampoline_frame(addr)) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}

frame ret_frame(ret_sp, ret_fp, addr);
if (!ret_frame.safe_for_sender(this)) {
#if COMPILER2_OR_JVMCI
@@ -69,12 +69,6 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
return false;
}

if (MetaspaceShared::is_in_trampoline_frame(ret_frame.pc())) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}

if (!ret_frame.safe_for_sender(jt)) {
#if COMPILER2_OR_JVMCI
// C2 and JVMCI use ebp as a general register see if NULL fp helps
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2003, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2003, 2021, 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
@@ -64,12 +64,6 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
return false;
}

if (MetaspaceShared::is_in_trampoline_frame(ret_frame.pc())) {
// In the middle of a trampoline call. Bail out for safety.
// This happens rarely so shouldn't affect profiling.
return false;
}

if (!ret_frame.safe_for_sender(this)) {
#if COMPILER2_OR_JVMCI
// C2 and JVMCI use ebp as a general register see if NULL fp helps
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2018, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2018, 2021, 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
@@ -33,18 +33,18 @@
//
// Also, this is a C header file. Do not use C++ here.

#define NUM_CDS_REGIONS 8 // this must be the same as MetaspaceShared::n_regions
#define NUM_CDS_REGIONS 7 // this must be the same as MetaspaceShared::n_regions
#define CDS_ARCHIVE_MAGIC 0xf00baba2
#define CDS_DYNAMIC_ARCHIVE_MAGIC 0xf00baba8
#define CURRENT_CDS_ARCHIVE_VERSION 10
#define CURRENT_CDS_ARCHIVE_VERSION 11
#define INVALID_CDS_ARCHIVE_VERSION -1

struct CDSFileMapRegion {
int _crc; // CRC checksum of this region.
int _read_only; // read only region?
int _allow_exec; // executable code in this region?
int _is_heap_region; // Used by SA and debug build.
int _is_bitmap_region; // Relocation bitmap for RO/RW/MC/MD regions (used by SA and debug build).
int _is_bitmap_region; // Relocation bitmap for RO/RW regions (used by SA and debug build).
int _mapped_from_file; // Is this region mapped from a file?
// If false, this region was initialized using os::read().
size_t _file_offset; // Data for this region starts at this offset in the archive file.
@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, 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
@@ -92,7 +92,6 @@ address AbstractInterpreter::_native_entry_begin = NU
address AbstractInterpreter::_native_entry_end = NULL;
address AbstractInterpreter::_slow_signature_handler;
address AbstractInterpreter::_entry_table [AbstractInterpreter::number_of_method_entries];
address AbstractInterpreter::_cds_entry_table [AbstractInterpreter::number_of_method_entries];
address AbstractInterpreter::_native_abi_to_tosca [AbstractInterpreter::number_of_result_handlers];

//------------------------------------------------------------------------------------------------------------------------
@@ -200,49 +199,11 @@ AbstractInterpreter::MethodKind AbstractInterpreter::method_kind(const methodHan
return zerolocals;
}

#if INCLUDE_CDS

// For a shared Method m, to improve sharing across processes, we avoid writing to m->_i2i_entry
// at runtime. Instead, m->_i2i_entry points to a fixed location inside the CDS archive.
// This location contains a trampoline (generated by generate_entry_for_cds_method)
// which jumps to _entry_table[kind].
address AbstractInterpreter::entry_for_cds_method(const methodHandle& m) {
MethodKind kind = method_kind(m);
assert(0 <= kind && kind < number_of_method_entries, "illegal kind");
return entry_for_cds_method(kind);
}

address AbstractInterpreter::entry_for_cds_method(AbstractInterpreter::MethodKind kind) {
const size_t trampoline_size = SharedRuntime::trampoline_size();
address addr = MetaspaceShared::i2i_entry_code_buffers();
addr += (size_t)(kind) * trampoline_size;

return addr;
}

void AbstractInterpreter::generate_entry_for_cds_method(AbstractInterpreter::MethodKind kind) {
if (UseSharedSpaces) {
address trampoline = entry_for_cds_method(kind);
CodeBuffer buffer(trampoline, (int)(SharedRuntime::trampoline_size()));
MacroAssembler _masm(&buffer);
SharedRuntime::generate_trampoline(&_masm, _entry_table[kind]);
_masm.flush();

if (PrintInterpreter) {
Disassembler::decode(buffer.insts_begin(), buffer.insts_end());
}
}
}

#endif

void AbstractInterpreter::set_entry_for_kind(AbstractInterpreter::MethodKind kind, address entry) {
assert(kind >= method_handle_invoke_FIRST &&
kind <= method_handle_invoke_LAST, "late initialization only for MH entry points");
assert(_entry_table[kind] == _entry_table[abstract], "previous value must be AME entry");
_entry_table[kind] = entry;

generate_entry_for_cds_method(kind);
}

// Return true if the interpreter can prove that the given bytecode has
@@ -479,6 +440,5 @@ void AbstractInterpreter::initialize_method_handle_entries() {
for (int i = method_handle_invoke_FIRST; i <= method_handle_invoke_LAST; i++) {
MethodKind kind = (MethodKind) i;
_entry_table[kind] = _entry_table[Interpreter::abstract];
Interpreter::generate_entry_for_cds_method(kind);
}
}
@@ -116,7 +116,6 @@ class AbstractInterpreter: AllStatic {

// method entry points
static address _entry_table[number_of_method_entries]; // entry points for a given method
static address _cds_entry_table[number_of_method_entries]; // entry points for methods in the CDS archive
static address _native_abi_to_tosca[number_of_result_handlers]; // for native method result handlers
static address _slow_signature_handler; // the native method generic (slow) signature handler

@@ -136,11 +135,6 @@ class AbstractInterpreter: AllStatic {
static address entry_for_kind(MethodKind k) { assert(0 <= k && k < number_of_method_entries, "illegal kind"); return _entry_table[k]; }
static address entry_for_method(const methodHandle& m) { return entry_for_kind(method_kind(m)); }

// used by class data sharing
static address entry_for_cds_method(const methodHandle& m) NOT_CDS_RETURN_(NULL);
static address entry_for_cds_method(AbstractInterpreter::MethodKind kind) NOT_CDS_RETURN_(NULL);
static void generate_entry_for_cds_method(MethodKind kind) NOT_CDS_RETURN;

// used for bootstrapping method handles:
static void set_entry_for_kind(MethodKind k, address e);

@@ -1,5 +1,5 @@
/*
* Copyright (c) 1997, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1997, 2021, 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
@@ -181,7 +181,6 @@ void TemplateInterpreterGenerator::generate_all() {
#define method_entry(kind) \
{ CodeletMark cm(_masm, "method entry point (kind = " #kind ")"); \
Interpreter::_entry_table[Interpreter::kind] = generate_method_entry(Interpreter::kind); \
Interpreter::generate_entry_for_cds_method(Interpreter::kind); \
}

// all non-native method kinds

0 comments on commit d8a9c3c

Please sign in to comment.