Skip to content

Commit fa32768

Browse files
committed
Fix svm build
1 parent 80478c3 commit fa32768

File tree

3 files changed

+22
-7
lines changed

3 files changed

+22
-7
lines changed

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/PythonLanguage.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -535,6 +535,7 @@ public RootCallTarget parseForBytecodeInterpreter(PythonContext context, Source
535535
}
536536
}
537537

538+
@TruffleBoundary
538539
public RootCallTarget compileForBytecodeInterpreter(PythonContext context, ModTy mod, Source source, boolean topLevel, int optimize, List<String> argumentNames) {
539540
RaisePythonExceptionErrorCallback errorCb = new RaisePythonExceptionErrorCallback(source, PythonOptions.isPExceptionWithJavaStacktrace(this));
540541
try {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/BuiltinFunctions.java

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1210,8 +1210,7 @@ Object generic(VirtualFrame frame, Object wSource, Object wFilename, Object wMod
12101210
if (getCore().isCoreInitialized() && AstModuleBuiltins.isAst(getContext(), wSource)) {
12111211
ModTy mod = AstModuleBuiltins.obj2sst(getContext(), wSource);
12121212
// TODO _PyAST_Validate
1213-
// TODO fake source
1214-
Source source = Source.newBuilder(PythonLanguage.ID, "", "").build();
1213+
Source source = createFakeSource();
12151214
RootCallTarget rootCallTarget = getLanguage().compileForBytecodeInterpreter(getContext(), mod, source, false, optimize, null);
12161215
return wrapRootCallTarget(rootCallTarget);
12171216
}
@@ -1220,6 +1219,11 @@ Object generic(VirtualFrame frame, Object wSource, Object wFilename, Object wMod
12201219
return compile(source, filename, mode, flags, kwDontInherit, optimize);
12211220
}
12221221

1222+
@TruffleBoundary
1223+
private Source createFakeSource() {
1224+
return Source.newBuilder(PythonLanguage.ID, "", "").build();
1225+
}
1226+
12231227
private PCode wrapRootCallTarget(RootCallTarget rootCallTarget) {
12241228
RootNode rootNode = rootCallTarget.getRootNode();
12251229
if (rootNode instanceof PBytecodeRootNode) {

graalpython/com.oracle.graal.python/src/com/oracle/graal/python/builtins/modules/ast/Sst2ObjVisitorBase.java

Lines changed: 15 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,8 +47,6 @@
4747
import static com.oracle.graal.python.util.PythonUtils.toTruffleStringUncached;
4848
import static com.oracle.truffle.api.CompilerDirectives.shouldNotReachHere;
4949

50-
import java.util.Arrays;
51-
5250
import com.oracle.graal.python.builtins.objects.PNone;
5351
import com.oracle.graal.python.builtins.objects.ellipsis.PEllipsis;
5452
import com.oracle.graal.python.builtins.objects.list.PList;
@@ -143,21 +141,33 @@ final PList seq2List(String[] seq) {
143141
if (seq == null || seq.length == 0) {
144142
return factory.createList();
145143
}
146-
return factory.createList(Arrays.stream(seq).map(Sst2ObjVisitorBase::visitNullable).toArray());
144+
Object[] objs = new Object[seq.length];
145+
for (int i = 0; i < objs.length; ++i) {
146+
objs[i] = visitNullable(seq[i]);
147+
}
148+
return factory.createList(objs);
147149
}
148150

149151
final PList seq2List(CmpOpTy[] seq) {
150152
if (seq == null || seq.length == 0) {
151153
return factory.createList();
152154
}
153-
return factory.createList(Arrays.stream(seq).map(this::visitNullable).toArray());
155+
Object[] objs = new Object[seq.length];
156+
for (int i = 0; i < objs.length; ++i) {
157+
objs[i] = visitNullable(seq[i]);
158+
}
159+
return factory.createList(objs);
154160
}
155161

156162
final PList seq2List(SSTNode[] seq) {
157163
if (seq == null || seq.length == 0) {
158164
return factory.createList();
159165
}
160-
return factory.createList(Arrays.stream(seq).map(this::visitNullable).toArray());
166+
Object[] objs = new Object[seq.length];
167+
for (int i = 0; i < objs.length; ++i) {
168+
objs[i] = visitNullable(seq[i]);
169+
}
170+
return factory.createList(objs);
161171
}
162172

163173
final void fillSourceRangeAttributes(PythonObject o, SourceRange sourceRange) {

0 commit comments

Comments
 (0)