Skip to content
forked from openjdk/jdk

Commit

Permalink
Update (2023.03.08)
Browse files Browse the repository at this point in the history
29783: LA port of 8151413: os::allocation_granularity/page_size and friends return signed values
29782: Replace NULL with nullptr in os_cpu/linux_loongarch
  • Loading branch information
loongson-jvm authored Mar 8, 2023
1 parent b1a571e commit 8019771
Show file tree
Hide file tree
Showing 7 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion src/hotspot/cpu/loongarch/interp_masm_loongarch_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -830,7 +830,7 @@ void InterpreterMacroAssembler::lock_object(Register lock_reg) {
// least significant 2 bits clear.
// NOTE: the oopMark is in tmp_reg as the result of cmpxchg
sub_d(tmp_reg, tmp_reg, SP);
li(AT, 7 - os::vm_page_size());
li(AT, 7 - (int)os::vm_page_size());
andr(tmp_reg, tmp_reg, AT);
// Save the test result, for recursive case, the result is zero
st_d(tmp_reg, lock_reg, mark_offset);
Expand Down
4 changes: 2 additions & 2 deletions src/hotspot/cpu/loongarch/macroAssembler_loongarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -389,7 +389,7 @@ void MacroAssembler::bang_stack_size(Register size, Register tmp) {
// Bang one page at a time because large size can bang beyond yellow and
// red zones.
Label loop;
li(AT, os::vm_page_size());
li(AT, (int)os::vm_page_size());
bind(loop);
sub_d(tmp, tmp, AT);
sub_d(size, size, AT);
Expand All @@ -402,7 +402,7 @@ void MacroAssembler::bang_stack_size(Register size, Register tmp) {
// was post-decremented.) Skip this address by starting at i=1, and
// touch a few more pages below. N.B. It is important to touch all
// the way down to and including i=StackShadowPages.
for (int i = 0; i < (int)(StackOverflow::stack_shadow_zone_size() / os::vm_page_size()) - 1; i++) {
for (int i = 0; i < (int)(StackOverflow::stack_shadow_zone_size() / (int)os::vm_page_size()) - 1; i++) {
// this could be any sized move but this is can be a debugging crumb
// so the bigger the better.
sub_d(tmp, tmp, AT);
Expand Down
2 changes: 1 addition & 1 deletion src/hotspot/cpu/loongarch/sharedRuntime_loongarch_64.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1864,7 +1864,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
// NOTE: the oopMark is in swap_reg %T8 as the result of cmpxchg

__ sub_d(swap_reg, swap_reg, SP);
__ li(AT, 3 - os::vm_page_size());
__ li(AT, 3 - (int)os::vm_page_size());
__ andr(swap_reg , swap_reg, AT);
// Save the test result, for recursive case, the result is zero
__ st_d(swap_reg, lock_reg, mark_word_offset);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -750,7 +750,7 @@ void TemplateInterpreterGenerator::generate_stack_overflow_check(void) {
const int overhead_size = -(frame::interpreter_frame_initial_sp_offset*wordSize)
+ entry_size;

const int page_size = os::vm_page_size();
const size_t page_size = os::vm_page_size();
Label after_frame_check;

// see if the frame is greater than one page in size. If so,
Expand Down Expand Up @@ -1516,7 +1516,7 @@ void TemplateInterpreterGenerator::bang_stack_shadow_pages(bool native_call) {
// Bang each page in the shadow zone. We can't assume it's been done for
// an interpreter frame with greater than a page of locals, so each page
// needs to be checked. Only true for non-native.
const int page_size = os::vm_page_size();
const int page_size = (int)os::vm_page_size();
const int n_shadow_pages = ((int)StackOverflow::stack_shadow_zone_size()) / page_size;
const int start_page = native_call ? n_shadow_pages : 1;
BLOCK_COMMENT("bang_stack_shadow_pages:");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2022, Loongson Technology. All rights reserved.
* Copyright (c) 2015, 2023, Loongson Technology. 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
Expand Down Expand Up @@ -36,7 +36,7 @@ void JavaThread::pd_initialize()

frame JavaThread::pd_last_frame() {
assert(has_last_Java_frame(), "must have last_Java_sp() when suspended");
if (_anchor.last_Java_pc() != NULL) {
if (_anchor.last_Java_pc() != nullptr) {
return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc());
} else {
// This will pick up pc from sp
Expand Down Expand Up @@ -74,16 +74,16 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
intptr_t* ret_fp;
intptr_t* ret_sp;
address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp);
if (addr == NULL || ret_sp == NULL) {
if (addr == nullptr || ret_sp == nullptr) {
// ucontext wasn't useful
return false;
}

frame ret_frame(ret_sp, ret_fp, addr);
if (!ret_frame.safe_for_sender(this)) {
#ifdef COMPILER2
// C2 and JVMCI use ebp as a general register see if NULL fp helps
frame ret_frame2(ret_sp, NULL, addr);
// C2 and JVMCI use ebp as a general register see if nullptr fp helps
frame ret_frame2(ret_sp, nullptr, addr);
if (!ret_frame2.safe_for_sender(this)) {
// nothing else to try if the frame isn't good
return false;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
/*
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2015, 2022, Loongson Technology. All rights reserved.
* Copyright (c) 2015, 2023, Loongson Technology. 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
Expand Down Expand Up @@ -44,7 +44,7 @@
}

intptr_t* base_of_stack_pointer() {
return NULL;
return nullptr;
}
void record_base_of_stack_pointer() {
}
Expand Down
28 changes: 14 additions & 14 deletions src/hotspot/os_cpu/linux_loongarch/os_linux_loongarch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -113,14 +113,14 @@ address os::fetch_frame_from_context(const void* ucVoid,
address epc;
ucontext_t* uc = (ucontext_t*)ucVoid;

if (uc != NULL) {
if (uc != nullptr) {
epc = os::Posix::ucontext_get_pc(uc);
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
} else {
epc = NULL;
if (ret_sp) *ret_sp = (intptr_t *)NULL;
if (ret_fp) *ret_fp = (intptr_t *)NULL;
epc = nullptr;
if (ret_sp) *ret_sp = (intptr_t *)nullptr;
if (ret_fp) *ret_fp = (intptr_t *)nullptr;
}

return epc;
Expand Down Expand Up @@ -180,16 +180,16 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
#endif

// decide if this trap can be handled by a stub
address stub = NULL;
address pc = NULL;
address stub = nullptr;
address pc = nullptr;

pc = (address) os::Posix::ucontext_get_pc(uc);
#ifdef PRINT_SIGNAL_HANDLE
tty->print_cr("pc=%lx", pc);
os::print_context(tty, uc);
#endif
//%note os_trap_1
if (info != NULL && uc != NULL && thread != NULL) {
if (info != nullptr && uc != nullptr && thread != nullptr) {
pc = (address) os::Posix::ucontext_get_pc(uc);

// Handle ALL stack overflow variations here
Expand Down Expand Up @@ -239,12 +239,12 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
// here if the underlying file has been truncated.
// Do not crash the VM in such a case.
CodeBlob* cb = CodeCache::find_blob(pc);
CompiledMethod* nm = (cb != NULL) ? cb->as_compiled_method_or_null() : NULL;
CompiledMethod* nm = (cb != nullptr) ? cb->as_compiled_method_or_null() : nullptr;
#ifdef PRINT_SIGNAL_HANDLE
tty->print("cb = %lx, nm = %lx\n", cb, nm);
#endif
bool is_unsafe_arraycopy = (thread->doing_unsafe_access() && UnsafeCopyMemory::contains_pc(pc));
if ((nm != NULL && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
if ((nm != nullptr && nm->has_unsafe_access()) || is_unsafe_arraycopy) {
address next_pc = pc + NativeInstruction::nop_instruction_size;
if (is_unsafe_arraycopy) {
next_pc = UnsafeCopyMemory::page_error_continue_pc(pc);
Expand Down Expand Up @@ -297,12 +297,12 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
}
}

if (stub != NULL) {
if (stub != nullptr) {
#ifdef PRINT_SIGNAL_HANDLE
tty->print_cr("resolved stub=%lx\n",stub);
#endif
// save all thread context in case we need to restore it
if (thread != NULL) thread->set_saved_exception_pc(pc);
if (thread != nullptr) thread->set_saved_exception_pc(pc);

os::Posix::ucontext_set_pc(uc, stub);
return true;
Expand Down Expand Up @@ -340,7 +340,7 @@ size_t os::Posix::default_stack_size(os::ThreadType thr_type) {
/////////////////////////////////////////////////////////////////////////////
// helper functions for fatal error handler
void os::print_register_info(outputStream *st, const void *context) {
if (context == NULL) return;
if (context == nullptr) return;

ucontext_t *uc = (ucontext_t*)context;

Expand Down Expand Up @@ -395,7 +395,7 @@ void os::print_register_info(outputStream *st, const void *context) {
}

void os::print_context(outputStream *st, const void *context) {
if (context == NULL) return;
if (context == nullptr) return;

const ucontext_t *uc = (const ucontext_t*)context;

Expand Down Expand Up @@ -444,7 +444,7 @@ void os::print_context(outputStream *st, const void *context) {
}

void os::print_tos_pc(outputStream *st, const void *context) {
if (context == NULL) return;
if (context == nullptr) return;

const ucontext_t* uc = (const ucontext_t*)context;

Expand Down

0 comments on commit 8019771

Please sign in to comment.