Skip to content

Commit 8019771

Browse files
authored
Update (2023.03.08)
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
1 parent b1a571e commit 8019771

File tree

7 files changed

+27
-27
lines changed

7 files changed

+27
-27
lines changed

src/hotspot/cpu/loongarch/interp_masm_loongarch_64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -830,7 +830,7 @@ void InterpreterMacroAssembler::lock_object(Register lock_reg) {
830830
// least significant 2 bits clear.
831831
// NOTE: the oopMark is in tmp_reg as the result of cmpxchg
832832
sub_d(tmp_reg, tmp_reg, SP);
833-
li(AT, 7 - os::vm_page_size());
833+
li(AT, 7 - (int)os::vm_page_size());
834834
andr(tmp_reg, tmp_reg, AT);
835835
// Save the test result, for recursive case, the result is zero
836836
st_d(tmp_reg, lock_reg, mark_offset);

src/hotspot/cpu/loongarch/macroAssembler_loongarch.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -389,7 +389,7 @@ void MacroAssembler::bang_stack_size(Register size, Register tmp) {
389389
// Bang one page at a time because large size can bang beyond yellow and
390390
// red zones.
391391
Label loop;
392-
li(AT, os::vm_page_size());
392+
li(AT, (int)os::vm_page_size());
393393
bind(loop);
394394
sub_d(tmp, tmp, AT);
395395
sub_d(size, size, AT);
@@ -402,7 +402,7 @@ void MacroAssembler::bang_stack_size(Register size, Register tmp) {
402402
// was post-decremented.) Skip this address by starting at i=1, and
403403
// touch a few more pages below. N.B. It is important to touch all
404404
// the way down to and including i=StackShadowPages.
405-
for (int i = 0; i < (int)(StackOverflow::stack_shadow_zone_size() / os::vm_page_size()) - 1; i++) {
405+
for (int i = 0; i < (int)(StackOverflow::stack_shadow_zone_size() / (int)os::vm_page_size()) - 1; i++) {
406406
// this could be any sized move but this is can be a debugging crumb
407407
// so the bigger the better.
408408
sub_d(tmp, tmp, AT);

src/hotspot/cpu/loongarch/sharedRuntime_loongarch_64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1864,7 +1864,7 @@ nmethod *SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
18641864
// NOTE: the oopMark is in swap_reg %T8 as the result of cmpxchg
18651865

18661866
__ sub_d(swap_reg, swap_reg, SP);
1867-
__ li(AT, 3 - os::vm_page_size());
1867+
__ li(AT, 3 - (int)os::vm_page_size());
18681868
__ andr(swap_reg , swap_reg, AT);
18691869
// Save the test result, for recursive case, the result is zero
18701870
__ st_d(swap_reg, lock_reg, mark_word_offset);

src/hotspot/cpu/loongarch/templateInterpreterGenerator_loongarch.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -750,7 +750,7 @@ void TemplateInterpreterGenerator::generate_stack_overflow_check(void) {
750750
const int overhead_size = -(frame::interpreter_frame_initial_sp_offset*wordSize)
751751
+ entry_size;
752752

753-
const int page_size = os::vm_page_size();
753+
const size_t page_size = os::vm_page_size();
754754
Label after_frame_check;
755755

756756
// see if the frame is greater than one page in size. If so,
@@ -1516,7 +1516,7 @@ void TemplateInterpreterGenerator::bang_stack_shadow_pages(bool native_call) {
15161516
// Bang each page in the shadow zone. We can't assume it's been done for
15171517
// an interpreter frame with greater than a page of locals, so each page
15181518
// needs to be checked. Only true for non-native.
1519-
const int page_size = os::vm_page_size();
1519+
const int page_size = (int)os::vm_page_size();
15201520
const int n_shadow_pages = ((int)StackOverflow::stack_shadow_zone_size()) / page_size;
15211521
const int start_page = native_call ? n_shadow_pages : 1;
15221522
BLOCK_COMMENT("bang_stack_shadow_pages:");

src/hotspot/os_cpu/linux_loongarch/javaThread_linux_loongarch.cpp

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2003, 2013, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2015, 2022, Loongson Technology. All rights reserved.
3+
* Copyright (c) 2015, 2023, Loongson Technology. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -36,7 +36,7 @@ void JavaThread::pd_initialize()
3636

3737
frame JavaThread::pd_last_frame() {
3838
assert(has_last_Java_frame(), "must have last_Java_sp() when suspended");
39-
if (_anchor.last_Java_pc() != NULL) {
39+
if (_anchor.last_Java_pc() != nullptr) {
4040
return frame(_anchor.last_Java_sp(), _anchor.last_Java_fp(), _anchor.last_Java_pc());
4141
} else {
4242
// This will pick up pc from sp
@@ -74,16 +74,16 @@ bool JavaThread::pd_get_top_frame(frame* fr_addr, void* ucontext, bool isInJava)
7474
intptr_t* ret_fp;
7575
intptr_t* ret_sp;
7676
address addr = os::fetch_frame_from_context(uc, &ret_sp, &ret_fp);
77-
if (addr == NULL || ret_sp == NULL) {
77+
if (addr == nullptr || ret_sp == nullptr) {
7878
// ucontext wasn't useful
7979
return false;
8080
}
8181

8282
frame ret_frame(ret_sp, ret_fp, addr);
8383
if (!ret_frame.safe_for_sender(this)) {
8484
#ifdef COMPILER2
85-
// C2 and JVMCI use ebp as a general register see if NULL fp helps
86-
frame ret_frame2(ret_sp, NULL, addr);
85+
// C2 and JVMCI use ebp as a general register see if nullptr fp helps
86+
frame ret_frame2(ret_sp, nullptr, addr);
8787
if (!ret_frame2.safe_for_sender(this)) {
8888
// nothing else to try if the frame isn't good
8989
return false;

src/hotspot/os_cpu/linux_loongarch/javaThread_linux_loongarch.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.
3-
* Copyright (c) 2015, 2022, Loongson Technology. All rights reserved.
3+
* Copyright (c) 2015, 2023, Loongson Technology. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
66
* This code is free software; you can redistribute it and/or modify it
@@ -44,7 +44,7 @@
4444
}
4545

4646
intptr_t* base_of_stack_pointer() {
47-
return NULL;
47+
return nullptr;
4848
}
4949
void record_base_of_stack_pointer() {
5050
}

src/hotspot/os_cpu/linux_loongarch/os_linux_loongarch.cpp

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -113,14 +113,14 @@ address os::fetch_frame_from_context(const void* ucVoid,
113113
address epc;
114114
ucontext_t* uc = (ucontext_t*)ucVoid;
115115

116-
if (uc != NULL) {
116+
if (uc != nullptr) {
117117
epc = os::Posix::ucontext_get_pc(uc);
118118
if (ret_sp) *ret_sp = os::Linux::ucontext_get_sp(uc);
119119
if (ret_fp) *ret_fp = os::Linux::ucontext_get_fp(uc);
120120
} else {
121-
epc = NULL;
122-
if (ret_sp) *ret_sp = (intptr_t *)NULL;
123-
if (ret_fp) *ret_fp = (intptr_t *)NULL;
121+
epc = nullptr;
122+
if (ret_sp) *ret_sp = (intptr_t *)nullptr;
123+
if (ret_fp) *ret_fp = (intptr_t *)nullptr;
124124
}
125125

126126
return epc;
@@ -180,16 +180,16 @@ bool PosixSignals::pd_hotspot_signal_handler(int sig, siginfo_t* info,
180180
#endif
181181

182182
// decide if this trap can be handled by a stub
183-
address stub = NULL;
184-
address pc = NULL;
183+
address stub = nullptr;
184+
address pc = nullptr;
185185

186186
pc = (address) os::Posix::ucontext_get_pc(uc);
187187
#ifdef PRINT_SIGNAL_HANDLE
188188
tty->print_cr("pc=%lx", pc);
189189
os::print_context(tty, uc);
190190
#endif
191191
//%note os_trap_1
192-
if (info != NULL && uc != NULL && thread != NULL) {
192+
if (info != nullptr && uc != nullptr && thread != nullptr) {
193193
pc = (address) os::Posix::ucontext_get_pc(uc);
194194

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

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

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

345345
ucontext_t *uc = (ucontext_t*)context;
346346

@@ -395,7 +395,7 @@ void os::print_register_info(outputStream *st, const void *context) {
395395
}
396396

397397
void os::print_context(outputStream *st, const void *context) {
398-
if (context == NULL) return;
398+
if (context == nullptr) return;
399399

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

@@ -444,7 +444,7 @@ void os::print_context(outputStream *st, const void *context) {
444444
}
445445

446446
void os::print_tos_pc(outputStream *st, const void *context) {
447-
if (context == NULL) return;
447+
if (context == nullptr) return;
448448

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

0 commit comments

Comments
 (0)