Skip to content

Commit 99ba9be

Browse files
committed
Vendor paguro's RrbTree, fix an int overflow breaking large Lists (#1337)
1 parent bffc50e commit 99ba9be

File tree

8 files changed

+1983
-11
lines changed

8 files changed

+1983
-11
lines changed

pkl-core/pkl-core.gradle.kts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ tasks.test {
120120
excludeEngines("AlpineLanguageSnippetTestsEngine")
121121
excludeEngines("WindowsLanguageSnippetTestsEngine")
122122
}
123+
124+
// testing very large lists requires more memory than the default 512m!
125+
maxHeapSize = "1g"
123126
}
124127

125128
val testJavaExecutable by
@@ -135,6 +138,9 @@ val testJavaExecutable by
135138
// executable;
136139
// to verify that we don't want to include them here)
137140
(configurations.testRuntimeClasspath.get() - configurations.runtimeClasspath.get())
141+
142+
// testing very large lists requires more memory than the default 512m!
143+
maxHeapSize = "1g"
138144
}
139145

140146
tasks.check { dependsOn(testJavaExecutable) }

pkl-core/src/main/java/org/pkl/core/runtime/VmList.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,16 @@
1919
import java.util.ArrayList;
2020
import java.util.Iterator;
2121
import java.util.List;
22-
import org.organicdesign.fp.collections.RrbTree;
23-
import org.organicdesign.fp.collections.RrbTree.ImRrbt;
24-
import org.organicdesign.fp.collections.RrbTree.MutRrbt;
2522
import org.organicdesign.fp.collections.UnmodCollection;
2623
import org.organicdesign.fp.collections.UnmodIterable;
2724
import org.pkl.core.ast.ConstantNode;
2825
import org.pkl.core.ast.ExpressionNode;
2926
import org.pkl.core.runtime.Iterators.ReverseTruffleIterator;
3027
import org.pkl.core.runtime.Iterators.TruffleIterator;
3128
import org.pkl.core.util.Nullable;
29+
import org.pkl.core.util.paguro.RrbTree;
30+
import org.pkl.core.util.paguro.RrbTree.ImRrbt;
31+
import org.pkl.core.util.paguro.RrbTree.MutRrbt;
3232

3333
// currently the backing collection is realized at the end of each VmList operation
3434
// this trades efficiency for ease of understanding, as it eliminates the complexity

pkl-core/src/main/java/org/pkl/core/runtime/VmMap.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
2+
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -22,13 +22,13 @@
2222
import org.organicdesign.fp.collections.ImMap;
2323
import org.organicdesign.fp.collections.MutMap;
2424
import org.organicdesign.fp.collections.PersistentHashMap;
25-
import org.organicdesign.fp.collections.RrbTree;
26-
import org.organicdesign.fp.collections.RrbTree.ImRrbt;
27-
import org.organicdesign.fp.collections.RrbTree.MutRrbt;
2825
import org.pkl.core.ast.ConstantNode;
2926
import org.pkl.core.ast.ExpressionNode;
3027
import org.pkl.core.util.CollectionUtils;
3128
import org.pkl.core.util.Nullable;
29+
import org.pkl.core.util.paguro.RrbTree;
30+
import org.pkl.core.util.paguro.RrbTree.ImRrbt;
31+
import org.pkl.core.util.paguro.RrbTree.MutRrbt;
3232

3333
public final class VmMap extends VmValue implements Iterable<Map.Entry<Object, Object>> {
3434
public static final VmMap EMPTY = new VmMap(PersistentHashMap.empty(), RrbTree.empty());

pkl-core/src/main/java/org/pkl/core/runtime/VmSet.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright © 2024 Apple Inc. and the Pkl project authors. All rights reserved.
2+
* Copyright © 2024-2025 Apple Inc. and the Pkl project authors. All rights reserved.
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -21,15 +21,15 @@
2121
import org.organicdesign.fp.collections.ImSet;
2222
import org.organicdesign.fp.collections.MutSet;
2323
import org.organicdesign.fp.collections.PersistentHashSet;
24-
import org.organicdesign.fp.collections.RrbTree;
25-
import org.organicdesign.fp.collections.RrbTree.ImRrbt;
26-
import org.organicdesign.fp.collections.RrbTree.MutRrbt;
2724
import org.pkl.core.ast.ConstantNode;
2825
import org.pkl.core.ast.ExpressionNode;
2926
import org.pkl.core.runtime.Iterators.ReverseTruffleIterator;
3027
import org.pkl.core.runtime.Iterators.TruffleIterator;
3128
import org.pkl.core.util.CollectionUtils;
3229
import org.pkl.core.util.Nullable;
30+
import org.pkl.core.util.paguro.RrbTree;
31+
import org.pkl.core.util.paguro.RrbTree.ImRrbt;
32+
import org.pkl.core.util.paguro.RrbTree.MutRrbt;
3333

3434
public final class VmSet extends VmCollection {
3535
public static final VmSet EMPTY = new VmSet(PersistentHashSet.empty(), RrbTree.empty());

0 commit comments

Comments
 (0)