Skip to content

Commit cb0727b

Browse files
committed
Execute bootstrap method at build time for Web Image until BoundMethodHandle issue is fixed
1 parent 018caf1 commit cb0727b

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

substratevm/src/com.oracle.svm.hosted/src/com/oracle/svm/hosted/phases/AnalysisGraphBuilderPhase.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,9 @@
3030
import java.lang.invoke.WrongMethodTypeException;
3131
import java.util.List;
3232

33+
import org.graalvm.nativeimage.ImageSingletons;
34+
import org.graalvm.nativeimage.Platform;
35+
3336
import com.oracle.graal.pointsto.heap.ImageHeapInstance;
3437
import com.oracle.graal.pointsto.infrastructure.AnalysisConstantPool;
3538
import com.oracle.graal.pointsto.infrastructure.OriginalMethodProvider;
@@ -162,8 +165,13 @@ protected void genInvokeDynamic(int cpi, int opcode) {
162165
return;
163166
}
164167
JavaMethod calleeMethod = lookupMethodInPool(cpi, opcode);
168+
/*
169+
* Bootstrap method are executed at build time for Web Image due to issue with
170+
* BoundMethodHandle$SpeciesData
171+
*/
165172
if (bootstrap == null || calleeMethod instanceof ResolvedJavaMethod ||
166-
BootstrapMethodConfiguration.singleton().isIndyAllowedAtBuildTime(OriginalMethodProvider.getJavaMethod(bootstrap.getMethod()))) {
173+
BootstrapMethodConfiguration.singleton().isIndyAllowedAtBuildTime(OriginalMethodProvider.getJavaMethod(bootstrap.getMethod())) ||
174+
ImageSingletons.lookup(Platform.class).getOS().equals("js")) {
167175
super.genInvokeDynamic(cpi, opcode);
168176
return;
169177
}

0 commit comments

Comments
 (0)