21
21
import com .oracle .truffle .api .dsl .Cached ;
22
22
import com .oracle .truffle .api .dsl .ImportStatic ;
23
23
import com .oracle .truffle .api .dsl .Specialization ;
24
+ import com .oracle .truffle .api .library .CachedLibrary ;
24
25
import com .oracle .truffle .api .nodes .ExplodeLoop ;
25
26
import com .oracle .truffle .api .object .DynamicObject ;
27
+ import com .oracle .truffle .api .object .DynamicObjectLibrary ;
26
28
import com .oracle .truffle .api .object .ObjectLocation ;
27
29
import com .oracle .truffle .api .object .Property ;
28
30
import com .oracle .truffle .api .object .Shape ;
@@ -48,14 +50,15 @@ public ShareObjectNode(int depth) {
48
50
@ ExplodeLoop
49
51
protected void shareCached (DynamicObject object ,
50
52
@ Cached ("object.getShape()" ) Shape cachedShape ,
53
+ @ CachedLibrary (limit = "1" ) DynamicObjectLibrary objectLibrary ,
51
54
@ Cached ("BASIC_OBJECT.getLogicalClass(cachedShape.getObjectType())" ) DynamicObject logicalClass ,
52
55
@ Cached ("BASIC_OBJECT.getMetaClass(cachedShape.getObjectType())" ) DynamicObject metaClass ,
53
56
@ Cached ("createShareInternalFieldsNode()" ) ShareInternalFieldsNode shareInternalFieldsNode ,
54
57
@ Cached ("createReadAndShareFieldNodes(getObjectProperties(cachedShape))" ) ReadAndShareFieldNode [] readAndShareFieldNodes ,
55
58
@ Cached ("createSharedShape(cachedShape)" ) Shape sharedShape ) {
56
59
// Mark the object as shared first to avoid recursion
57
60
assert object .getShape () == cachedShape ;
58
- object . setShapeAndGrow ( cachedShape , sharedShape );
61
+ objectLibrary . markShared ( object );
59
62
assert object .getShape () == sharedShape ;
60
63
61
64
// Share the logical class
0 commit comments