GraalVM: Run Programs Faster Anywhere - GNU GPL version 2

C1Visualizer shows the LIR and generated machine code.

https://github.com/oracle/graal/blob/master/compiler/docs/Debugging.md

http://lafo.ssw.uni-linz.ac.at/papers/2017_PLDI_GraalTutorial.pdf

https://chrisseaton.com/truffleruby/metass16/metass.pdf

It seems C can be used ith graalvm in a blog at
https://yyhh.org/blog/2021/02/writing-c-code-in-javaclojure-graalvm-specific-programming/

graalvm can interface to C at
https://www.graalvm.org/reference-manual/native-image/#images-and-entry-points

and

https://www.reddit.com/r/java/comments/8s7sr8/interacting_with_c_using_graalvm/

#include <stdio.h>

void printHello() {
FILE *f = fopen("file.txt", "w");
if (f == NULL)
{
		printf("Error opening file!\n");
} else {
	const char *text = "world";
	fprintf(f, "Hello: %s\n", text);
	fclose(f);
}
}

clang -g -O1 -c -emit-llvm yourTestProgram.c to produce yourTestProgram.bc

import java.io.File
import org.graalvm.polyglot.Source
import org.graalvm.polyglot.Context

val s = Source.newBuilder("llvm", new File("./yourTestProgram.bc")).build
val c = Context.newBuilder().allowNativeAccess(true).build()
val lib = c.eval(s)
val fn = lib.getMember("printHello")
fn.executeVoid()