Skip to content

Commit ec5f732

Browse files
committed
[WIP - JEP 491] Loom: s390 Port
There are couple of traps which are part of JEP 491. So unexpected crash are to expected.
1 parent e4aed95 commit ec5f732

35 files changed

Lines changed: 1641 additions & 283 deletions

src/hotspot/cpu/s390/abstractInterpreter_s390.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,7 +197,8 @@ void AbstractInterpreter::layout_activation(Method* method,
197197
assert(is_bottom_frame && (sender_sp == caller->unextended_sp()),
198198
"must initialize sender_sp of bottom skeleton frame when pushing it");
199199
} else {
200-
assert(caller->is_entry_frame() || caller->is_upcall_stub_frame(), "is there a new frame type??");
200+
// FIXME: sender_sp correctly calculated for native frames ?
201+
assert(caller->is_entry_frame() || caller->is_upcall_stub_frame() || caller->is_native_frame(), "is there a new frame type??");
201202
sender_sp = caller->sp(); // Call_stub only uses it's fp.
202203
}
203204

src/hotspot/cpu/s390/assembler_s390.hpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3279,6 +3279,9 @@ class Assembler : public AbstractAssembler {
32793279
static bool is_z_nop(address x) {
32803280
return is_z_nop(* (short *) x);
32813281
}
3282+
static bool is_z_illtrap(address x) {
3283+
return *(uint16_t*)x == 0u;
3284+
}
32823285
static bool is_z_br(long x) {
32833286
return is_z_bcr(x) && ((x & 0x00f0) == 0x00f0);
32843287
}

src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -511,6 +511,7 @@ void LIR_Assembler::call(LIR_OpJavaCall* op, relocInfo::relocType rtype) {
511511
__ z_nop();
512512
__ z_brasl(Z_R14, op->addr());
513513
add_call_info(code_offset(), op->info());
514+
__ post_call_nop();
514515
}
515516

516517
void LIR_Assembler::ic_call(LIR_OpJavaCall* op) {
@@ -527,6 +528,7 @@ void LIR_Assembler::ic_call(LIR_OpJavaCall* op) {
527528
// to determine who we intended to call.
528529
__ relocate(virtual_call_Relocation::spec(virtual_call_oop_addr));
529530
call(op, relocInfo::none);
531+
__ post_call_nop();
530532
}
531533

532534
void LIR_Assembler::move_regs(Register from_reg, Register to_reg) {
@@ -2839,6 +2841,7 @@ void LIR_Assembler::rt_call(LIR_Opr result, address dest,
28392841
if (info != nullptr) {
28402842
add_call_info_here(info);
28412843
}
2844+
__ post_call_nop();
28422845
}
28432846

28442847
void LIR_Assembler::volatile_move_op(LIR_Opr src, LIR_Opr dest, BasicType type, CodeEmitInfo* info) {

src/hotspot/cpu/s390/compiledIC_s390.cpp

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2016, 2025, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2016, 2026, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2016, 2019 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -29,17 +29,13 @@
2929
#include "memory/resourceArea.hpp"
3030
#include "runtime/mutexLocker.hpp"
3131
#include "runtime/safepoint.hpp"
32-
#ifdef COMPILER2
33-
#include "opto/matcher.hpp"
34-
#endif
3532

3633
// ----------------------------------------------------------------------------
3734

3835
#undef __
3936
#define __ masm->
4037

4138
address CompiledDirectCall::emit_to_interp_stub(MacroAssembler *masm, address mark/* = nullptr*/) {
42-
#ifdef COMPILER2
4339
// Stub is fixed up when the corresponding call is converted from calling
4440
// compiled code to calling interpreted code.
4541
if (mark == nullptr) {
@@ -55,7 +51,7 @@ address CompiledDirectCall::emit_to_interp_stub(MacroAssembler *masm, address ma
5551
__ relocate(static_stub_Relocation::spec(mark));
5652

5753
AddressLiteral meta = __ allocate_metadata_address(nullptr);
58-
bool success = __ load_const_from_toc(as_Register(Matcher::inline_cache_reg_encode()), meta);
54+
bool success = __ load_const_from_toc(Z_inline_cache, meta);
5955

6056
__ set_inst_mark();
6157
AddressLiteral a((address)-1);
@@ -67,10 +63,6 @@ address CompiledDirectCall::emit_to_interp_stub(MacroAssembler *masm, address ma
6763
__ z_br(Z_R1);
6864
__ end_a_stub(); // Update current stubs pointer and restore insts_end.
6965
return stub;
70-
#else
71-
ShouldNotReachHere();
72-
return nullptr;
73-
#endif
7466
}
7567

7668
#undef __

src/hotspot/cpu/s390/continuationEntry_s390.hpp

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@
2525
#ifndef CPU_S390_CONTINUATIONENTRY_S390_HPP
2626
#define CPU_S390_CONTINUATIONENTRY_S390_HPP
2727

28+
#include "runtime/frame.hpp"
29+
2830
class ContinuationEntryPD {
29-
// empty
31+
// This is needed to position the ContinuationEntry at the unextended sp of the entry frame
32+
frame::z_abi_160_base _abi;
3033
};
3134

3235
#endif // CPU_S390_CONTINUATIONENTRY_S390_HPP

src/hotspot/cpu/s390/continuationEntry_s390.inline.hpp

Lines changed: 11 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,22 +25,26 @@
2525
#ifndef CPU_S390_CONTINUATIONENTRY_S390_INLINE_HPP
2626
#define CPU_S390_CONTINUATIONENTRY_S390_INLINE_HPP
2727

28+
#include "oops/method.inline.hpp"
29+
#include "runtime/frame.inline.hpp"
30+
#include "runtime/registerMap.hpp"
31+
#include "utilities/macros.hpp"
2832
#include "runtime/continuationEntry.hpp"
2933

30-
// TODO: Implement
31-
3234
inline frame ContinuationEntry::to_frame() const {
33-
Unimplemented();
34-
return frame();
35+
static CodeBlob* cb = CodeCache::find_blob_fast(entry_pc());
36+
assert(cb != nullptr, "");
37+
assert(cb->as_nmethod()->method()->is_continuation_enter_intrinsic(), "");
38+
return frame(entry_sp(), entry_pc(), entry_sp(), entry_fp(), cb);
3539
}
3640

3741
inline intptr_t* ContinuationEntry::entry_fp() const {
38-
Unimplemented();
39-
return nullptr;
42+
return (intptr_t*)((address)this + size());
4043
}
4144

4245
inline void ContinuationEntry::update_register_map(RegisterMap* map) const {
43-
Unimplemented();
46+
// TODO: need to revisit
47+
// Nothing to do (no non-volatile registers in java calling convention)
4448
}
4549

4650
#endif // CPU_S390_CONTINUATIONENTRY_S390_INLINE_HPP

0 commit comments

Comments
 (0)