简体   繁体   English

如何为 openJDK11 构建 hsdis-amd64.dll?

[英]How can I build hsdis-amd64.dll for openJDK11?

I'm doing a course on Java Performance Optimization and I'm stuck trying to download all the required files so that I can build this DLL hsdis-amd64.dll.我正在做一门关于 Java 性能优化的课程,但我一直在尝试下载所有必需的文件,以便我可以构建这个 DLL hsdis-amd64.dll。 It's supposed to allow me to use JITWatch and learn about the JIT during this course.它应该允许我在本课程中使用 JITWatch 并了解 JIT。

Anyway, the instructions here say to download hotspot for your exact JDK.无论如何,此处的说明说要为您的确切 JDK 下载热点。 My JDK is 11 build 11+28.我的 JDK 是 11 构建 11+28。

This is the openJDK repository where这是openJDK 存储库,其中

  1. I'm supposed to look underopenJDK/MYVERSION/hotspot我应该看看openJDK/MYVERSION/hotspot
  2. Click tags, select my exact release点击标签,选择我的确切版本
  3. Click bz2 to download点击bz2下载
  4. After which I'm supposed to patch the hotspot hsdiss library I just downloaded and then之后我应该修补我刚刚下载的热点hsdiss库然后
  5. re MAKE it.重新制作。
  6. Throws the output DLL into my java/bin/将输出的 DLL 扔进我的 java/bin/

I see the DLLs can't be prebuilt because of licence issues.我看到由于许可证问题无法预构建 DLL。 Any idea how people are using JITWatch with openJDK11?知道人们如何将 JITWatch 与 openJDK11 一起使用吗?

I have built it recently based on a post from here: https://dropzone.nfshost.com/hsdis/我最近根据这里的帖子构建了它: https : //dropzone.nfshost.com/hsdis/

  1. Install Cygwin.安装 Cygwin。 At the Select Packages screen, add the following packages (expand the All/Devel category, Search for the package's name, and change the package's New status from Skip to the latest non-Test version):在 Select Packages 屏幕上,添加以下包(展开 All/Devel 类别,搜索包的名称,并将包的 New 状态从 Skip 更改为最新的非测试版本):

    gcc-core make mingw64-i686-gcc-core (only needed for hsdis-i386.dll) mingw64-x86_64-gcc-core (only needed for hsdis-amd64.dll) gcc-core make mingw64-i686-gcc-core(仅 hsdis-i386.dll 需要) mingw64-x86_64-gcc-core(仅 hsdis-amd64.dll 需要)

  2. Run Cygwin in a terminal shell在终端 shell 中运行 Cygwin

  3. Download GNU binutils 2.32 to your Cygwin home directory, and extract it with tar xvf binutils-2.32.tar.xz in a place that you can easily access from cygwin paths.将 GNU binutils 2.32 下载到您的 Cygwin 主目录,并使用 tar xvf binutils-2.32.tar.xz 将其解压缩到您可以从 cygwin 路径轻松访问的位置。

  4. Change to the JDK/src/utils/hsdis directory切换到JDK/src/utils/hsdis目录

  5. Build 64bit Windows like this:像这样构建 64 位 Windows:

    make OS=Linux MINGW=x86_64-w64-mingw32 BINUTILS=/cygdrive/c/cygwin/binutils-2.32 make OS=Linux MINGW=x86_64-w64-mingw32 BINUTILS=/cygdrive/c/cygwin/binutils-2.32

  6. If the above command fails (as it might with some unpatched JDK builds) with:如果上面的命令失败(因为它可能与一些未修补的 JDK 版本一样):

    compress.c:(.text+0x5b): undefined reference to `inflateInit_' compress.c:(.text+0x5b): 未定义对 `inflateInit_' 的引用

Edit the Makefile, look for libiberty.a and change the library list to include libz.a, like this:编辑 Makefile,查找 libiberty.a 并将库列表更改为包含 libz.a,如下所示:

   LIBRARIES =  $(TARGET_DIR)/bfd/libbfd.a \
        $(TARGET_DIR)/opcodes/libopcodes.a \
        $(TARGET_DIR)/libiberty/libiberty.a \
        $(TARGET_DIR)/zlib/libz.a

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM