Skip to content

Commit 279c8ed

Browse files
committed
Use an ArrayLIst for adjacent objects for sharing finalizers.
1 parent 886caa7 commit 279c8ed

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

src/main/java/org/truffleruby/core/FinalizerReference.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ FinalizationService.Finalizer getFirstFinalizer() {
4949
return finalizers.pollFirst();
5050
}
5151

52-
void collectRoots(Collection<Object> roots) {
52+
public void collectRoots(Collection<Object> roots) {
5353
for (FinalizationService.Finalizer finalizer : finalizers) {
5454
final RubyDynamicObject root = finalizer.getRoot();
5555
if (root != null) {

src/main/java/org/truffleruby/language/objects/shared/WriteBarrierNode.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
import org.truffleruby.language.RubyDynamicObject;
1616
import org.truffleruby.language.objects.ShapeCachingGuards;
1717

18-
import java.util.HashSet;
18+
import java.util.ArrayList;
1919

2020
import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
2121
import com.oracle.truffle.api.dsl.Cached;
@@ -81,8 +81,8 @@ protected void writeBarrierUncached(RubyDynamicObject value) {
8181
@Specialization
8282
@TruffleBoundary
8383
protected void writeBarrierFinalizer(FinalizerReference ref) {
84-
HashSet<Object> roots = new HashSet<>();
85-
ref.getAdjacentObjects(roots);
84+
ArrayList<Object> roots = new ArrayList<>();
85+
ref.collectRoots(roots);
8686
for (var root : roots) {
8787
SharedObjects.writeBarrier(getLanguage(), root);
8888
}

0 commit comments

Comments
 (0)