Skip to content

Commit d3f7862

Browse files
committed
[GR-45042] Address more sharing warnings [2/3]
PullRequest: truffleruby/3779
2 parents a3d9543 + a54f3b1 commit d3f7862

38 files changed

+114
-103
lines changed

src/main/java/org/truffleruby/core/array/ArrayNodes.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -672,7 +672,7 @@ protected Object delete(RubyArray array, Object value, Object maybeBlock,
672672
@Bind("array.getStore()") Object store,
673673
@CachedLibrary("store") ArrayStoreLibrary stores,
674674
@Cached @Shared IntValueProfile arraySizeProfile,
675-
@Cached @Exclusive LoopConditionProfile loopProfile) {
675+
@Cached @Shared LoopConditionProfile loopProfile) {
676676

677677
return delete(array, value, maybeBlock, true, store, store, stores, stores, arraySizeProfile, loopProfile);
678678
}
@@ -685,7 +685,7 @@ protected Object delete(RubyArray array, Object value, Object maybeBlock,
685685
@CachedLibrary("store") ArrayStoreLibrary stores,
686686
@CachedLibrary(limit = "1") ArrayStoreLibrary newStores,
687687
@Cached @Shared IntValueProfile arraySizeProfile,
688-
@Cached @Exclusive LoopConditionProfile loopProfile) {
688+
@Cached @Shared LoopConditionProfile loopProfile) {
689689

690690
final Object newStore = stores.allocator(store).allocate(arraySizeProfile.profile(array.size));
691691
return delete(array, value, maybeBlock, false, store, newStore, stores, newStores, arraySizeProfile,

src/main/java/org/truffleruby/core/basicobject/BasicObjectNodes.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@
7777
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
7878
import com.oracle.truffle.api.Truffle;
7979
import com.oracle.truffle.api.dsl.Cached;
80+
import com.oracle.truffle.api.dsl.Cached.Exclusive;
8081
import com.oracle.truffle.api.dsl.GenerateNodeFactory;
8182
import com.oracle.truffle.api.dsl.GenerateUncached;
8283
import com.oracle.truffle.api.dsl.NodeChild;
@@ -355,11 +356,11 @@ public abstract static class InstanceEvalNode extends AlwaysInlinedMethodNode {
355356
@Specialization(guards = "isBlockProvided(rubyArgs)")
356357
protected Object evalWithBlock(Frame callerFrame, Object self, Object[] rubyArgs, RootCallTarget target,
357358
@Cached InstanceExecBlockNode instanceExecNode,
358-
@Cached BranchProfile errorProfile) {
359+
@Cached @Exclusive BranchProfile wrongNumberOfArgumentsProfile) {
359360
final int count = RubyArguments.getPositionalArgumentsCount(rubyArgs, false);
360361

361362
if (count > 0) {
362-
errorProfile.enter();
363+
wrongNumberOfArgumentsProfile.enter();
363364
throw new RaiseException(getContext(), coreExceptions().argumentError(count, 0, this));
364365
}
365366

@@ -370,7 +371,7 @@ protected Object evalWithBlock(Frame callerFrame, Object self, Object[] rubyArgs
370371

371372
@Specialization(guards = "!isBlockProvided(rubyArgs)")
372373
protected Object evalWithString(Frame callerFrame, Object self, Object[] rubyArgs, RootCallTarget target,
373-
@Cached BranchProfile errorProfile,
374+
@Cached @Exclusive BranchProfile zeroNumberOfArguments,
374375
@Cached RubyStringLibrary strings,
375376
@Cached ToJavaStringNode toJavaStringNode,
376377
@Cached ToStrNode toStrNode,
@@ -382,7 +383,7 @@ protected Object evalWithString(Frame callerFrame, Object self, Object[] rubyArg
382383
int count = RubyArguments.getPositionalArgumentsCount(rubyArgs, false);
383384

384385
if (count == 0) {
385-
errorProfile.enter();
386+
zeroNumberOfArguments.enter();
386387
throw new RaiseException(getContext(), coreExceptions().argumentError(0, 1, 2, this));
387388
}
388389

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@SuppressPackageWarnings({ "truffle-sharing", "truffle-inlining" })
1+
@SuppressPackageWarnings({ "truffle-inlining" })
22
package org.truffleruby.core.basicobject;
33

44
import com.oracle.truffle.api.dsl.SuppressPackageWarnings;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@SuppressPackageWarnings({ "truffle-sharing", "truffle-inlining" })
1+
@SuppressPackageWarnings({ "truffle-inlining" })
22
package org.truffleruby.core.binding;
33

44
import com.oracle.truffle.api.dsl.SuppressPackageWarnings;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@SuppressPackageWarnings({ "truffle-sharing", "truffle-inlining" })
1+
@SuppressPackageWarnings({ "truffle-inlining" })
22
package org.truffleruby.core.bool;
33

44
import com.oracle.truffle.api.dsl.SuppressPackageWarnings;

src/main/java/org/truffleruby/core/encoding/EncodingConverterNodes.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151

5252
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
5353
import com.oracle.truffle.api.dsl.Cached;
54+
import com.oracle.truffle.api.dsl.Cached.Shared;
5455
import com.oracle.truffle.api.dsl.CreateCast;
5556
import com.oracle.truffle.api.dsl.NodeChild;
5657
import com.oracle.truffle.api.dsl.Specialization;
@@ -280,7 +281,7 @@ public abstract static class EncodingConverterPutbackNode extends CoreMethodArra
280281

281282
@Specialization
282283
protected RubyString encodingConverterPutback(RubyEncodingConverter encodingConverter, int maxBytes,
283-
@Cached DispatchNode sourceEncodingNode) {
284+
@Cached @Shared DispatchNode sourceEncodingNode) {
284285
// Taken from org.jruby.RubyConverter#putback.
285286

286287
final EConv ec = encodingConverter.econv;
@@ -291,7 +292,7 @@ protected RubyString encodingConverterPutback(RubyEncodingConverter encodingConv
291292

292293
@Specialization
293294
protected RubyString encodingConverterPutback(RubyEncodingConverter encodingConverter, NotProvided maxBytes,
294-
@Cached DispatchNode sourceEncodingNode) {
295+
@Cached @Shared DispatchNode sourceEncodingNode) {
295296
// Taken from org.jruby.RubyConverter#putback.
296297

297298
final EConv ec = encodingConverter.econv;

src/main/java/org/truffleruby/core/encoding/EncodingNodes.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@
4545
import com.oracle.truffle.api.CompilerDirectives;
4646
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
4747
import com.oracle.truffle.api.dsl.Cached;
48+
import com.oracle.truffle.api.dsl.Cached.Shared;
4849
import com.oracle.truffle.api.dsl.Specialization;
4950
import com.oracle.truffle.api.profiles.BranchProfile;
5051
import com.oracle.truffle.api.profiles.ConditionProfile;
@@ -260,8 +261,8 @@ protected RubyEncoding negotiateSameEncodingUncached(Object first, Object second
260261

261262
@Specialization(guards = { "libFirst.isRubyString(first)", "libSecond.isRubyString(second)" }, limit = "1")
262263
protected RubyEncoding negotiateStringStringEncoding(Object first, Object second,
263-
@Cached RubyStringLibrary libFirst,
264-
@Cached RubyStringLibrary libSecond,
264+
@Cached @Shared RubyStringLibrary libFirst,
265+
@Cached @Shared RubyStringLibrary libSecond,
265266
@Cached NegotiateCompatibleStringEncodingNode negotiateNode) {
266267
final RubyEncoding firstEncoding = libFirst.getEncoding(first);
267268
final RubyEncoding secondEncoding = libSecond.getEncoding(second);
@@ -282,8 +283,7 @@ protected RubyEncoding negotiateStringStringEncoding(Object first, Object second
282283
"firstEncoding != secondEncoding" },
283284
limit = "getCacheLimit()")
284285
protected RubyEncoding negotiateStringObjectCached(Object first, Object second,
285-
@Cached RubyStringLibrary libFirst,
286-
@Cached RubyStringLibrary libSecond,
286+
@Cached @Shared RubyStringLibrary libFirst,
287287
@Cached("getEncoding(first)") RubyEncoding firstEncoding,
288288
@Cached("getEncoding(second)") RubyEncoding secondEncoding,
289289
@Cached("getCodeRange(first, libFirst)") TruffleString.CodeRange codeRange,
@@ -298,7 +298,7 @@ protected RubyEncoding negotiateStringObjectCached(Object first, Object second,
298298
"isNotRubyString(second)" },
299299
replaces = "negotiateStringObjectCached", limit = "1")
300300
protected RubyEncoding negotiateStringObjectUncached(Object first, Object second,
301-
@Cached RubyStringLibrary libFirst) {
301+
@Cached @Shared RubyStringLibrary libFirst) {
302302
final RubyEncoding firstEncoding = getEncoding(first);
303303
final RubyEncoding secondEncoding = getEncoding(second);
304304

@@ -328,7 +328,7 @@ protected RubyEncoding negotiateStringObjectUncached(Object first, Object second
328328
"isNotRubyString(first)" },
329329
limit = "1")
330330
protected RubyEncoding negotiateObjectString(Object first, Object second,
331-
@Cached RubyStringLibrary libSecond) {
331+
@Cached @Shared RubyStringLibrary libSecond) {
332332
return negotiateStringObjectUncached(second, first, libSecond);
333333
}
334334

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@SuppressPackageWarnings({ "truffle-sharing", "truffle-inlining" })
1+
@SuppressPackageWarnings({ "truffle-inlining" })
22
package org.truffleruby.core.encoding;
33

44
import com.oracle.truffle.api.dsl.SuppressPackageWarnings;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@SuppressPackageWarnings({ "truffle-sharing", "truffle-inlining" })
1+
@SuppressPackageWarnings({ "truffle-inlining" })
22
package org.truffleruby.core.exception;
33

44
import com.oracle.truffle.api.dsl.SuppressPackageWarnings;
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
@SuppressPackageWarnings({ "truffle-sharing", "truffle-inlining" })
1+
@SuppressPackageWarnings({ "truffle-inlining" })
22
package org.truffleruby.core.fiber;
33

44
import com.oracle.truffle.api.dsl.SuppressPackageWarnings;

0 commit comments

Comments
 (0)