Skip to content

Commit 4fe99da

Browse files
afshin-zafariJesperIRL
authored andcommitted
8151413: os::allocation_granularity/page_size and friends return signed values
Reviewed-by: stefank, ccheung, ysr
1 parent 09b8a19 commit 4fe99da

File tree

66 files changed

+165
-163
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+165
-163
lines changed

src/hotspot/cpu/aarch64/c1_MacroAssembler_aarch64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr
108108
// significant 2 bits cleared and page_size is a power of 2
109109
mov(rscratch1, sp);
110110
sub(hdr, hdr, rscratch1);
111-
ands(hdr, hdr, aligned_mask - os::vm_page_size());
111+
ands(hdr, hdr, aligned_mask - (int)os::vm_page_size());
112112
// for recursive locking, the result is zero => save it in the displaced header
113113
// location (NULL in the displaced hdr location indicates recursive locking)
114114
str(hdr, Address(disp_hdr, 0));

src/hotspot/cpu/aarch64/interp_masm_aarch64.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2003, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2003, 2023, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, 2020, Red Hat Inc. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -802,7 +802,7 @@ void InterpreterMacroAssembler::lock_object(Register lock_reg)
802802
// copy
803803
mov(rscratch1, sp);
804804
sub(swap_reg, swap_reg, rscratch1);
805-
ands(swap_reg, swap_reg, (uint64_t)(7 - os::vm_page_size()));
805+
ands(swap_reg, swap_reg, (uint64_t)(7 - (int)os::vm_page_size()));
806806

807807
// Save the test result, for recursive case, the result is zero
808808
str(swap_reg, Address(lock_reg, mark_offset));

src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4577,9 +4577,9 @@ void MacroAssembler::bang_stack_size(Register size, Register tmp) {
45774577
// Bang one page at a time because large size can bang beyond yellow and
45784578
// red zones.
45794579
Label loop;
4580-
mov(rscratch1, os::vm_page_size());
4580+
mov(rscratch1, (int)os::vm_page_size());
45814581
bind(loop);
4582-
lea(tmp, Address(tmp, -os::vm_page_size()));
4582+
lea(tmp, Address(tmp, -(int)os::vm_page_size()));
45834583
subsw(size, size, rscratch1);
45844584
str(size, Address(tmp));
45854585
br(Assembler::GT, loop);
@@ -4590,10 +4590,10 @@ void MacroAssembler::bang_stack_size(Register size, Register tmp) {
45904590
// was post-decremented.) Skip this address by starting at i=1, and
45914591
// touch a few more pages below. N.B. It is important to touch all
45924592
// the way down to and including i=StackShadowPages.
4593-
for (int i = 0; i < (int)(StackOverflow::stack_shadow_zone_size() / os::vm_page_size()) - 1; i++) {
4593+
for (int i = 0; i < (int)(StackOverflow::stack_shadow_zone_size() / (int)os::vm_page_size()) - 1; i++) {
45944594
// this could be any sized move but this is can be a debugging crumb
45954595
// so the bigger the better.
4596-
lea(tmp, Address(tmp, -os::vm_page_size()));
4596+
lea(tmp, Address(tmp, -(int)os::vm_page_size()));
45974597
str(size, Address(tmp));
45984598
}
45994599
}

src/hotspot/cpu/aarch64/sharedRuntime_aarch64.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1798,7 +1798,7 @@ nmethod* SharedRuntime::generate_native_wrapper(MacroAssembler* masm,
17981798

17991799
__ sub(swap_reg, sp, swap_reg);
18001800
__ neg(swap_reg, swap_reg);
1801-
__ ands(swap_reg, swap_reg, 3 - os::vm_page_size());
1801+
__ ands(swap_reg, swap_reg, 3 - (int)os::vm_page_size());
18021802

18031803
// Save the test result, for recursive case, the result is zero
18041804
__ str(swap_reg, Address(lock_reg, mark_word_offset));

src/hotspot/cpu/aarch64/templateInterpreterGenerator_aarch64.cpp

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

658-
const int page_size = os::vm_page_size();
658+
const size_t page_size = os::vm_page_size();
659659

660660
Label after_frame_check;
661661

@@ -1063,7 +1063,7 @@ void TemplateInterpreterGenerator::bang_stack_shadow_pages(bool native_call) {
10631063
// See more discussion in stackOverflow.hpp.
10641064

10651065
const int shadow_zone_size = checked_cast<int>(StackOverflow::stack_shadow_zone_size());
1066-
const int page_size = os::vm_page_size();
1066+
const int page_size = (int)os::vm_page_size();
10671067
const int n_shadow_pages = shadow_zone_size / page_size;
10681068

10691069
#ifdef ASSERT

src/hotspot/cpu/arm/macroAssembler_arm.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -970,7 +970,7 @@ void MacroAssembler::zero_memory(Register start, Register end, Register tmp) {
970970

971971
void MacroAssembler::arm_stack_overflow_check(int frame_size_in_bytes, Register tmp) {
972972
// Version of AbstractAssembler::generate_stack_overflow_check optimized for ARM
973-
const int page_size = os::vm_page_size();
973+
const int page_size = (int)os::vm_page_size();
974974

975975
sub_slow(tmp, SP, StackOverflow::stack_shadow_zone_size());
976976
strb(R0, Address(tmp));

src/hotspot/cpu/ppc/c1_MacroAssembler_ppc.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2021, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2012, 2018 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*

src/hotspot/cpu/ppc/gc/z/zGlobals_ppc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 2021, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 2021, 2023, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2021 SAP SE. All rights reserved.
44
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
55
*
@@ -107,7 +107,7 @@ static unsigned int probe_valid_max_address_bit(size_t init_bit, size_t min_bit)
107107
unsigned int max_valid_address_bit = 0;
108108
void* last_allocatable_address = nullptr;
109109

110-
const unsigned int page_size = os::vm_page_size();
110+
const size_t page_size = os::vm_page_size();
111111

112112
for (size_t i = init_bit; i >= min_bit; --i) {
113113
void* base_addr = (void*) (((unsigned long) 1U) << i);

src/hotspot/cpu/ppc/templateInterpreterGenerator_ppc.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1162,8 +1162,8 @@ void TemplateInterpreterGenerator::bang_stack_shadow_pages(bool native_call) {
11621162
// Bang each page in the shadow zone. We can't assume it's been done for
11631163
// an interpreter frame with greater than a page of locals, so each page
11641164
// needs to be checked. Only true for non-native.
1165-
const int page_size = os::vm_page_size();
1166-
const int n_shadow_pages = ((int)StackOverflow::stack_shadow_zone_size()) / page_size;
1165+
const size_t page_size = os::vm_page_size();
1166+
const int n_shadow_pages = StackOverflow::stack_shadow_zone_size() / page_size;
11671167
const int start_page = native_call ? n_shadow_pages : 1;
11681168
BLOCK_COMMENT("bang_stack_shadow_pages:");
11691169
for (int pages = start_page; pages <= n_shadow_pages; pages++) {

src/hotspot/cpu/riscv/c1_MacroAssembler_riscv.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright (c) 1999, 2022, Oracle and/or its affiliates. All rights reserved.
2+
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
33
* Copyright (c) 2014, Red Hat Inc. All rights reserved.
44
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
55
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
@@ -96,7 +96,7 @@ int C1_MacroAssembler::lock_object(Register hdr, Register obj, Register disp_hdr
9696
// assuming both the stack pointer and page_size have their least
9797
// significant 2 bits cleared and page_size is a power of 2
9898
sub(hdr, hdr, sp);
99-
mv(t0, aligned_mask - os::vm_page_size());
99+
mv(t0, aligned_mask - (int)os::vm_page_size());
100100
andr(hdr, hdr, t0);
101101
// for recursive locking, the result is zero => save it in the displaced header
102102
// location (NULL in the displaced hdr location indicates recursive locking)

0 commit comments

Comments
 (0)