diff --git a/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp b/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp index 8d84f144f0245..c0c67fda9493f 100644 --- a/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp +++ b/src/hotspot/share/gc/g1/g1OopClosures.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2001, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2001, 2025, 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 @@ -50,8 +50,8 @@ inline void G1ScanClosureBase::prefetch_and_push(T* p, const oop obj) { // stall. We'll try to prefetch the object (for write, given that // we might need to install the forwarding reference) and we'll // get back to it when pop it from the queue - Prefetch::write(obj->mark_addr(), 0); - Prefetch::read(obj->mark_addr(), (HeapWordSize*2)); + Prefetch::write(obj->base_addr(), oopDesc::mark_offset_in_bytes()); + Prefetch::read(obj->base_addr(), oopDesc::mark_offset_in_bytes() + (HeapWordSize*2)); // slightly paranoid test; I'm trying to catch potential // problems before we go into push_on_queue to know where the diff --git a/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp b/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp index 4946b0fde82a6..451a7dae18924 100644 --- a/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp +++ b/src/hotspot/share/gc/parallel/psPromotionManager.inline.hpp @@ -1,5 +1,5 @@ /* - * Copyright (c) 2002, 2024, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2002, 2025, 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 @@ -61,7 +61,7 @@ inline void PSPromotionManager::claim_or_forward_depth(T* p) { if (PSScavenge::is_obj_in_young(heap_oop)) { oop obj = CompressedOops::decode_not_null(heap_oop); assert(!PSScavenge::is_obj_in_to_space(obj), "revisiting object?"); - Prefetch::write(obj->mark_addr(), 0); + Prefetch::write(obj->base_addr(), oopDesc::mark_offset_in_bytes()); push_depth(ScannerTask(p)); } } diff --git a/src/hotspot/share/oops/oop.hpp b/src/hotspot/share/oops/oop.hpp index 02f87da293734..3ec0ce5764ab9 100644 --- a/src/hotspot/share/oops/oop.hpp +++ b/src/hotspot/share/oops/oop.hpp @@ -65,9 +65,11 @@ class oopDesc { // Must be trivial; see verifying static assert after the class. oopDesc() = default; + inline void* base_addr(); + inline const void* base_addr() const; + inline markWord mark() const; inline markWord mark_acquire() const; - inline markWord* mark_addr() const; inline void set_mark(markWord m); static inline void set_mark(HeapWord* mem, markWord m); diff --git a/src/hotspot/share/oops/oop.inline.hpp b/src/hotspot/share/oops/oop.inline.hpp index 4ca1bfce47211..16c444a43f843 100644 --- a/src/hotspot/share/oops/oop.inline.hpp +++ b/src/hotspot/share/oops/oop.inline.hpp @@ -47,6 +47,9 @@ // Implementation of all inlined member functions defined in oop.hpp // We need a separate file to avoid circular references +void* oopDesc::base_addr() { return this; } +const void* oopDesc::base_addr() const { return this; } + markWord oopDesc::mark() const { return Atomic::load(&_mark); } @@ -55,10 +58,6 @@ markWord oopDesc::mark_acquire() const { return Atomic::load_acquire(&_mark); } -markWord* oopDesc::mark_addr() const { - return (markWord*) &_mark; -} - void oopDesc::set_mark(markWord m) { Atomic::store(&_mark, m); }