8245521: Remove STACK_BIAS

Reviewed-by: dholmes, mbaesken, kvn
This commit is contained in:
Mikael Vidstedt 2020-05-26 12:36:59 -07:00
parent 44a0a08991
commit 1401fe0087
13 changed files with 23 additions and 40 deletions
src
hotspot
jdk.hotspot.agent/share/classes/sun/jvm/hotspot/runtime
jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.hotspot/src/org/graalvm/compiler/hotspot

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2019 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -42,7 +42,7 @@ LIR_Opr FrameMap::map_to_opr(BasicType type, VMRegPair* reg, bool outgoing) {
// The calling convention does not count the SharedRuntime::out_preserve_stack_slots() value
// so we must add it in here.
int st_off = (r_1->reg2stack() + SharedRuntime::out_preserve_stack_slots()) * VMRegImpl::stack_slot_size;
opr = LIR_OprFact::address(new LIR_Address(SP_opr, st_off + STACK_BIAS, type));
opr = LIR_OprFact::address(new LIR_Address(SP_opr, st_off, type));
} else if (r_1->is_Register()) {
Register reg = r_1->as_Register();
//if (outgoing) {
@ -362,7 +362,7 @@ void FrameMap::initialize() {
Address FrameMap::make_new_address(ByteSize sp_offset) const {
return Address(R1_SP, STACK_BIAS + in_bytes(sp_offset));
return Address(R1_SP, in_bytes(sp_offset));
}
@ -394,5 +394,5 @@ bool FrameMap::validate_frame() {
}
java_index += type2size[opr->type()];
}
return Assembler::is_simm16(max_offset + STACK_BIAS);
return Assembler::is_simm16(max_offset);
}

@ -1197,7 +1197,7 @@ void LIR_Assembler::stack2reg(LIR_Opr src, LIR_Opr dest, BasicType type) {
addr = frame_map()->address_for_double_slot(src->double_stack_ix());
}
bool unaligned = (addr.disp() - STACK_BIAS) % 8 != 0;
bool unaligned = addr.disp() % 8 != 0;
load(addr.base(), addr.disp(), dest, dest->type(), true /*wide*/, unaligned);
}
@ -1209,7 +1209,7 @@ void LIR_Assembler::reg2stack(LIR_Opr from_reg, LIR_Opr dest, BasicType type, bo
} else if (dest->is_double_word()) {
addr = frame_map()->address_for_slot(dest->double_stack_ix());
}
bool unaligned = (addr.disp() - STACK_BIAS) % 8 != 0;
bool unaligned = addr.disp() % 8 != 0;
store(from_reg, addr.base(), addr.disp(), from_reg->type(), true /*wide*/, unaligned);
}

@ -1,5 +1,5 @@
/*
* Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2005, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2019, SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -309,7 +309,7 @@ void LIRGenerator::store_stack_parameter(LIR_Opr item, ByteSize offset_from_sp)
BasicType t = item->type();
LIR_Opr sp_opr = FrameMap::SP_opr;
if ((t == T_LONG || t == T_DOUBLE) &&
((in_bytes(offset_from_sp) - STACK_BIAS) % 8 != 0)) {
(in_bytes(offset_from_sp) % 8 != 0)) {
__ unaligned_move(item, new LIR_Address(sp_opr, in_bytes(offset_from_sp), t));
} else {
__ move(item, new LIR_Address(sp_opr, in_bytes(offset_from_sp), t));

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -390,7 +390,7 @@ void C1_MacroAssembler::allocate_array(
#ifndef PRODUCT
void C1_MacroAssembler::verify_stack_oop(int stack_offset) {
verify_oop_addr((RegisterOrConstant)(stack_offset + STACK_BIAS), R1_SP, "broken oop in stack slot");
verify_oop_addr((RegisterOrConstant)stack_offset, R1_SP, "broken oop in stack slot");
}
void C1_MacroAssembler::verify_not_null_oop(Register r) {

@ -1,5 +1,5 @@
/*
* Copyright (c) 1999, 2018, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 1999, 2020, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2012, 2018 SAP SE. All rights reserved.
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
@ -199,7 +199,7 @@ static OopMap* save_live_registers(StubAssembler* sasm, bool save_fpu_registers
Register r = as_Register(i);
if (FrameMap::reg_needs_save(r)) {
int sp_offset = cpu_reg_save_offsets[i];
__ std(r, sp_offset + STACK_BIAS, R1_SP);
__ std(r, sp_offset, R1_SP);
}
}
@ -207,7 +207,7 @@ static OopMap* save_live_registers(StubAssembler* sasm, bool save_fpu_registers
for (i = 0; i < FrameMap::nof_fpu_regs; i++) {
FloatRegister r = as_FloatRegister(i);
int sp_offset = fpu_reg_save_offsets[i];
__ stfd(r, sp_offset + STACK_BIAS, R1_SP);
__ stfd(r, sp_offset, R1_SP);
}
}
@ -220,7 +220,7 @@ static void restore_live_registers(StubAssembler* sasm, Register result1, Regist
Register r = as_Register(i);
if (FrameMap::reg_needs_save(r) && r != result1 && r != result2) {
int sp_offset = cpu_reg_save_offsets[i];
__ ld(r, sp_offset + STACK_BIAS, R1_SP);
__ ld(r, sp_offset, R1_SP);
}
}
@ -228,7 +228,7 @@ static void restore_live_registers(StubAssembler* sasm, Register result1, Regist
for (int i = 0; i < FrameMap::nof_fpu_regs; i++) {
FloatRegister r = as_FloatRegister(i);
int sp_offset = fpu_reg_save_offsets[i];
__ lfd(r, sp_offset + STACK_BIAS, R1_SP);
__ lfd(r, sp_offset, R1_SP);
}
}

@ -1033,8 +1033,8 @@ static void simple_move32(MacroAssembler* masm, VMRegPair src, VMRegPair dst) {
if (src.first()->is_stack()) {
if (dst.first()->is_stack()) {
// stack to stack
// __ ld(FP, reg2offset(src.first()) + STACK_BIAS, L5);
// __ st(L5, SP, reg2offset(dst.first()) + STACK_BIAS);
// __ ld(FP, reg2offset(src.first()), L5);
// __ st(L5, SP, reg2offset(dst.first()));
__ movl2ptr(rax, Address(rbp, reg2offset_in(src.first())));
__ movptr(Address(rsp, reg2offset_out(dst.first())), rax);
} else {

@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2016, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
@ -82,7 +82,7 @@ CallingConvention* FrameMap::java_calling_convention(const BasicTypeArray* signa
if (opr->is_address()) {
LIR_Address* addr = opr->as_address_ptr();
assert(addr->disp() == (int)addr->disp(), "out of range value");
out_preserve = MAX2(out_preserve, (intptr_t)(addr->disp() - STACK_BIAS) / 4);
out_preserve = MAX2(out_preserve, (intptr_t)addr->disp() / 4);
}
i += type2size[t];
}
@ -133,7 +133,7 @@ CallingConvention* FrameMap::c_calling_convention(const BasicTypeArray* signatur
args->append(opr);
if (opr->is_address()) {
LIR_Address* addr = opr->as_address_ptr();
out_preserve = MAX2(out_preserve, (intptr_t)(addr->disp() - STACK_BIAS) / 4);
out_preserve = MAX2(out_preserve, (intptr_t)addr->disp() / 4);
}
i += type2size[t];
}
@ -174,7 +174,7 @@ FrameMap::FrameMap(ciMethod* method, int monitors, int reserved_argument_area_si
LIR_Opr opr = _incoming_arguments->at(i);
if (opr->is_address()) {
LIR_Address* address = opr->as_address_ptr();
_argument_locations->at_put(java_index, address->disp() - STACK_BIAS);
_argument_locations->at_put(java_index, address->disp());
_incoming_arguments->args()->at_put(i, LIR_OprFact::stack(java_index, as_BasicType(as_ValueType(address->type()))));
}
java_index += type2size[opr->type()];

@ -381,7 +381,6 @@
#define VM_INT_CONSTANTS(declare_constant, declare_constant_with_value, declare_preprocessor_constant) \
declare_preprocessor_constant("ASSERT", DEBUG_ONLY(1) NOT_DEBUG(0)) \
declare_preprocessor_constant("FIELDINFO_TAG_SIZE", FIELDINFO_TAG_SIZE) \
declare_preprocessor_constant("STACK_BIAS", STACK_BIAS) \
\
declare_constant(CompLevel_none) \
declare_constant(CompLevel_simple) \

@ -99,7 +99,7 @@ void GraphKit::gen_stub(address C_function,
// users will look at the other fields.
//
Node *adr_sp = basic_plus_adr(top(), thread, in_bytes(JavaThread::last_Java_sp_offset()));
Node *last_sp = basic_plus_adr(top(), frameptr(), (intptr_t) STACK_BIAS);
Node *last_sp = frameptr();
store_to_memory(NULL, adr_sp, last_sp, T_ADDRESS, NoAlias, MemNode::unordered);
// Set _thread_in_native

@ -2036,12 +2036,6 @@ typedef HashtableEntry<InstanceKlass*, mtClass> KlassHashtableEntry;
\
declare_preprocessor_constant("ASSERT", DEBUG_ONLY(1) NOT_DEBUG(0)) \
\
/**************/ \
/* Stack bias */ \
/**************/ \
\
declare_preprocessor_constant("STACK_BIAS", STACK_BIAS) \
\
/****************/ \
/* Object sizes */ \
/****************/ \

@ -790,9 +790,6 @@ class JavaValue {
};
#define STACK_BIAS 0
// TosState describes the top-of-stack state before and after the execution of
// a bytecode or method. The top-of-stack value may be cached in one or more CPU
// registers. The TosState corresponds to the 'machine representation' of this cached

@ -76,7 +76,6 @@ public class VM {
private boolean isBigEndian;
/** This is only present if in a debugging system */
private JVMDebugger debugger;
private long stackBias;
private long logAddressSize;
private Universe universe;
private ObjectHeap heap;
@ -443,7 +442,6 @@ public class VM {
checkVMVersion(vmRelease);
stackBias = db.lookupIntConstant("STACK_BIAS").intValue();
invocationEntryBCI = db.lookupIntConstant("InvocationEntryBci").intValue();
// We infer the presence of JVMTI from the presence of the InstanceKlass::_breakpoints field.
@ -672,11 +670,6 @@ public class VM {
return db.getJIntType().getSize();
}
/** NOTE: this offset is in BYTES in this system! */
public long getStackBias() {
return stackBias;
}
/** Indicates whether the underlying machine supports the LP64 data
model. This is needed for conditionalizing code in a few places */
public boolean isLP64() {

@ -209,7 +209,7 @@ public class GraalHotSpotVMConfig extends GraalHotSpotVMConfigBase {
public final int stackShadowPages = getFlag("StackShadowPages", Integer.class);
public final int stackReservedPages = getFlag("StackReservedPages", Integer.class, 0);
public final boolean useStackBanging = getFlag("UseStackBanging", Boolean.class);
public final int stackBias = getConstant("STACK_BIAS", Integer.class);
public final int stackBias = getConstant("STACK_BIAS", Integer.class, 0);
public final int vmPageSize = getFieldValue("CompilerToVM::Data::vm_page_size", Integer.class, "int");
public final int markOffset = getFieldOffset("oopDesc::_mark", Integer.class, markWord);