On Tue, 16 Apr 2024 03:06:13 GMT, Vladimir Kozlov <k...@openjdk.org> wrote:

>> src/hotspot/share/code/nmethod.hpp line 205:
>> 
>>> 203:       // offsets to find the receiver for non-static native wrapper 
>>> frames.
>>> 204:       ByteSize _native_receiver_sp_offset;
>>> 205:       ByteSize _native_basic_lock_sp_offset;
>> 
>> Don't we need an assert in the accessor functions to make sure nmethod is 
>> native or not?
>
> I thought about that but in both places where these accessors are called 
> (`frame::get_native_monitor()` and `frame::get_native_receiver()`) there are 
> such asserts already:
> https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/frame.cpp#L1085

OK, but I'd rather see it in the accessors too.  Some users are checking for 
method()->is_native() and others are checking for is_osr_method(), so we need 
to make sure those are always mutually exclusive: method()->is_native() != 
is_osr_method().

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

PR Review Comment: https://git.openjdk.org/jdk/pull/18768#discussion_r1566806754

Reply via email to