Running Java programs in gem5(or any language which is not C)

后端 未结 2 1298
感动是毒
感动是毒 2021-01-24 02:01

This may be a silly question, but i\'m learning about gem5 recently and i\'m being able to simulate my C programs using this software, in syscall emulation and in full system si

2条回答
  •  一个人的身影
    2021-01-24 02:12

    You execute Java programs exactly the same way you execute C programs:

    • Gem5 doesn't understand C, so if you want to execute a C program, you first need to compile it to a language Gem5 understands, or you need to interpret it in an interpreter that is written in a language Gem5 understands.
    • Gem5 doesn't understand Java, so if you want to execute a Java program, you first need to compile it to a language Gem5 understands, or you need to interpret it in an interpreter that is written in a language Gem5 understands.

    Here are a couple of possibilities I can think of:

    • use a native code compiler to compile Java to Alpha, ARM, Sparc, or x86 native machine code,
    • use a Java interpreter written in (or compiled to) Alpha, ARM, Sparc, or x86 native machine code to interpret that Java code,
    • use a JVM compiler to compile Java to JVM bytecode, then use a JVM written in (or compiled to) Alpha, ARM, Sparc, or x86 native machine code to interpret that JVM bytecode, or
    • use a JVM compiler to compile Java to JVM bytecode, then use a native code compiler to compile the JVM bytecode to Alpha, ARM, Sparc, or x86 native machine code.

    It is, of course, possible to chain and/or mix any number of the above.

提交回复
热议问题