• https://qiita.com/koduki/items/e53cb109c47b903de528
  • https://hub.docker.com/r/oracle/graalvm-ce
  • https://www.graalvm.org/docs/getting-started/#docker-containers

GraalVMとは

https://www.graalvm.org/

GraalVMは、JavaScript、Python、Ruby、R、Java、Scala、Kotlin、ClojureなどのJVMベースの言語、およびCやC ++などのLLVMベースの言語で作成されたアプリケーションを実行するためのユニバーサル仮想マシンです。 GraalVMはプログラミング言語間の分離を取り除き、共有ランタイムでの相互運用性を可能にします。スタンドアロンでも、OpenJDK、Node.js、Oracle Database、またはMySQLのコンテキストでも実行できます。

テスト

docker pull oracle/graalvm-ce:1.0.0-rc16
public class Hello {
  public static void main(String[] args) {
    System.out.println("Hello, World!");
  }
}
docker run -it -v "`pwd`:/src" oracle/graalvm-ce:1.0.0-rc16 javac /src/Hello.java
docker run -it -v "`pwd`:/src" oracle/graalvm-ce:1.0.0-rc16 java -version
openjdk version "1.8.0_202"
OpenJDK Runtime Environment (build 1.8.0_202-20190206132807.buildslave.jdk8u-src-tar--b08)
OpenJDK GraalVM CE 1.0.0-rc16 (build 25.202-b08-jvmci-0.59, mixed mode)
$ docker run -it -v "`pwd`:/src" oracle/graalvm-ce:1.0.0-rc16 /bin/bash
bash-4.2# cd src
bash-4.2# native-image Hello
Build on Server(pid: 10, port: 45523)*
[hello:10]    classlist:   4,285.34 ms
[hello:10]        (cap):   2,186.25 ms
[hello:10]        setup:   5,889.79 ms
[hello:10]   (typeflow):   8,862.45 ms
[hello:10]    (objects):   2,198.00 ms
[hello:10]   (features):     399.73 ms
[hello:10]     analysis:  11,659.88 ms
[hello:10]     universe:     533.22 ms
[hello:10]      (parse):   2,412.32 ms
[hello:10]     (inline):   3,821.79 ms
[hello:10]    (compile):  18,157.09 ms
[hello:10]      compile:  24,989.69 ms
[hello:10]        image:     722.68 ms
[hello:10]        write:     297.69 ms
[hello:10]      [total]:  48,837.29 ms

bash-4.2# file ./hello
./hello: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32, BuildID[sha1]=30ca7b96f8f4615a48f11502b868bc61c99614ea, not stripped

Ghidraで確認

void main(int param_1,long param_2,undefined8 param_3,undefined8 param_4,ulong **param_5,
         ulong param_6)
{
  uint uVar1;
  undefined8 uVar2;
  undefined8 extraout_RDX;
  undefined8 extraout_RDX_00;
  undefined8 extraout_RDX_01;
  undefined8 unaff_R15;
  bool bVar3;
  
  uVar2 = CEntryPointSnippets_createIsolate_f1111fe1c782eae0d0e674e1aba1dff3bc5e04ea
                    (0,0xe8,param_3,unaff_R15,(undefined *)param_5);
  uVar1 = (uint)uVar2;
  uVar2 = extraout_RDX;
  if (uVar1 == 0) {
    unaff_R15 = 1;
    LOCK();
    bVar3 = _DAT_000000e4 == 3;
    _DAT_000000e4 = _DAT_000000e4 ^ (uint)bVar3 * (_DAT_000000e4 ^ 1);
    if (!bVar3) {
      Safepoint_enterSlowPathNativeToJava_7405606951b146d1e5a18c3861fef52afd34fa42();
    }
    uVar2 = CEntryPointSnippets_initializeIsolate_d0c89925cb55aeb9f29e01c065f8625ff6aa5311();
    uVar1 = (uint)uVar2;
    uVar2 = extraout_RDX_01;
  }
  if (uVar1 != 0) {
    CEntryPointSnippets_failFatally_f9518a09837cd81f754a9910fba1cfdc09ffb3e9
              (uVar1,s_Failed_to_create_a_new_Isolate._00831118);
    uVar2 = extraout_RDX_00;
  }
  JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b
            (param_1,param_2,uVar2,unaff_R15,param_5,param_6);
  _DAT_000000e4 = 3;
  return;
}

最後のJavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b関数は

undefined8
JavaMainWrapper_run_5087f5482cc9a6abc971913ece43acb471d2631b
          (int param_1,long param_2,undefined8 param_3,undefined8 param_4,ulong **param_5,
          ulong param_6)

{
  int *piVar1;
  ulong **ppuVar2;
  undefined uVar3;
  long lVar4;
  undefined extraout_DL;
  undefined extraout_DL_00;
  undefined extraout_DL_01;
  undefined8 extraout_RDX;
  undefined8 extraout_RDX_00;
  undefined8 extraout_RDX_01;
  undefined uVar5;
  long lVar6;
  long lVar7;
  undefined uVar8;
  undefined7 uVar9;
  undefined uVar10;
  undefined7 uVar11;
  long unaff_R14;
  long unaff_R15;
  undefined in_stack_ffffffffffffffc8;
  long local_20;
  undefined8 local_18;
  long local_10;
  int local_4;
  
  uVar10 = (undefined)param_6;
  uVar11 = (undefined7)(param_6 >> 8);
  uVar8 = SUB81(param_5,0);
  uVar9 = (undefined7)((ulong)param_5 >> 8);
  if (&stack0xffffffffffffffc8 <= *(undefined **)(unaff_R15 + 0xa0)) {
    local_10 = param_2;
    local_4 = param_1;
                    /* WARNING: Subroutine does not return */
    StackOverflowCheckSnippets_throwNewStackOverflowError_d3212575561bd35f8d5679c68d3664f797596772()
    ;
  }
  local_10 = param_2;
  local_4 = param_1;
  JavaThreads_assignJavaThread_51d616555398afd5174613d4858ac100e07d3a63
            (unaff_R15,unaff_R14 + 0x10d678,1,(char)param_4,uVar8,uVar10,in_stack_ffffffffffffffc8);
  uVar3 = (undefined)param_4;
  AMD64CPUFeatureAccess_verifyHostSupportsArchitecture_a245fcf8f321d356e5ea9eabb5b00fee7b4d54f5
            (unaff_R14 + 0x18,(ulong **)(unaff_R14 + 0x999d0),extraout_RDX,param_4,
             (ulong **)CONCAT71(uVar9,uVar8),CONCAT71(uVar11,uVar10),in_stack_ffffffffffffffc8);
  uVar5 = (undefined)local_10;
  ppuVar2 = SubstrateUtil_getArgs_f6fae271ffcd8e6b44e2cae17002cdf03d056e58
                      (local_4,local_10,extraout_DL,uVar3,uVar8,uVar10,in_stack_ffffffffffffffc8);
  local_18 = RuntimeOptionParser_parseAndConsumeAllOptions_ea5df6b0ce18e46dfb04c5cfb67aa76b661b2382
                       (ppuVar2);
  lVar4 = unaff_R14 + 0x999f8;
  local_20 = lVar4;
  RuntimeSupport_executeHooks_aeaf8830d7ee66410428a0cc2b656fc125c2659b
            (unaff_R14 + 0x10d6f0,uVar5,extraout_DL_00,(char)lVar4,uVar8,uVar10,
             in_stack_ffffffffffffffc8);
  lVar6 = unaff_R14 + 0x99a10;
  PrintStream_println_f593729257942307f0e76e88b8ac75793942d994
            ((ulong **)(unaff_R14 + 0x10d708),lVar6,extraout_RDX_00,lVar4,CONCAT71(uVar9,uVar8),
             CONCAT71(uVar11,uVar10));
  lVar7 = local_20;
  JavaThreads_joinAllNonDaemons_84a0a7a40c9a2d93e4b76037bc61aeddb4557324
            (local_20,(char)lVar6,extraout_DL_01,(char)lVar4,uVar8,uVar10,in_stack_ffffffffffffffc8)
  ;
  Shutdown_shutdown_f4fbc651591bd0937c24637e75bd4df3e877c399
            (lVar7,lVar6,extraout_RDX_01,lVar4,CONCAT71(uVar9,uVar8),CONCAT71(uVar11,uVar10));
  piVar1 = (int *)(unaff_R15 + 0xd0);
  *piVar1 = *piVar1 + -1;
  if (*piVar1 != 0) {
    return 0;
  }
  Safepoint_enterSlowPathSafepointCheck_6065687f19bea4c522a5ace56dcc1231d113e373();
  return 0;
}

PrintStream_println_f593729257942307f0e76e88b8ac75793942d994関数で表示している模様。