41
41
package com .oracle .graal .python .nodes .attributes ;
42
42
43
43
import com .oracle .graal .python .builtins .objects .common .DynamicObjectStorage ;
44
+ import com .oracle .graal .python .builtins .objects .common .HashingCollectionNodes ;
44
45
import com .oracle .graal .python .builtins .objects .common .PHashingCollection ;
45
46
import com .oracle .graal .python .builtins .objects .object .PythonObject ;
46
47
import com .oracle .graal .python .builtins .objects .str .PString ;
47
48
import com .oracle .graal .python .nodes .PGuards ;
48
49
import com .oracle .graal .python .nodes .PNodeWithContext ;
49
50
import com .oracle .graal .python .runtime .PythonOptions ;
51
+ import com .oracle .truffle .api .CompilerDirectives ;
50
52
import com .oracle .truffle .api .dsl .ImportStatic ;
51
53
import com .oracle .truffle .api .object .HiddenKey ;
52
54
import com .oracle .truffle .api .object .Location ;
55
57
56
58
@ ImportStatic ({PGuards .class , PythonOptions .class })
57
59
public abstract class ObjectAttributeNode extends PNodeWithContext {
60
+ private @ Child HashingCollectionNodes .GetDictStorageNode getDictStorageNode ;
61
+
62
+ public HashingCollectionNodes .GetDictStorageNode getGetDictStorageNode () {
63
+ if (getDictStorageNode == null ) {
64
+ CompilerDirectives .transferToInterpreterAndInvalidate ();
65
+ getDictStorageNode = insert (HashingCollectionNodes .GetDictStorageNode .create ());
66
+ }
67
+ return getDictStorageNode ;
68
+ }
69
+
58
70
protected Object attrKey (Object key ) {
59
71
if (key instanceof PString ) {
60
72
return ((PString ) key ).getValue ();
@@ -68,7 +80,7 @@ protected boolean isDictUnsetOrSameAsStorage(PythonObject object, ValueProfile d
68
80
if (dict == null ) {
69
81
return true ;
70
82
} else {
71
- return dict . getDictStorage ( ) instanceof DynamicObjectStorage .PythonObjectDictStorage ;
83
+ return getGetDictStorageNode (). execute ( dict ) instanceof DynamicObjectStorage .PythonObjectDictStorage ;
72
84
}
73
85
}
74
86
0 commit comments