I thought this might interest you Rust folk. This is kinda like an LLVM bitcode to JVM bytecode translator. So run rustc with --emit=llvm-ir (I think that’s the flag) and then pass the bitcode image to this program, then get JVM bytecode which you can make a JVM bytecode archive (JAR) from it. Could be an interesting? The author says it can JVM code from Clang output, so why not Rustc?

Keep in mind that these are two different beasts, JVM is designed for a safe virtual machine and LLVM is chiefly used to be translated into machine code. However, stupider and more wonderful things have been done with LLVM and JVM, for example, there’s an LLVM to 6502 translator, so you could be making NES games with Rust.

I will test this in a few days, busy implementing my own JVM (hope I can do it) and I don’t have the Rust toolchain installed on my system. But hey maybe someone can make a Cargo plugin from it (is it possible?)

Thanks, later.

    • BB_C@programming.dev
      link
      fedilink
      arrow-up
      1
      arrow-down
      7
      ·
      6 months ago

      The problem is, if you knew anything about the subject matter, you would know that even JAVA code ends up being compiled ahead-of-time by ART to ELF binaries on Android.
      Even non-devs know this stuff!

      • ChubakPDP11+TakeWithGrainOfSalt@programming.devOP
        link
        fedilink
        arrow-up
        1
        arrow-down
        2
        ·
        6 months ago

        Hey now, I am just a yokel from Mazar-Sharif, New York who sells dingbat carcasses for infant consumption, but does Android even use JVM? I was under the consumption it uses Dalvik? Let me consume a dingbat – ok, so who cares what “java” gets compiled to, JIT, AOT even tree-walked, we’re talking about JVM here. Here: https://sourceforge.net/projects/jasmin/ An ancient JVM bytecode assembler.

        • BB_C@programming.dev
          link
          fedilink
          arrow-up
          2
          arrow-down
          1
          ·
          6 months ago

          Maybe I should have written something simpler like “What is the shortest distance between two points, and how does it look like?”

        • LeFantome@programming.dev
          link
          fedilink
          arrow-up
          1
          ·
          edit-2
          6 months ago

          I do not know why I al defending that guy, but the comment he is replying to specifically mentioned Android. So, he is not the one that narrowed the conversation from JVM to Android.

          Also, I am sure your dingbat humour is quite hilarious. Unfortunately, it went completely over my head.