Skip to content

Commit

Permalink
OMWorld Lilliput changes
Browse files Browse the repository at this point in the history
  • Loading branch information
stefank committed Apr 10, 2024
1 parent 916d095 commit 4363dd8
Show file tree
Hide file tree
Showing 23 changed files with 10 additions and 189 deletions.
9 changes: 0 additions & 9 deletions src/hotspot/cpu/aarch64/c1_CodeStubs_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@
#include "c1/c1_Runtime1.hpp"
#include "classfile/javaClasses.hpp"
#include "nativeInst_aarch64.hpp"
#include "runtime/objectMonitor.hpp"
#include "runtime/sharedRuntime.hpp"
#include "vmreg_aarch64.inline.hpp"

Expand Down Expand Up @@ -234,14 +233,6 @@ void MonitorExitStub::emit_code(LIR_Assembler* ce) {
__ far_jump(RuntimeAddress(Runtime1::entry_for(exit_id)));
}

void LoadKlassStub::emit_code(LIR_Assembler* ce) {
assert(UseCompactObjectHeaders, "Only use with compact object headers");
__ bind(_entry);
Register d = _result->as_register();
__ ldr(d, Address(d, OM_OFFSET_NO_MONITOR_VALUE_TAG(header)));
__ b(_continuation);
}

// Implementation of patching:
// - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes)
// - Replace original code with a call to the stub
Expand Down
11 changes: 0 additions & 11 deletions src/hotspot/cpu/aarch64/c2_CodeStubs_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,4 @@ void C2HandleAnonOMOwnerStub::emit(C2_MacroAssembler& masm) {
__ b(continuation());
}

int C2LoadNKlassStub::max_size() const {
return 8;
}

void C2LoadNKlassStub::emit(C2_MacroAssembler& masm) {
__ bind(entry());
Register d = dst();
__ ldr(d, Address(d, OM_OFFSET_NO_MONITOR_VALUE_TAG(header)));
__ b(continuation());
}

#undef __
8 changes: 0 additions & 8 deletions src/hotspot/cpu/aarch64/c2_MacroAssembler_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2853,9 +2853,6 @@ bool C2_MacroAssembler::in_scratch_emit_size() {
}

void C2_MacroAssembler::load_nklass_compact(Register dst, Register obj, Register index, int scale, int disp) {
C2LoadNKlassStub* stub = new (Compile::current()->comp_arena()) C2LoadNKlassStub(dst);
Compile::current()->output()->add_stub(stub);

// Note: Don't clobber obj anywhere in that method!

// The incoming address is pointing into obj-start + klass_offset_in_bytes. We need to extract
Expand All @@ -2871,10 +2868,5 @@ void C2_MacroAssembler::load_nklass_compact(Register dst, Register obj, Register
lea(dst, Address(obj, index, Address::lsl(scale)));
ldr(dst, Address(dst, offset));
}
// NOTE: We can't use tbnz here, because the target is sometimes too far away
// and cannot be encoded.
tst(dst, markWord::monitor_value);
br(Assembler::NE, stub->entry());
bind(stub->continuation());
lsr(dst, dst, markWord::klass_shift);
}
10 changes: 0 additions & 10 deletions src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -4483,17 +4483,7 @@ void MacroAssembler::load_method_holder(Register holder, Register method) {
void MacroAssembler::load_nklass(Register dst, Register src) {
assert(UseCompactObjectHeaders, "expects UseCompactObjectHeaders");

Label fast;

// Check if we can take the (common) fast path, if obj is unlocked.
ldr(dst, Address(src, oopDesc::mark_offset_in_bytes()));
tbz(dst, exact_log2(markWord::monitor_value), fast);

// Fetch displaced header
ldr(dst, Address(dst, OM_OFFSET_NO_MONITOR_VALUE_TAG(header)));

// Fast-path: shift and decode Klass*.
bind(fast);
lsr(dst, dst, markWord::klass_shift);
}

Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/arm/c1_CodeStubs_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,11 +217,6 @@ void MonitorExitStub::emit_code(LIR_Assembler* ce) {
__ b(_continuation);
}

void LoadKlassStub::emit_code(LIR_Assembler* ce) {
// Currently not needed.
Unimplemented();
}

// Call return is directly after patch word
int PatchingStub::_patch_info_offset = 0;

Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/ppc/c1_CodeStubs_ppc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -298,11 +298,6 @@ void MonitorExitStub::emit_code(LIR_Assembler* ce) {
__ b(_continuation);
}

void LoadKlassStub::emit_code(LIR_Assembler* ce) {
// Currently not needed.
Unimplemented();
}

// Implementation of patching:
// - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes).
// - Replace original code with a call to the stub.
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/s390/c1_CodeStubs_s390.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -253,11 +253,6 @@ void MonitorExitStub::emit_code(LIR_Assembler* ce) {
__ branch_optimized(Assembler::bcondAlways, _continuation);
}

void LoadKlassStub::emit_code(LIR_Assembler* ce) {
// Currently not needed.
Unimplemented();
}

// Implementation of patching:
// - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes).
// - Replace original code with a call to the stub.
Expand Down
13 changes: 0 additions & 13 deletions src/hotspot/cpu/x86/c1_CodeStubs_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
#include "c1/c1_Runtime1.hpp"
#include "classfile/javaClasses.hpp"
#include "nativeInst_x86.hpp"
#include "runtime/objectMonitor.hpp"
#include "runtime/sharedRuntime.hpp"
#include "utilities/align.hpp"
#include "utilities/macros.hpp"
Expand Down Expand Up @@ -279,18 +278,6 @@ void MonitorExitStub::emit_code(LIR_Assembler* ce) {
__ jmp(_continuation);
}

void LoadKlassStub::emit_code(LIR_Assembler* ce) {
assert(UseCompactObjectHeaders, "only with compact headers");
__ bind(_entry);
#ifdef _LP64
Register d = _result->as_register();
__ movq(d, Address(d, OM_OFFSET_NO_MONITOR_VALUE_TAG(header)));
__ jmp(_continuation);
#else
__ should_not_reach_here();
#endif
}

// Implementation of patching:
// - Copy the code at given offset to an inlined buffer (first the bytes, then the number of bytes)
// - Replace original code with a call to the stub
Expand Down
5 changes: 0 additions & 5 deletions src/hotspot/cpu/x86/c1_LIRAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3507,12 +3507,7 @@ void LIR_Assembler::emit_load_klass(LIR_OpLoadKlass* op) {
assert_different_registers(tmp, obj);
assert_different_registers(tmp, result);

// Check if we can take the (common) fast path, if obj is unlocked.
__ movq(result, Address(obj, oopDesc::mark_offset_in_bytes()));
__ testb(result, markWord::monitor_value);
__ jcc(Assembler::notZero, *op->stub()->entry());
__ bind(*op->stub()->continuation());
// Fast-path: shift and decode Klass*.
__ shrq(result, markWord::klass_shift);
__ decode_klass_not_null(result, tmp);
} else if (UseCompressedClassPointers) {
Expand Down
13 changes: 0 additions & 13 deletions src/hotspot/cpu/x86/c2_CodeStubs_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,17 +225,4 @@ void C2FastUnlockPlaceholderStub::emit(C2_MacroAssembler& masm) {
}
}

#ifdef _LP64
int C2LoadNKlassStub::max_size() const {
return 10;
}

void C2LoadNKlassStub::emit(C2_MacroAssembler& masm) {
__ bind(entry());
Register d = dst();
__ movq(d, Address(d, OM_OFFSET_NO_MONITOR_VALUE_TAG(header)));
__ jmp(continuation());
}
#endif

#undef __
6 changes: 0 additions & 6 deletions src/hotspot/cpu/x86/c2_MacroAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -6833,9 +6833,6 @@ void C2_MacroAssembler::vector_rearrange_int_float(BasicType bt, XMMRegister dst

#ifdef _LP64
void C2_MacroAssembler::load_nklass_compact_c2(Register dst, Register obj, Register index, Address::ScaleFactor scale, int disp) {
C2LoadNKlassStub* stub = new (Compile::current()->comp_arena()) C2LoadNKlassStub(dst);
Compile::current()->output()->add_stub(stub);

// Note: Don't clobber obj anywhere in that method!

// The incoming address is pointing into obj-start + klass_offset_in_bytes. We need to extract
Expand All @@ -6846,9 +6843,6 @@ void C2_MacroAssembler::load_nklass_compact_c2(Register dst, Register obj, Regis
// and offset to load the mark-word.
int offset = oopDesc::mark_offset_in_bytes() + disp - oopDesc::klass_offset_in_bytes();
movq(dst, Address(obj, index, scale, offset));
testb(dst, markWord::monitor_value);
jcc(Assembler::notZero, stub->entry());
bind(stub->continuation());
shrq(dst, markWord::klass_shift);
}
#endif
8 changes: 0 additions & 8 deletions src/hotspot/cpu/x86/macroAssembler_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5329,15 +5329,7 @@ void MacroAssembler::load_method_holder(Register holder, Register method) {
void MacroAssembler::load_nklass_compact(Register dst, Register src) {
assert(UseCompactObjectHeaders, "expect compact object headers");

Label fast;
movq(dst, Address(src, oopDesc::mark_offset_in_bytes()));
testb(dst, markWord::monitor_value);
jccb(Assembler::zero, fast);

// Fetch displaced header
movq(dst, Address(dst, OM_OFFSET_NO_MONITOR_VALUE_TAG(header)));

bind(fast);
shrq(dst, markWord::klass_shift);
}
#endif
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/x86/x86_64.ad
Original file line number Diff line number Diff line change
Expand Up @@ -4430,7 +4430,7 @@ instruct loadNKlassCompactHeaders(rRegN dst, memory mem, rFlagsReg cr)
Address::ScaleFactor sf = (index != noreg) ? static_cast<Address::ScaleFactor>($mem$$scale) : Address::no_scale;
__ load_nklass_compact_c2($dst$$Register, $mem$$base$$Register, index, sf, $mem$$disp);
%}
ins_pipe(pipe_slow); // XXX
ins_pipe(ialu_reg_mem); // XXX
%}

// Load Float
Expand Down
18 changes: 0 additions & 18 deletions src/hotspot/share/c1/c1_CodeStubs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -581,22 +581,4 @@ class ArrayCopyStub: public CodeStub {
#endif // PRODUCT
};

class LoadKlassStub: public CodeStub {
private:
LIR_Opr _result;

public:
LoadKlassStub(LIR_Opr result) :
CodeStub(), _result(result) {};

virtual void emit_code(LIR_Assembler* e);
virtual void visit(LIR_OpVisitState* visitor) {
visitor->do_temp(_result);
visitor->do_output(_result);
}
#ifndef PRODUCT
virtual void print_name(outputStream* out) const { out->print("LoadKlassStub"); }
#endif // PRODUCT
};

#endif // SHARE_C1_C1_CODESTUBS_HPP
7 changes: 0 additions & 7 deletions src/hotspot/share/c1/c1_LIR.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -890,7 +890,6 @@ void LIR_OpVisitState::visit(LIR_Op* op) {

do_input(opLoadKlass->_obj);
do_output(opLoadKlass->_result);
if (opLoadKlass->_stub) do_stub(opLoadKlass->_stub);
if (opLoadKlass->_info) do_info(opLoadKlass->_info);
break;
}
Expand Down Expand Up @@ -1071,9 +1070,6 @@ void LIR_OpLock::emit_code(LIR_Assembler* masm) {

void LIR_OpLoadKlass::emit_code(LIR_Assembler* masm) {
masm->emit_load_klass(this);
if (stub()) {
masm->append_code_stub(stub());
}
}

#ifdef ASSERT
Expand Down Expand Up @@ -2050,9 +2046,6 @@ void LIR_OpLock::print_instr(outputStream* out) const {
void LIR_OpLoadKlass::print_instr(outputStream* out) const {
obj()->print(out); out->print(" ");
result_opr()->print(out); out->print(" ");
if (stub()) {
out->print("[lbl:" INTPTR_FORMAT "]", p2i(stub()->entry()));
}
}

#ifdef ASSERT
Expand Down
7 changes: 2 additions & 5 deletions src/hotspot/share/c1/c1_LIR.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -1903,16 +1903,13 @@ class LIR_OpLoadKlass: public LIR_Op {

private:
LIR_Opr _obj;
CodeStub* _stub;
public:
LIR_OpLoadKlass(LIR_Opr obj, LIR_Opr result, CodeEmitInfo* info, CodeStub* stub)
LIR_OpLoadKlass(LIR_Opr obj, LIR_Opr result, CodeEmitInfo* info)
: LIR_Op(lir_load_klass, result, info)
, _obj(obj)
, _stub(stub)
{}

LIR_Opr obj() const { return _obj; }
CodeStub* stub() const { return _stub; }

virtual LIR_OpLoadKlass* as_OpLoadKlass() { return this; }
virtual void emit_code(LIR_Assembler* masm);
Expand Down Expand Up @@ -2378,7 +2375,7 @@ class LIR_List: public CompilationResourceObj {
void xadd(LIR_Opr src, LIR_Opr add, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xadd, src, add, res, tmp)); }
void xchg(LIR_Opr src, LIR_Opr set, LIR_Opr res, LIR_Opr tmp) { append(new LIR_Op2(lir_xchg, src, set, res, tmp)); }

void load_klass(LIR_Opr obj, LIR_Opr result, CodeEmitInfo* info, CodeStub* stub) { append(new LIR_OpLoadKlass(obj, result, info, stub)); }
void load_klass(LIR_Opr obj, LIR_Opr result, CodeEmitInfo* info) { append(new LIR_OpLoadKlass(obj, result, info)); }

#ifdef ASSERT
void lir_assert(LIR_Condition condition, LIR_Opr opr1, LIR_Opr opr2, const char* msg, bool halt) { append(new LIR_OpAssert(condition, opr1, opr2, msg, halt)); }
Expand Down
3 changes: 1 addition & 2 deletions src/hotspot/share/c1/c1_LIRGenerator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1256,8 +1256,7 @@ void LIRGenerator::do_isInstance(Intrinsic* x) {
}

void LIRGenerator::load_klass(LIR_Opr obj, LIR_Opr klass, CodeEmitInfo* null_check_info) {
CodeStub* slow_path = UseCompactObjectHeaders ? new LoadKlassStub(klass) : nullptr;
__ load_klass(obj, klass, null_check_info, slow_path);
__ load_klass(obj, klass, null_check_info);
}

// Example: object.getClass ()
Expand Down
2 changes: 0 additions & 2 deletions src/hotspot/share/oops/oop.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,6 @@ class oopDesc {
inline markWord cas_set_mark(markWord new_mark, markWord old_mark);
inline markWord cas_set_mark(markWord new_mark, markWord old_mark, atomic_memory_order order);

inline markWord resolve_mark() const;

// Returns the prototype mark that should be used for this object.
inline markWord prototype_mark() const;

Expand Down
21 changes: 3 additions & 18 deletions src/hotspot/share/oops/oop.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -83,15 +83,6 @@ markWord oopDesc::cas_set_mark(markWord new_mark, markWord old_mark, atomic_memo
return Atomic::cmpxchg(&_mark, old_mark, new_mark, order);
}

markWord oopDesc::resolve_mark() const {
assert(LockingMode != LM_LEGACY, "Not safe with legacy stack-locking");
markWord m = mark();
if (m.has_displaced_mark_helper()) {
m = m.displaced_mark_helper();
}
return m;
}

markWord oopDesc::prototype_mark() const {
if (UseCompactObjectHeaders) {
return klass()->prototype_header();
Expand All @@ -111,8 +102,7 @@ void oopDesc::init_mark() {
Klass* oopDesc::klass() const {
#ifdef _LP64
if (UseCompactObjectHeaders) {
markWord m = resolve_mark();
return m.klass();
return mark().klass();
} else if (UseCompressedClassPointers) {
return CompressedKlassPointers::decode_not_null(_metadata._compressed_klass);
} else
Expand All @@ -125,8 +115,7 @@ Klass* oopDesc::klass() const {
Klass* oopDesc::klass_or_null() const {
#ifdef _LP64
if (UseCompactObjectHeaders) {
markWord m = resolve_mark();
return m.klass_or_null();
return mark().klass_or_null();
} else if (UseCompressedClassPointers) {
return CompressedKlassPointers::decode(_metadata._compressed_klass);
} else
Expand All @@ -139,11 +128,7 @@ Klass* oopDesc::klass_or_null() const {
Klass* oopDesc::klass_or_null_acquire() const {
#ifdef _LP64
if (UseCompactObjectHeaders) {
markWord m = mark_acquire();
if (m.has_displaced_mark_helper()) {
m = m.displaced_mark_helper();
}
return m.klass_or_null();
return mark_acquire().klass_or_null();
} else if (UseCompressedClassPointers) {
narrowKlass nklass = Atomic::load_acquire(&_metadata._compressed_klass);
return CompressedKlassPointers::decode(nklass);
Expand Down
10 changes: 0 additions & 10 deletions src/hotspot/share/opto/c2_CodeStubs.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,16 +130,6 @@ class C2HandleAnonOMOwnerStub : public C2CodeStub {
int max_size() const;
void emit(C2_MacroAssembler& masm);
};

class C2LoadNKlassStub : public C2CodeStub {
private:
Register _dst;
public:
C2LoadNKlassStub(Register dst) : C2CodeStub(), _dst(dst) {}
Register dst() { return _dst; }
int max_size() const;
void emit(C2_MacroAssembler& masm);
};
#endif

class C2FastUnlockPlaceholderStub : public C2CodeStub {
Expand Down
Loading

0 comments on commit 4363dd8

Please sign in to comment.