-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
29 additions
and
51 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,29 @@ | ||
# Reproducer for native-image issue | ||
|
||
Reproducer of https://github.com/oracle/graal/issues/1725 | ||
|
||
``` | ||
cd /tmp | ||
git clone --branch unreachable-unresolved-code https://github.com/zakkak/issue-reproducers reproducers | ||
git clone --branch 2024-09-13-delete-no-class-def-found https://github.com/zakkak/issue-reproducers reproducers | ||
cd reproducers | ||
mvn package | ||
export JAVA_HOME=/opt/jvms/graalvm-ce-java11-22.1.0 | ||
# run with Unreachable on the classpath | ||
$JAVA_HOME/bin/java -cp target/classes Main | ||
java -cp target/classes Main | ||
# run with Unreachable not on the classpath | ||
$JAVA_HOME/bin/java \ | ||
java \ | ||
-jar target/reproducer-1.0-SNAPSHOT.jar | ||
# generate native-image with Unreachable not on the classpath | ||
$JAVA_HOME/bin/native-image \ | ||
--link-at-build-time \ | ||
--initialize-at-build-time=. \ | ||
native-image \ | ||
--no-fallback \ | ||
-H:+ReportExceptionStackTraces \ | ||
-jar target/reproducer-1.0-SNAPSHOT.jar | ||
# Run the generated image | ||
# Run binary | ||
./reproducer-1.0-SNAPSHOT | ||
# generate native-image with Unreachable not on the classpath and pass --report-unsupported-elements-at-runtime | ||
native-image \ | ||
--no-fallback \ | ||
--report-unsupported-elements-at-runtime \ | ||
-H:+ReportExceptionStackTraces \ | ||
-jar target/reproducer-1.0-SNAPSHOT.jar | ||
# Build fails | ||
``` | ||
|
||
To generate the IGV graph for main use | ||
``` | ||
native-image --initialize-at-build-time=. --no-fallback -H:Dump=:1 -H:MethodFilter=Main.main -jar target/reproducer-1.0-SNAPSHOT.jar | ||
``` | ||
|
||
and render it with | ||
``` | ||
seafoam graal_dumps/2022.06.17.16.02.27.868/SubstrateHostedCompilation-3596\[Main.main\(String\[\]\)void\].bgv:0 render | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,35 +1,15 @@ | ||
import java.util.Random; | ||
|
||
import com.oracle.svm.core.annotate.NeverInline; | ||
import com.oracle.svm.core.annotate.Delete; | ||
import com.oracle.svm.core.annotate.TargetClass; | ||
|
||
public class Main { | ||
|
||
static final ClassNotFoundException CNFE; | ||
|
||
static | ||
{ | ||
ClassNotFoundException cnfe; | ||
|
||
try { | ||
Class.forName("Unreachable"); | ||
cnfe = null; | ||
} catch (ClassNotFoundException e) { | ||
cnfe = e; | ||
} | ||
|
||
CNFE = cnfe; | ||
} | ||
|
||
@NeverInline("I want to see the BGV") | ||
public static void main(String[] args) { | ||
if (unreachableIsReachable()) { | ||
Unreachable.reached(); | ||
} | ||
|
||
System.out.println("Hello world!"); | ||
} | ||
} | ||
|
||
@Delete | ||
@TargetClass(className = "Foo") | ||
final class Target_Foo { | ||
|
||
private static boolean unreachableIsReachable() { | ||
return CNFE == null; | ||
} | ||
} |