Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions src/hotspot/share/memory/memRegion.hpp
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2000, 2024, Oracle and/or its affiliates. All rights reserved.
* Copyright (c) 2000, 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
Expand Down Expand Up @@ -63,7 +63,8 @@ class MemRegion {
MemRegion minus(const MemRegion mr2) const;

HeapWord* start() const { return _start; }
HeapWord* end() const { return _start + _word_size; }
// in the gtests we call end() with a _start == nullptr so adjust the addition to avoid ub
HeapWord* end() const { return reinterpret_cast<HeapWord*>(reinterpret_cast<uintptr_t>(_start) + (_word_size * sizeof(HeapWord))); }
HeapWord* last() const { return _start + _word_size - 1; }

void set_start(HeapWord* start) { _start = start; }
Expand Down