Skip to content

Commit 31a60db

Browse files
committed
s390 port: build fixed
1 parent 10e3841 commit 31a60db

File tree

3 files changed

+112
-6
lines changed

3 files changed

+112
-6
lines changed

src/hotspot/cpu/s390/frame_s390.hpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -475,6 +475,7 @@
475475
public:
476476
// To be used, if sp was not extended to match callee's calling convention.
477477
inline frame(intptr_t* sp, address pc, intptr_t* unextended_sp = nullptr, intptr_t* fp = nullptr, CodeBlob* cb = nullptr);
478+
inline frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc, CodeBlob* cb, const ImmutableOopMap* oop_map = nullptr);
478479

479480
// Access frame via stack pointer.
480481
inline intptr_t* sp_addr_at(int index) const { return &sp()[index]; }

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

Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,6 +87,11 @@ inline frame::frame(intptr_t* sp, address pc, intptr_t* unextended_sp, intptr_t*
8787

8888
inline frame::frame(intptr_t* sp) : frame(sp, nullptr) {}
8989

90+
inline frame::frame(intptr_t* sp, intptr_t* unextended_sp, intptr_t* fp, address pc, CodeBlob* cb, const ImmutableOopMap* oop_map)
91+
:_sp(sp), _pc(pc), _cb(cb), _oop_map(oop_map), _on_heap(false), DEBUG_ONLY(_frame_index(-1) COMMA) _unextended_sp(unextended_sp), _fp(fp) {
92+
setup();
93+
}
94+
9095
// Generic constructor. Used by pns() in debug.cpp only
9196
#ifndef PRODUCT
9297
inline frame::frame(void* sp, void* pc, void* unextended_sp)
@@ -371,4 +376,42 @@ void frame::update_map_with_saved_link(RegisterMapT* map, intptr_t** link_addr)
371376
Unimplemented();
372377
}
373378

379+
#if INCLUDE_JFR
380+
381+
// Static helper routines
382+
inline intptr_t* frame::sender_sp(intptr_t* fp) { return fp; }
383+
384+
// Extract common_abi parts.
385+
inline intptr_t* frame::fp(const intptr_t* sp) {
386+
assert(sp != nullptr, "invariant");
387+
return reinterpret_cast<intptr_t*>(((z_common_abi*)sp)->callers_sp);
388+
}
389+
390+
inline intptr_t* frame::link(const intptr_t* fp) { return frame::fp(fp); }
391+
392+
inline address frame::return_address(const intptr_t* sp) {
393+
assert(sp != nullptr, "invariant");
394+
return reinterpret_cast<address>(((z_common_abi*)sp)->return_pc);
395+
}
396+
397+
inline address frame::interpreter_return_address(const intptr_t* fp) { return frame::return_address(fp); }
398+
399+
inline address frame::interpreter_bcp(const intptr_t* fp) {
400+
assert(fp != nullptr, "invariant");
401+
return reinterpret_cast<address>(*(fp + _z_ijava_idx(bcp)));
402+
}
403+
404+
inline intptr_t* frame::interpreter_sender_sp(const intptr_t* fp) {
405+
assert(fp != nullptr, "invariant");
406+
return reinterpret_cast<intptr_t*>(*(fp + _z_ijava_idx(sender_sp)));
407+
}
408+
409+
inline bool frame::is_interpreter_frame_setup_at(const intptr_t* fp, const void* sp) {
410+
assert(fp != nullptr, "invariant");
411+
assert(sp != nullptr, "invariant");
412+
return sp <= fp - ((frame::z_ijava_state_size + frame::z_top_ijava_frame_abi_size) >> LogBytesPerWord);
413+
}
414+
415+
#endif // INCLUDE_JFR
416+
374417
#endif // CPU_S390_FRAME_S390_INLINE_HPP

src/hotspot/cpu/s390/sharedRuntime_s390.cpp

Lines changed: 68 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -3413,16 +3413,78 @@ int SpinPause() {
34133413
}
34143414

34153415
#if INCLUDE_JFR
3416+
3417+
// For c2: c_rarg0 is junk, call to runtime to write a checkpoint.
3418+
// It returns a jobject handle to the event writer.
3419+
// The handle is dereferenced and the return value is the event writer oop.
34163420
RuntimeStub* SharedRuntime::generate_jfr_write_checkpoint() {
3417-
if (!Continuations::enabled()) return nullptr;
3418-
Unimplemented();
3419-
return nullptr;
3421+
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_write_checkpoint_id);
3422+
CodeBuffer code(name, 512, 64);
3423+
MacroAssembler* masm = new MacroAssembler(&code);
3424+
3425+
int framesize = frame::z_abi_160_size / VMRegImpl::stack_slot_size;
3426+
address start = __ pc();
3427+
__ save_return_pc(); // save return_pc (Z_R14)
3428+
__ push_frame_abi160(0);
3429+
int frame_complete = __ pc() - start;
3430+
__ set_last_Java_frame(Z_SP, noreg);
3431+
3432+
__ call_VM_leaf(CAST_FROM_FN_PTR(address, JfrIntrinsicSupport::write_checkpoint), Z_thread);
3433+
address calls_return_pc = __ last_calls_return_pc();
3434+
3435+
__ reset_last_Java_frame();
3436+
3437+
// The handle is dereferenced through a load barrier.
3438+
__ stop("fuck it");
3439+
__ resolve_global_jobject(Z_ARG1, Z_tmp_1, Z_tmp_2); // Z_R10 & Z_R11, are these live ?
3440+
__ pop_frame();
3441+
__ restore_return_pc();
3442+
__ z_br(Z_R14);
3443+
3444+
OopMapSet* oop_maps = new OopMapSet();
3445+
OopMap* map = new OopMap(framesize, 0);
3446+
oop_maps->add_gc_map(calls_return_pc - start, map);
3447+
3448+
RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
3449+
RuntimeStub::new_runtime_stub(name, &code, frame_complete,
3450+
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
3451+
oop_maps, false);
3452+
3453+
return stub;
34203454
}
34213455

3456+
// For c2: call to return a leased buffer.
34223457
RuntimeStub* SharedRuntime::generate_jfr_return_lease() {
3423-
if (!Continuations::enabled()) return nullptr;
3424-
Unimplemented();
3425-
return nullptr;
3458+
const char* name = SharedRuntime::stub_name(SharedStubId::jfr_return_lease_id);
3459+
CodeBuffer code(name, 512, 64);
3460+
MacroAssembler* masm = new MacroAssembler(&code);
3461+
3462+
int framesize = frame::z_abi_160_size / VMRegImpl::stack_slot_size;
3463+
address start = __ pc();
3464+
__ save_return_pc(); // save return_pc (Z_R14)
3465+
__ push_frame_abi160(0);
3466+
int frame_complete = __ pc() - start;
3467+
__ set_last_Java_frame(Z_SP, noreg);
3468+
__ stop("crahs here");
3469+
__ call_VM_leaf(CAST_FROM_FN_PTR(address, JfrIntrinsicSupport::return_lease), Z_thread);
3470+
address calls_return_pc = __ last_calls_return_pc();
3471+
3472+
__ reset_last_Java_frame();
3473+
3474+
__ pop_frame();
3475+
__ restore_return_pc();
3476+
__ z_br(Z_R14);
3477+
3478+
OopMapSet* oop_maps = new OopMapSet();
3479+
OopMap* map = new OopMap(framesize, 0);
3480+
oop_maps->add_gc_map(calls_return_pc - start, map);
3481+
3482+
RuntimeStub* stub = // codeBlob framesize is in words (not VMRegImpl::slot_size)
3483+
RuntimeStub::new_runtime_stub(name, &code, frame_complete,
3484+
(framesize >> (LogBytesPerWord - LogBytesPerInt)),
3485+
oop_maps, false);
3486+
3487+
return stub;
34263488
}
34273489

34283490
#endif // INCLUDE_JFR

0 commit comments

Comments
 (0)