RFR: 8261675: ObjectValue::set_visited(bool) sets _visited false
Vladimir Kozlov
kvn at openjdk.java.net
Sat Feb 13 08:12:37 UTC 2021
On Sat, 13 Feb 2021 06:33:36 GMT, Vladimir Kozlov <kvn at openjdk.org> wrote:
>> The setter is error-prone. it unconditionally sets _visited false.
>> this patch stores the argument to it.
>
> Wow. This was original changes for first implementation of Escape Analysis 6558600.
>
> But it works because the only place where `set_visited()` is called it sets to `false`:
> [debugInfoRec.cpp#L358](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/code/debugInfoRec.cpp#L358)
>
> `is_visited()` is not called at all - `_visited` field is accessed directly only in one place:
> [debugInfo.cpp#L161](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/code/debugInfo.cpp#L161)
>
> Would be nice to clean up this mess.
In addition to your fix you can consider next changes to avoid dumping unneeded data in debug info (deoptimizer reads objects data only from top frame [deoptimization.cpp#L190](https://github.com/openjdk/jdk/blob/master/src/hotspot/share/runtime/deoptimization.cpp#L190):
src/hotspot/share/opto/output.cpp
// We dump the object pool first, since deoptimization reads it in first.
- C->debug_info()->dump_object_pool(objs);
+ C->debug_info()->dump_object_pool(objs, (depth < max_depth));
src/hotspot/share/code/debugInfoRec.hpp
- void dump_object_pool(GrowableArray<ScopeValue*>* objects);
+ void dump_object_pool(GrowableArray<ScopeValue*>* objects, bool visited = false);
src/hotspot/share/code/debugInfoRec.cpp
-void DebugInformationRecorder::dump_object_pool(GrowableArray<ScopeValue*>* objects) {
+void DebugInformationRecorder::dump_object_pool(GrowableArray<ScopeValue*>* objects, bool visited) {
guarantee( _pcs_length > 0, "safepoint must exist before describing scopes");
PcDesc* last_pd = &_pcs[_pcs_length-1];
if (objects != NULL) {
for (int i = objects->length() - 1; i >= 0; i--) {
- objects->at(i)->as_ObjectValue()->set_visited(false);
+ objects->at(i)->as_ObjectValue()->set_visited(visited);
}
}
-------------
PR: https://git.openjdk.java.net/jdk/pull/2560
More information about the hotspot-compiler-dev
mailing list