@@ -55,6 +55,7 @@ class PythonObject extends TruffleObject.InstanceBased {
55
55
static final String PYTHON_LIST_FQN = "com.oracle.graal.python.builtins.objects.list.PList" ; // NOI18N
56
56
static final String TREEMAP_ENTRY_FQN = "java.util.TreeMap$Entry" ; // NOI18N
57
57
static final String TREEMAP_FQN = "java.util.TreeMap" ; // NOI18N
58
+ private static final String HASHING_STORAGE_FQN = "com.oracle.graal.python.builtins.objects.common.HashingStorage" ; // NOI18N
58
59
59
60
private final Instance instance ;
60
61
private final Instance storage ;
@@ -90,7 +91,7 @@ class PythonObject extends TruffleObject.InstanceBased {
90
91
array = (ObjectArrayInstance ) values [5 ];
91
92
map = (Instance ) values [6 ];
92
93
set = (Instance ) values [7 ];
93
- dictStorage = ( Instance ) values [8 ];
94
+ dictStorage = computeDict (( Instance ) values [8 ], storage ) ;
94
95
}
95
96
96
97
private static Instance computeStorage (Instance storage , Instance pythonInstance ) {
@@ -99,6 +100,14 @@ private static Instance computeStorage(Instance storage, Instance pythonInstance
99
100
return null ;
100
101
}
101
102
103
+ private static Instance computeDict (Instance dict , Instance storage ) {
104
+ if (dict != null ) return dict ;
105
+ if (isSubClassOf (storage , HASHING_STORAGE_FQN )) {
106
+ return storage ;
107
+ }
108
+ return null ;
109
+ }
110
+
102
111
private static Instance computePythonClass (Instance pythonClass , Instance storedPythonClass , Instance initialPythonClass , Instance storage ) {
103
112
if (pythonClass != null ) return pythonClass ;
104
113
if (storedPythonClass != null ) return storedPythonClass ;
@@ -398,8 +407,13 @@ private List<FieldValue> getEntriesFromKeywords(ObjectArrayInstance keywords) {
398
407
}
399
408
400
409
private List <FieldValue > getEntriesFromEconomicMapStorage (boolean isSet , Instance economicMapStorage ) {
410
+ Instance entries ;
401
411
List fields = new ArrayList ();
402
- Instance entries = (Instance ) economicMapStorage .getValueOfField ("entries" ); // NOI18N
412
+ Instance economicMap = (Instance ) economicMapStorage .getValueOfField ("map" ); // NOI18N
413
+ if (economicMap instanceof Instance ) {
414
+ economicMapStorage = economicMap ;
415
+ }
416
+ entries = (Instance ) economicMapStorage .getValueOfField ("entries" ); // NOI18N
403
417
404
418
if (entries instanceof ObjectArrayInstance ) {
405
419
ObjectArrayInstance entriesArr = (ObjectArrayInstance ) entries ;
@@ -414,14 +428,11 @@ private List<FieldValue> getEntriesFromEconomicMapStorage(boolean isSet, Instanc
414
428
if (isSet ) {
415
429
fields .add (new PythonEconomicEntryFieldValue (key ));
416
430
} else { // Map
417
- if (value != null ) {
418
- if ( value instanceof Instance ) {
419
- Instance ival = (( Instance ) value );
431
+ if (value instanceof Instance ) {
432
+ Instance ival = (( Instance )value );
433
+ if ( ival . getJavaClass (). getName (). startsWith ( mapClassName )) {
420
434
Instance linkValue = (Instance ) ival .getValueOfField ("value" ); // NOI18N
421
-
422
- if (linkValue != null && ival .getJavaClass ().getName ().startsWith (mapClassName )) {
423
- value = linkValue ;
424
- }
435
+ if (linkValue != null ) value = linkValue ;
425
436
}
426
437
}
427
438
fields .add (new PythonEconomicEntryFieldValue (key , value ));
0 commit comments