|
40 | 40 | */
|
41 | 41 | package com.oracle.truffle.api.bytecode.test.basic_interpreter;
|
42 | 42 |
|
| 43 | +import static org.junit.Assert.assertNull; |
| 44 | +import static org.junit.Assert.assertTrue; |
| 45 | + |
43 | 46 | import java.util.ArrayList;
|
44 | 47 | import java.util.List;
|
45 | 48 |
|
|
104 | 107 | enableSerialization = true, //
|
105 | 108 | enableTagInstrumentation = true, //
|
106 | 109 | enableSpecializationIntrospection = true, //
|
107 |
| - allowUnsafe = false)), |
| 110 | + allowUnsafe = false, // |
| 111 | + variadicStackLimit = "4")), |
108 | 112 | @Variant(suffix = "Unsafe", configuration = @GenerateBytecode(languageClass = BytecodeDSLTestLanguage.class, //
|
109 | 113 | enableYield = true, //
|
110 | 114 | enableMaterializedLocalAccesses = true, //
|
111 | 115 | enableSerialization = true, //
|
112 | 116 | enableTagInstrumentation = true, //
|
113 |
| - enableSpecializationIntrospection = true)), |
| 117 | + enableSpecializationIntrospection = true, // |
| 118 | + variadicStackLimit = "8")), |
114 | 119 | @Variant(suffix = "WithUncached", configuration = @GenerateBytecode(languageClass = BytecodeDSLTestLanguage.class, //
|
115 | 120 | enableYield = true, //
|
116 | 121 | enableMaterializedLocalAccesses = true, //
|
117 | 122 | enableSerialization = true, //
|
118 | 123 | enableTagInstrumentation = true, //
|
119 | 124 | enableUncachedInterpreter = true, //
|
120 | 125 | defaultUncachedThreshold = "defaultUncachedThreshold", //
|
121 |
| - enableSpecializationIntrospection = true)), |
| 126 | + enableSpecializationIntrospection = true, // |
| 127 | + variadicStackLimit = "16")), |
122 | 128 | @Variant(suffix = "WithBE", configuration = @GenerateBytecode(languageClass = BytecodeDSLTestLanguage.class, //
|
123 | 129 | enableYield = true, //
|
124 | 130 | enableMaterializedLocalAccesses = true, //
|
125 | 131 | enableSerialization = true, //
|
126 | 132 | enableTagInstrumentation = true, //
|
127 | 133 | enableSpecializationIntrospection = true, //
|
128 |
| - boxingEliminationTypes = {boolean.class, long.class})), |
| 134 | + boxingEliminationTypes = {boolean.class, long.class}, // |
| 135 | + variadicStackLimit = "4")), |
129 | 136 | @Variant(suffix = "WithOptimizations", configuration = @GenerateBytecode(languageClass = BytecodeDSLTestLanguage.class, //
|
130 | 137 | enableYield = true, //
|
131 | 138 | enableMaterializedLocalAccesses = true, //
|
132 | 139 | enableSerialization = true, //
|
133 | 140 | enableSpecializationIntrospection = true, //
|
134 | 141 | enableTagInstrumentation = true, //
|
135 |
| - defaultLocalValue = "LOCAL_DEFAULT_VALUE")), |
| 142 | + defaultLocalValue = "LOCAL_DEFAULT_VALUE", // |
| 143 | + variadicStackLimit = "8")), |
136 | 144 | @Variant(suffix = "WithRootScoping", configuration = @GenerateBytecode(languageClass = BytecodeDSLTestLanguage.class, //
|
137 | 145 | enableYield = true, //
|
138 | 146 | enableMaterializedLocalAccesses = true, //
|
139 | 147 | enableSerialization = true, //
|
140 | 148 | enableBlockScoping = false, //
|
141 | 149 | enableTagInstrumentation = true, //
|
142 | 150 | enableSpecializationIntrospection = true, //
|
143 |
| - defaultLocalValue = "LOCAL_DEFAULT_VALUE")), |
| 151 | + defaultLocalValue = "LOCAL_DEFAULT_VALUE", // |
| 152 | + variadicStackLimit = "16")), |
144 | 153 | @Variant(suffix = "WithStoreBytecodeIndexInFrame", configuration = @GenerateBytecode(languageClass = BytecodeDSLTestLanguage.class, //
|
145 | 154 | enableYield = true, //
|
146 | 155 | enableMaterializedLocalAccesses = true, //
|
|
150 | 159 | enableSpecializationIntrospection = true, //
|
151 | 160 | boxingEliminationTypes = {boolean.class, long.class}, //
|
152 | 161 | storeBytecodeIndexInFrame = true, //
|
153 |
| - enableTagInstrumentation = true)), |
| 162 | + enableTagInstrumentation = true, // |
| 163 | + variadicStackLimit = "4")), |
154 | 164 | // A typical "production" configuration with all of the bells and whistles.
|
155 | 165 | @Variant(suffix = "ProductionBlockScoping", configuration = @GenerateBytecode(languageClass = BytecodeDSLTestLanguage.class, //
|
156 | 166 | enableYield = true, //
|
|
160 | 170 | enableUncachedInterpreter = true, //
|
161 | 171 | defaultUncachedThreshold = "defaultUncachedThreshold", //
|
162 | 172 | enableSpecializationIntrospection = true, //
|
163 |
| - boxingEliminationTypes = {boolean.class, long.class})), |
| 173 | + boxingEliminationTypes = {boolean.class, long.class}, // |
| 174 | + variadicStackLimit = "8")), |
164 | 175 | @Variant(suffix = "ProductionRootScoping", configuration = @GenerateBytecode(languageClass = BytecodeDSLTestLanguage.class, //
|
165 | 176 | enableYield = true, //
|
166 | 177 | enableMaterializedLocalAccesses = true, //
|
|
170 | 181 | enableUncachedInterpreter = true, //
|
171 | 182 | defaultUncachedThreshold = "defaultUncachedThreshold", //
|
172 | 183 | enableSpecializationIntrospection = true, //
|
173 |
| - boxingEliminationTypes = {boolean.class, long.class})) |
| 184 | + boxingEliminationTypes = {boolean.class, long.class}, // |
| 185 | + variadicStackLimit = "16")) |
174 | 186 | })
|
175 | 187 | @ShortCircuitOperation(booleanConverter = BasicInterpreter.ToBoolean.class, name = "ScAnd", operator = Operator.AND_RETURN_VALUE)
|
176 | 188 | @ShortCircuitOperation(booleanConverter = BasicInterpreter.ToBoolean.class, name = "ScOr", operator = Operator.OR_RETURN_VALUE, javadoc = "ScOr returns the first truthy operand value.")
|
@@ -884,6 +896,59 @@ public static Bindings doDefault(
|
884 | 896 | return new Bindings(bytecode, root1, location, instruction, node, bytecodeIndex);
|
885 | 897 | }
|
886 | 898 | }
|
| 899 | + |
| 900 | + @Operation |
| 901 | + static final class Variadic0Operation { |
| 902 | + @Specialization |
| 903 | + public static Object[] variadic(@Variadic Object[] args) { |
| 904 | + return args; |
| 905 | + } |
| 906 | + } |
| 907 | + |
| 908 | + @Operation |
| 909 | + static final class Variadic1Operation { |
| 910 | + @Specialization |
| 911 | + @SuppressWarnings("unused") |
| 912 | + public static Object[] variadic(long arg0, @Variadic Object[] args) { |
| 913 | + return args; |
| 914 | + } |
| 915 | + } |
| 916 | + |
| 917 | + @Operation |
| 918 | + static final class VariadicOffsetOperation { |
| 919 | + @Specialization |
| 920 | + @SuppressWarnings("unused") |
| 921 | + public static Object[] variadic(@Variadic(startOffset = 4) Object[] args) { |
| 922 | + assertTrue(args.length >= 3); |
| 923 | + for (int i = 0; i < 4; i++) { |
| 924 | + assertNull(args[i]); |
| 925 | + } |
| 926 | + return args; |
| 927 | + } |
| 928 | + } |
| 929 | + |
| 930 | + @Operation |
| 931 | + @Variadic |
| 932 | + static final class DynamicVariadic { |
| 933 | + |
| 934 | + @Specialization |
| 935 | + @SuppressWarnings("unused") |
| 936 | + public static Object[] pass(@Variadic Object[] args) { |
| 937 | + return args; |
| 938 | + } |
| 939 | + } |
| 940 | + |
| 941 | + @Operation |
| 942 | + @Variadic |
| 943 | + static final class DynamicVariadicNull { |
| 944 | + |
| 945 | + @Specialization |
| 946 | + @SuppressWarnings("unused") |
| 947 | + public static Object[] pass() { |
| 948 | + return null; |
| 949 | + } |
| 950 | + } |
| 951 | + |
887 | 952 | }
|
888 | 953 |
|
889 | 954 | class TestClosure {
|
|
0 commit comments