mirror of
https://github.com/openjdk/jdk.git
synced 2026-02-04 07:28:22 +00:00
8324286: Fix backsliding on use of nullptr instead of NULL
Reviewed-by: jsjolen, coleenp, jwaters
This commit is contained in:
parent
3696765b7d
commit
bcb340da09
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. 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
|
||||
@ -111,10 +111,10 @@ void C2_MacroAssembler::fast_lock(Register objectReg, Register boxReg, Register
|
||||
// Handle existing monitor.
|
||||
bind(object_has_monitor);
|
||||
|
||||
// The object's monitor m is unlocked iff m->owner == NULL,
|
||||
// The object's monitor m is unlocked iff m->owner == nullptr,
|
||||
// otherwise m->owner may contain a thread or a stack address.
|
||||
//
|
||||
// Try to CAS m->owner from NULL to current thread.
|
||||
// Try to CAS m->owner from null to current thread.
|
||||
add(tmp, disp_hdr, (in_bytes(ObjectMonitor::owner_offset())-markWord::monitor_value));
|
||||
cmpxchg(tmp, zr, rthread, Assembler::xword, /*acquire*/ true,
|
||||
/*release*/ true, /*weak*/ false, tmp3Reg); // Sets flags for result
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2020, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2020, 2022, Huawei Technologies Co., Ltd. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -121,10 +121,10 @@ void C2_MacroAssembler::fast_lock(Register objectReg, Register boxReg,
|
||||
|
||||
// Handle existing monitor.
|
||||
bind(object_has_monitor);
|
||||
// The object's monitor m is unlocked iff m->owner == NULL,
|
||||
// The object's monitor m is unlocked iff m->owner == nullptr,
|
||||
// otherwise m->owner may contain a thread or a stack address.
|
||||
//
|
||||
// Try to CAS m->owner from NULL to current thread.
|
||||
// Try to CAS m->owner from null to current thread.
|
||||
add(tmp, disp_hdr, (in_bytes(ObjectMonitor::owner_offset()) - markWord::monitor_value));
|
||||
cmpxchg(/*memory address*/tmp, /*expected value*/zr, /*new value*/xthread, Assembler::int64, Assembler::aq,
|
||||
Assembler::rl, /*result*/flag); // cas succeeds if flag == zr(expected)
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2016, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2016, 2023 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -2868,7 +2868,7 @@ void TemplateTable::jvmti_post_field_mod(Register cache,
|
||||
__ z_lgr(fieldEntry, cache);
|
||||
|
||||
if (is_static) {
|
||||
// Life is simple. NULL the object pointer.
|
||||
// Life is simple. Null the object pointer.
|
||||
__ clear_reg(obj, true, false); // Don't set CC.
|
||||
} else {
|
||||
// Life is harder. The stack holds the value on top, followed by
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1999, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1999, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2023 SAP SE. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -1584,7 +1584,7 @@ static char* reserve_shmated_memory (size_t bytes, char* requested_addr) {
|
||||
|
||||
// Now attach the shared segment.
|
||||
// Note that we deliberately *don't* pass SHM_RND. The contract of os::attempt_reserve_memory_at() -
|
||||
// which invokes this function with a request address != NULL - is to map at the specified address
|
||||
// which invokes this function with a request address != nullptr - is to map at the specified address
|
||||
// excactly, or to fail. If the caller passed us an address that is not usable (aka not a valid segment
|
||||
// boundary), shmat should not round down the address, or think up a completely new one.
|
||||
// (In places where this matters, e.g. when reserving the heap, we take care of passing segment-aligned
|
||||
|
||||
@ -4136,7 +4136,7 @@ char* os::pd_attempt_reserve_memory_at(char* requested_addr, size_t bytes, bool
|
||||
|
||||
size_t os::vm_min_address() {
|
||||
// Determined by sysctl vm.mmap_min_addr. It exists as a safety zone to prevent
|
||||
// NULL pointer dereferences.
|
||||
// null pointer dereferences.
|
||||
// Most distros set this value to 64 KB. It *can* be zero, but rarely is. Here,
|
||||
// we impose a minimum value if vm.mmap_min_addr is too low, for increased protection.
|
||||
static size_t value = 0;
|
||||
|
||||
@ -2156,7 +2156,7 @@ bool FileMapInfo::map_heap_region_impl() {
|
||||
|
||||
if (_heap_pointers_need_patching) {
|
||||
char* bitmap_base = map_bitmap_region();
|
||||
if (bitmap_base == NULL) {
|
||||
if (bitmap_base == nullptr) {
|
||||
log_info(cds)("CDS heap cannot be used because bitmap region cannot be mapped");
|
||||
dealloc_heap_region();
|
||||
unmap_region(MetaspaceShared::hp);
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2012, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2012, 2024, Oracle and/or its affiliates. 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
|
||||
@ -1890,7 +1890,7 @@ WB_END
|
||||
WB_ENTRY(jint, WB_getFieldCPIndex(JNIEnv* env, jobject wb, jclass klass, jint index))
|
||||
InstanceKlass* ik = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
|
||||
ConstantPool* cp = ik->constants();
|
||||
if (cp->cache() == NULL) {
|
||||
if (cp->cache() == nullptr) {
|
||||
return -1;
|
||||
}
|
||||
return cp->resolved_field_entry_at(index)->constant_pool_index();
|
||||
@ -1908,7 +1908,7 @@ WB_END
|
||||
WB_ENTRY(jint, WB_getMethodCPIndex(JNIEnv* env, jobject wb, jclass klass, jint index))
|
||||
InstanceKlass* ik = InstanceKlass::cast(java_lang_Class::as_Klass(JNIHandles::resolve(klass)));
|
||||
ConstantPool* cp = ik->constants();
|
||||
if (cp->cache() == NULL) {
|
||||
if (cp->cache() == nullptr) {
|
||||
return -1;
|
||||
}
|
||||
return cp->resolved_method_entry_at(index)->constant_pool_index();
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 1997, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 1997, 2024, Oracle and/or its affiliates. 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
|
||||
@ -191,7 +191,7 @@ class os: AllStatic {
|
||||
static PageSizes _page_sizes;
|
||||
|
||||
// The default value for os::vm_min_address() unless the platform knows better. This value
|
||||
// is chosen to give us reasonable protection against NULL pointer dereferences while being
|
||||
// is chosen to give us reasonable protection against null pointer dereferences while being
|
||||
// low enough to leave most of the valuable low-4gb address space open.
|
||||
static constexpr size_t _vm_min_address_default = 16 * M;
|
||||
|
||||
|
||||
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* Copyright (c) 2005, 2023, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2005, 2024, Oracle and/or its affiliates. All rights reserved.
|
||||
* Copyright (c) 2023, Alibaba Group Holding Limited. All rights reserved.
|
||||
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
|
||||
*
|
||||
@ -680,7 +680,7 @@ DumpWriter::~DumpWriter(){
|
||||
if (_tmp_buffer != nullptr) {
|
||||
os::free(_tmp_buffer);
|
||||
}
|
||||
if (_writer != NULL) {
|
||||
if (_writer != nullptr) {
|
||||
delete _writer;
|
||||
}
|
||||
_bytes_written = -1;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user