15
15
16
16
import com .oracle .truffle .api .dsl .Bind ;
17
17
import com .oracle .truffle .api .dsl .Cached ;
18
+ import com .oracle .truffle .api .dsl .Cached .Shared ;
18
19
import com .oracle .truffle .api .dsl .ImportStatic ;
19
20
import com .oracle .truffle .api .dsl .Specialization ;
20
21
import com .oracle .truffle .api .library .CachedLibrary ;
@@ -28,7 +29,7 @@ public abstract class ArrayEnsureCapacityNode extends RubyBaseNode {
28
29
protected Object ensureCapacityAndMakeMutable (RubyArray array , int requiredCapacity ,
29
30
@ Bind ("array.getStore()" ) Object store ,
30
31
@ CachedLibrary ("store" ) ArrayStoreLibrary stores ,
31
- @ Cached CountingConditionProfile extendProfile ) {
32
+ @ Cached @ Shared CountingConditionProfile extendProfile ) {
32
33
final int currentCapacity = stores .capacity (store );
33
34
final int capacity ;
34
35
if (extendProfile .profile (currentCapacity < requiredCapacity )) {
@@ -47,7 +48,7 @@ protected Object ensureCapacityAndMakeMutable(RubyArray array, int requiredCapac
47
48
protected Object ensureCapacity (RubyArray array , int requiredCapacity ,
48
49
@ Bind ("array.getStore()" ) Object store ,
49
50
@ CachedLibrary ("store" ) ArrayStoreLibrary stores ,
50
- @ Cached CountingConditionProfile extendProfile ) {
51
+ @ Cached @ Shared CountingConditionProfile extendProfile ) {
51
52
final int length = stores .capacity (store );
52
53
if (extendProfile .profile (length < requiredCapacity )) {
53
54
final int capacity = ArrayUtils .capacity (getLanguage (), length , requiredCapacity );
0 commit comments