在gem5(或任何非C语言)中运行Java程序 [英] Running Java programs in gem5(or any language which is not C)

查看:169
本文介绍了在gem5(或任何非C语言)中运行Java程序的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这可能是一个愚蠢的问题,但是我最近正在学习gem5,并且能够使用该软件在syscall仿真和完整系统仿真中仿真我的C程序.但是,每当我尝试将任何Java程序模拟到其中时,都会出现此错误(系统调用仿真):

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 simulation. However, whenever I try to simulate any Java program into it, I get this error(syscall emulation):

gem5 Simulator System.  http://gem5.org
gem5 is copyrighted software; use the --copyright option for details.

gem5 compiled Aug 26 2019 12:58:15
gem5 started Sep  5 2019 14:56:02
gem5 executing on (...), pid 6115
command line: build/X86/gem5.opt configs/learning_gem5/part1/test.py

Global frequency set at 1000000000000 ticks per second
warn: DRAM device capacity (8192 Mbytes) does not match the address range assigned (512 Mbytes)
fatal: fatal condition !obj_file occurred: Cannot load object file /home/taoliveira/Downloads/Gem5/gem5/configs/learning_gem5/part1/../../../my-progs/MergeSort/bin/x86/linux/MergeSort.
Memory Usage: 661468 KBytes

在这种情况下,我尝试了一个简单的mergesort Java程序.它是在gem5模拟器之外正常编译和执行的.在我有机器的.py文件中(这是gem5教程的simple.py),二进制文件是指向.jar文件的路径.我听说.jar在gem5中无法正常工作,但我不知道该用什么. 那么,在gem5模拟器中运行非C程序需要做什么?在这种情况下,运行Java程序必须做什么?

In this case, I tried a simple mergesort Java program. It is compiling and executing normally outside the gem5 simulator. In the .py file where I have my machine(it's the simple.py of gem5 tutorials), the binary is a path which leads to the .jar file. I've heard that .jar would not work properly in gem5 but I don't know what to use instead. So, what I have to do to run non-C programs in gem5 simulator? In this case, what I have to do to run a java program?

我到处都在寻找答案,但找不到答案.有人可以帮我吗?预先感谢.

I looked everywhere for an answer but wasn't able to find it. Can anyone help me, please? Thanks in advance.

我正在使用Ubuntu 18.04和Java 1.8.0_201.

I'm using Ubuntu 18.04 and Java 1.8.0_201.

我试图将Java代码转换为本机代码(x86),并使用GraalVM进行了处理,然后将其传递给runscript,就像处理C程序一样.但是,它在加载脚本时显示了一个新错误:

Edit : I've tried to convert my Java code to native machine code(x86) and did it with GraalVM, and i'm passing it to the runscript, in the same way I did with C programs. However, it shows me a new error when loading the script:

loading script...
Fatal error: Failed to create a new Isolate. (code 6)

以前从未看过它,在谷歌搜索时也没有找到任何关于它的东西.

Never seen it before and didn't find anything about it when googling.

推荐答案

类似的帖子:几乎可以肯定,可以使用完整的系统Ubuntu映像(在运行gem5之前以QEMU用户模式预安装Java).

A full system Ubuntu image will almost certainly work (pre-install Java with QEMU user mode before running gem5).

从理论上讲,X86 syscall仿真可以正常工作,命令行类似于:

X86 syscall emulation could in theory just work, the command line would be something like:

build/X86/gem5.opt \
  configs/example/se.py \
  --cmd /usr/bin/java \
  --options HelloWorld \
  --param 'system.cpu[0].workload[:].release = "5.2.1"' \

其中,/usr/bin/java是Java解释器ELF可执行文件,就像您的C程序一样,而HelloWorld.class是作为参数传递给java的已编译Java类.

where /usr/bin/java is the Java interpreter ELF executable just like your C program, and HelloWorld.class is the compiled Java class passed as an argument to java.

但是,我在Ubuntu 18.04和gem5 61005bb9ef455b2ac851f8a992f2cec5686e520f上尝试了此操作,但失败了:

However, I tried this on Ubuntu 18.04 and gem5 61005bb9ef455b2ac851f8a992f2cec5686e520f and it failed with:

/usr/bin/java:加载共享库时出错:libjli.so:无法打开共享库文件:没有这样的文件或目录

/usr/bin/java: error while loading shared libraries: libjli.so: cannot open shared object file: No such file or directory

我不确定为什么会这样,需要进一步调查.

I'm not sure why that was the case, it would require further investigation.

SE ARM用户区当前不支持动态加载的可执行文件,因此您将需要静态编译JVM,这可能很痛苦/不可能.

SE ARM userland does not currently support dynamic loaded executables, so you would need to compile JVM statically, which might be a pain / impossible.

这篇关于在gem5(或任何非C语言)中运行Java程序的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆