On Tue, 28 Mar 2023 16:00:34 GMT, Thomas Stuefe <stu...@openjdk.org> wrote:

>> Please also verify against over- and underflow, and better than just null 
>> checks check that every oop really is an oop. I added this to my code:
>> 
>>   assert((_offset <=  end_offset()), "lockstack overflow: _offset %d 
>> end_offset %d", _offset, end_offset());
>>   assert((_offset >= start_offset()), "lockstack underflow: _offset %d 
>> end_offset %d", _offset, start_offset());
>>   int end = to_index(_offset);
>>   for (int i = 0; i < end; i++) {
>>     assert(oopDesc::is_oop(_base[i]), "index %i: not an oop (" PTR_FORMAT 
>> ")", i, p2i(_base[i]));
>> ...
>
> Just realized that my proposal of oop-checking does not work since during GC 
> oop can be moved and will temporarily be invalid.

Checking for is_oop() may not work, because oops may be temporarily invalid, 
until the GC gets to fix them. This is especially (and probably only) true 
around oops_do().

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

PR Review Comment: https://git.openjdk.org/jdk/pull/10907#discussion_r1152089622

Reply via email to