|
40 | 40 | */
|
41 | 41 | package com.oracle.graal.python.builtins.objects.code;
|
42 | 42 |
|
43 |
| -import static com.oracle.graal.python.nodes.truffle.TruffleStringMigrationPythonTypes.assertNoJavaString; |
44 |
| - |
45 |
| -import java.util.ArrayList; |
46 | 43 | import java.util.Arrays;
|
47 |
| -import java.util.List; |
48 | 44 |
|
49 | 45 | import org.graalvm.polyglot.io.ByteSequence;
|
50 | 46 |
|
51 | 47 | import com.oracle.graal.python.PythonLanguage;
|
52 | 48 | import com.oracle.graal.python.builtins.modules.MarshalModuleBuiltins;
|
53 | 49 | import com.oracle.graal.python.builtins.objects.function.Signature;
|
54 |
| -import com.oracle.graal.python.builtins.objects.str.PString; |
55 | 50 | import com.oracle.graal.python.compiler.CodeUnit;
|
56 | 51 | import com.oracle.graal.python.nodes.IndirectCallNode;
|
57 | 52 | import com.oracle.graal.python.nodes.PNodeWithContext;
|
58 | 53 | import com.oracle.graal.python.nodes.PRootNode;
|
59 | 54 | import com.oracle.graal.python.nodes.bytecode.PBytecodeGeneratorFunctionRootNode;
|
60 | 55 | import com.oracle.graal.python.nodes.bytecode.PBytecodeRootNode;
|
61 | 56 | import com.oracle.graal.python.nodes.util.BadOPCodeNode;
|
62 |
| -import com.oracle.graal.python.nodes.util.CastToJavaStringNode; |
63 | 57 | import com.oracle.graal.python.runtime.ExecutionContext.IndirectCallContext;
|
64 | 58 | import com.oracle.graal.python.runtime.PythonContext;
|
65 | 59 | import com.oracle.graal.python.runtime.PythonOptions;
|
@@ -186,18 +180,15 @@ public static PCode createCode(PythonContext context, int flags, byte[] codedata
|
186 | 180 | }
|
187 | 181 |
|
188 | 182 | @TruffleBoundary
|
189 |
| - private static String[] toStringArray(Object[] array) { |
190 |
| - List<String> list = new ArrayList<>(array.length); |
191 |
| - for (Object item : array) { |
192 |
| - item = assertNoJavaString(item); |
193 |
| - if (item instanceof TruffleString) { |
194 |
| - list.add(((TruffleString) item).toJavaStringUncached()); |
195 |
| - } |
196 |
| - if (item instanceof PString) { |
197 |
| - list.add(CastToJavaStringNode.getUncached().execute(item)); |
198 |
| - } |
| 183 | + private static String[] toStringArray(TruffleString[] array) { |
| 184 | + if (array == null) { |
| 185 | + return null; |
| 186 | + } |
| 187 | + String[] result = new String[array.length]; |
| 188 | + for (int i = 0; i < array.length; i++) { |
| 189 | + result[i] = array[i].toJavaStringUncached(); |
199 | 190 | }
|
200 |
| - return list.toArray(new String[list.size()]); |
| 191 | + return result; |
201 | 192 | }
|
202 | 193 |
|
203 | 194 | public static CreateCodeNode create() {
|
|
0 commit comments