Skip to content

Commit

Permalink
fix build errors on alt platforms
Browse files Browse the repository at this point in the history
  • Loading branch information
pchilano committed Sep 26, 2024
1 parent c917a4a commit bd4a473
Show file tree
Hide file tree
Showing 15 changed files with 70 additions and 39 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/cpu/arm/c1_Runtime1_arm.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ void Runtime1::initialize_pd() {
}

uint Runtime1::runtime_blob_current_thread_offset(frame f) {
unimplemented();
Unimplemented();
return 0;
}

Expand Down
6 changes: 5 additions & 1 deletion src/hotspot/cpu/arm/continuationFreezeThaw_arm.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
Unimplemented();
}

inline intptr_t* ThawBase::push_resume_adapter(frame& top, bool is_interpreted_frame) {
inline void ThawBase::fix_native_wrapper_return_pc_pd(frame& top) {
Unimplemented();
}

inline intptr_t* ThawBase::push_resume_adapter(frame& top) {
Unimplemented();
return nullptr;
}
Expand Down
6 changes: 5 additions & 1 deletion src/hotspot/cpu/ppc/continuationFreezeThaw_ppc.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -547,7 +547,11 @@ inline void ThawBase::derelativize_interpreted_frame_metadata(const frame& hf, c
// Keep top_frame_sp relativized.
}

inline intptr_t* ThawBase::push_resume_adapter(frame& top, bool is_interpreted_frame) {
inline void ThawBase::fix_native_wrapper_return_pc_pd(frame& top) {
Unimplemented();
}

inline intptr_t* ThawBase::push_resume_adapter(frame& top) {
Unimplemented();
return nullptr;
}
Expand Down
6 changes: 5 additions & 1 deletion src/hotspot/cpu/s390/continuationFreezeThaw_s390.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
Unimplemented();
}

inline intptr_t* ThawBase::push_resume_adapter(frame& top, bool is_interpreted_frame) {
inline void ThawBase::fix_native_wrapper_return_pc_pd(frame& top) {
Unimplemented();
}

inline intptr_t* ThawBase::push_resume_adapter(frame& top) {
Unimplemented();
return nullptr;
}
Expand Down
5 changes: 5 additions & 0 deletions src/hotspot/cpu/x86/c1_Runtime1_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -639,7 +639,12 @@ void Runtime1::initialize_pd() {
}

uint Runtime1::runtime_blob_current_thread_offset(frame f) {
#ifdef _LP64
return r15_off / 2;
#else
Unimplemented();
return 0;
#endif
}

// Target: the entry point of the method that creates and posts the exception oop.
Expand Down
2 changes: 2 additions & 0 deletions src/hotspot/cpu/x86/templateInterpreterGenerator_x86.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1178,6 +1178,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
// change thread state
__ movl(Address(thread, JavaThread::thread_state_offset()), _thread_in_Java);

#ifdef _LP64
if (LockingMode != LM_LEGACY) {
// Check preemption for Object.wait()
Label not_preempted;
Expand All @@ -1192,6 +1193,7 @@ address TemplateInterpreterGenerator::generate_native_entry(bool synchronized) {
__ push(ltos);
__ bind(not_preempted);
}
#endif // _LP64

// reset_last_Java_frame
__ reset_last_Java_frame(thread, true);
Expand Down
6 changes: 5 additions & 1 deletion src/hotspot/cpu/zero/continuationFreezeThaw_zero.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,11 @@ inline void ThawBase::patch_pd(frame& f, intptr_t* caller_sp) {
Unimplemented();
}

inline intptr_t* ThawBase::push_resume_adapter(frame top, bool is_interpreted_frame) {
inline void ThawBase::fix_native_wrapper_return_pc_pd(frame& top) {
Unimplemented();
}

inline intptr_t* ThawBase::push_resume_adapter(frame& top) {
Unimplemented();
return nullptr;
}
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/interpreter/zero/zeroInterpreter.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ class ZeroInterpreter: public AbstractInterpreter {
static address throw_NullPointerException_entry() { return nullptr; }
static address throw_ArithmeticException_entry() { return nullptr; }
static address throw_StackOverflowError_entry() { return nullptr; }
static address cont_resume_interpreter_adapter() { return nullptr; }

# include "zeroInterpreter_zero.hpp"
};
Expand Down
3 changes: 2 additions & 1 deletion src/hotspot/share/oops/stackChunkOop.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,9 @@
#include "memory/universe.hpp"
#include "oops/access.inline.hpp"
#include "oops/instanceStackChunkKlass.inline.hpp"
#include "runtime/continuation.hpp"
#include "runtime/continuationJavaClasses.inline.hpp"
#include "runtime/frame.inline.hpp"
#include "runtime/frame.hpp"
#include "runtime/globals.hpp"
#include "runtime/handles.inline.hpp"
#include "runtime/objectMonitor.hpp"
Expand Down
9 changes: 5 additions & 4 deletions src/hotspot/share/runtime/continuation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ JVM_ENTRY(void, CONT_unpin(JNIEnv* env, jclass cls)) {
}
JVM_END

#ifdef LOOM_MONITOR_SUPPORT

#if INCLUDE_JVMTI
class JvmtiUnmountBeginMark : public StackObj {
Handle _vthread;
Expand Down Expand Up @@ -117,7 +119,7 @@ static bool is_safe_vthread_to_preempt_for_jvmti(JavaThread* target, oop vthread
}
return true;
}
#endif
#endif // INCLUDE_JVMTI

static bool is_safe_vthread_to_preempt(JavaThread* target, oop vthread) {
if (!java_lang_VirtualThread::is_instance(vthread) || // inside transition
Expand All @@ -129,7 +131,6 @@ static bool is_safe_vthread_to_preempt(JavaThread* target, oop vthread) {

typedef int (*FreezeContFnT)(JavaThread*, intptr_t*, int);

#ifdef LOOM_MONITOR_SUPPORT
int Continuation::try_preempt(JavaThread* target, oop continuation, int preempt_kind) {
assert(target == JavaThread::current(), "no support for external preemption");
assert(target->has_last_Java_frame(), "");
Expand All @@ -139,7 +140,7 @@ int Continuation::try_preempt(JavaThread* target, oop continuation, int preempt_
assert(!is_continuation_preempted(continuation), "");
assert(Continuation::continuation_scope(continuation) == java_lang_VirtualThread::vthread_scope(), "");
assert(!target->has_pending_exception(), "");
assert(!target->is_suspended() || target->is_disable_suspend() || target->obj_locker_count() > 0, "");
assert(!target->is_suspended() JVMTI_ONLY(|| target->is_disable_suspend()) || target->obj_locker_count() > 0, "");

if (LockingMode == LM_LEGACY) {
return freeze_unsupported;
Expand Down Expand Up @@ -168,7 +169,7 @@ int Continuation::try_preempt(JavaThread* target, oop continuation, int preempt_
}
return res;
}
#endif
#endif // LOOM_MONITOR_SUPPORT

bool Continuation::is_continuation_preempted(oop cont) {
return jdk_internal_vm_Continuation::is_preempted(cont);
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/runtime/continuationFreezeThaw.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2452,6 +2452,7 @@ intptr_t* ThawBase::handle_preempted_continuation(intptr_t* sp, int preempt_kind
_cont.set_preempted(false);

#if INCLUDE_JVMTI
assert(_thread->is_in_VTMS_transition(), "must be");
bool is_vthread = Continuation::continuation_scope(_cont.continuation()) == java_lang_VirtualThread::vthread_scope();
if (is_vthread) {
if (JvmtiVTMSTransitionDisabler::VTMS_notify_jvmti_events()) {
Expand Down
1 change: 1 addition & 0 deletions src/hotspot/share/runtime/continuationHelper.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@
#include "runtime/frame.inline.hpp"
#include "runtime/objectMonitor.hpp"
#include "runtime/stackValue.hpp"
#include "runtime/synchronizer.hpp"
#include "utilities/macros.hpp"

#include CPU_HEADER_INLINE(continuationHelper)
Expand Down
32 changes: 32 additions & 0 deletions src/hotspot/share/runtime/frame.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,9 @@
#include "utilities/debug.hpp"
#include "utilities/decoder.hpp"
#include "utilities/formatBuffer.hpp"
#ifdef COMPILER1
#include "c1/c1_Runtime1.hpp"
#endif

RegisterMap::RegisterMap(JavaThread *thread, UpdateMap update_map, ProcessFrames process_frames, WalkContinuation walk_cont) {
_thread = thread;
Expand Down Expand Up @@ -497,6 +500,35 @@ jint frame::interpreter_frame_expression_stack_size() const {
return (jint)stack_size;
}

#ifdef ASSERT
static address get_register_address_in_stub(const frame& stub_fr, VMReg reg) {
RegisterMap map(nullptr,
RegisterMap::UpdateMap::include,
RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::skip);
stub_fr.oop_map()->update_register_map(&stub_fr, &map);
return map.location(reg, stub_fr.sp());
}
#endif

JavaThread** frame::saved_thread_address(const frame& f) {
CodeBlob* cb = f.cb();
assert(cb != nullptr && cb->is_runtime_stub(), "invalid frame");

JavaThread** thread_addr;
#ifdef COMPILER1
if (cb == Runtime1::blob_for(C1StubId::monitorenter_id) ||
cb == Runtime1::blob_for(C1StubId::monitorenter_nofpu_id)) {
thread_addr = (JavaThread**)(f.sp() + Runtime1::runtime_blob_current_thread_offset(f));
} else
#endif
{
// c2 only saves rbp in the stub frame so nothing to do.
thread_addr = nullptr;
}
assert(get_register_address_in_stub(f, SharedRuntime::thread_register()) == (address)thread_addr, "wrong thread address");
return thread_addr;
}

// (frame::interpreter_frame_sender_sp accessor is in frame_<arch>.cpp)

Expand Down
28 changes: 0 additions & 28 deletions src/hotspot/share/runtime/frame.inline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@

#include "runtime/frame.hpp"

#include "c1/c1_Runtime1.hpp"
#include "code/codeBlob.inline.hpp"
#include "code/nmethod.inline.hpp"
#include "interpreter/interpreter.hpp"
Expand Down Expand Up @@ -82,33 +81,6 @@ inline address frame::get_deopt_original_pc() const {
return nullptr;
}

#ifdef ASSERT
static address get_register_address_in_stub(const frame& stub_fr, VMReg reg) {
RegisterMap map(nullptr,
RegisterMap::UpdateMap::include,
RegisterMap::ProcessFrames::skip,
RegisterMap::WalkContinuation::skip);
stub_fr.oop_map()->update_register_map(&stub_fr, &map);
return map.location(reg, stub_fr.sp());
}
#endif

inline JavaThread** frame::saved_thread_address(const frame& f) {
CodeBlob* cb = f.cb();
assert(cb != nullptr && cb->is_runtime_stub(), "invalid frame");

JavaThread** thread_addr;
if (cb == Runtime1::blob_for(C1StubId::monitorenter_id) ||
cb == Runtime1::blob_for(C1StubId::monitorenter_nofpu_id)) {
thread_addr = (JavaThread**)(f.sp() + Runtime1::runtime_blob_current_thread_offset(f));
} else {
// c2 only saves rbp in the stub frame so nothing to do.
thread_addr = nullptr;
}
assert(get_register_address_in_stub(f, SharedRuntime::thread_register()) == (address)thread_addr, "wrong thread address");
return thread_addr;
}

template <typename RegisterMapT>
inline address frame::oopmapreg_to_location(VMReg reg, const RegisterMapT* reg_map) const {
if (reg->is_reg()) {
Expand Down
1 change: 0 additions & 1 deletion src/hotspot/share/runtime/objectMonitor.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1216,7 +1216,6 @@ bool ObjectMonitor::VThreadMonitorEnter(JavaThread* current, ObjectWaiter* waite

bool ObjectMonitor::resume_operation(JavaThread* current, ObjectWaiter* node, ContinuationWrapper& cont) {
assert(java_lang_VirtualThread::state(current->vthread()) == java_lang_VirtualThread::RUNNING, "wrong state for vthread");
assert(current->is_in_VTMS_transition(), "must be");

if (node->is_wait() && !node->at_reenter()) {
bool acquired_monitor = VThreadWaitReenter(current, node, cont);
Expand Down

0 comments on commit bd4a473

Please sign in to comment.