RFR: 8343531: Improve print_location for invalid heap pointers [v2]

Volker Simonis simonis at openjdk.org
Mon Nov 4 14:37:34 UTC 2024


On Mon, 4 Nov 2024 12:00:38 GMT, Aleksey Shipilev <shade at openjdk.org> wrote:

>> Volker Simonis has updated the pull request incrementally with one additional commit since the last revision:
>> 
>>   Small refactoring based on tschatzl's review
>
> src/hotspot/share/gc/shared/locationPrinter.inline.hpp line 90:
> 
>> 88:   if (in_heap) {
>> 89:     st->print_cr(PTR_FORMAT " is an unknown heap location", p2i(addr));
>> 90:     return true;
> 
> So why not put this block as `else` branch in `base_oop_or_null` check at L67? This would also remove any ambiguity whether the in-heap pointer would look like a compressed pointer to object, which would be accidentally handled by the block at L64..L86?

That was actually the first thing I did. But then I thought that (especially with zero-based compressed oops) we might get quite some valid compressed oops pointers unnecessarily printed as "unknown heap location".
On the other hand, I don't think that there's a high probability for a real invalid heap pointer to be classified as compressed oops pointer because the compressed oops detection code uses `is_valid_obj()` anyway.
So this change is conservative in the sense that it doesn't change any behavior except that pointers which have been printed as pointing "into unknown readable memory" can now be detect as "invalid heap pointers".

If you still think we should prioritize the detection steps differently, please let me know.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/21870#discussion_r1827834445


More information about the hotspot-gc-dev mailing list