RFR: 8241613: Suspicious calls to MacroAssembler::null_check(Register, offset) [v5]

Coleen Phillimore coleenp at openjdk.org
Mon Mar 27 11:56:34 UTC 2023


On Mon, 27 Mar 2023 09:22:14 GMT, Andrew Dinn <adinn at openjdk.org> wrote:

>> src/hotspot/cpu/aarch64/macroAssembler_aarch64.cpp line 4319:
>> 
>>> 4317: void MacroAssembler::load_klass(Register dst, Register src) {
>>> 4318:   assert(oopDesc::klass_offset_in_bytes() < static_cast<intptr_t>(os::vm_page_size()),
>>> 4319:          "Doesn't need explicit null check");
>> 
>> Sorry I meant for this to be a "global" assert somewhere, executed once per VM startup, not done on each call like this.
>
> Yes, and preferably with an accompanying comment that explains why the assert is present i.e. that it guarantees that calls to `load_klass` can rely on the SEGV handler to detect null oops. Also a similar comment for the array length offset assertion.

Suggest a global place please and but not in oopDesc::klass_offset_in_bytes() because that would require oop.hpp to include os.hpp.  I couldn't find somewhere good where we wouldn't have to write a large comment to explain the context.

-------------

PR Review Comment: https://git.openjdk.org/jdk/pull/13026#discussion_r1149202330


More information about the hotspot-runtime-dev mailing list