Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update java code for RISC-V (src) #221

Closed

Conversation

ChengJin01
Copy link

@ChengJin01 ChengJin01 commented Oct 10, 2019

The changes are to modify the java code in the
src directory to avoid the timeout issue in the
native compilation on RISC-V.

Issue: #218

Signed-off-by: Cheng Jin [email protected]

@ChengJin01
Copy link
Author

Already verified the compilation on Fedora_Linux/QEMU.

Reviewer: @keithc-ca , @pshipton , @DanHeidinga

@keithc-ca
Copy link
Member

Did you try arrange to set the system property serverStartupTimeout in the build setup rather than change these files?

The changes are to modify the java code in the
src directory to avoid the timeout issue in the
native compilation on RISC-V.

Issue: ibmruntimes#218

Signed-off-by: Cheng Jin <[email protected]>
@ChengJin01 ChengJin01 force-pushed the jdk11_riscv_part3_src_dir branch from c1933fc to 69a94ea Compare October 11, 2019 01:35
@ChengJin01
Copy link
Author

ChengJin01 commented Oct 11, 2019

Did you try arrange to set the system property serverStartupTimeout in the build setup rather than change these files?

Setting the system property serverStartupTimeout won't fix the issue as it will take more than 36 hours to finish the whole compilation inside Fedora_Linux/QEMU. So we have to totally disable the timeout setting to get the build created.

@keithc-ca
Copy link
Member

The whole build might take 36 hours, but each attempt to connect to the server will take much less time.
Adding -DserverStartupTimeout=3600 (one hour) to the right place is preferable to modifying openjdk code.

@ChengJin01
Copy link
Author

ChengJin01 commented Nov 14, 2019

The whole build might take 36 hours, but each attempt to connect to the server will take much less time.
Adding -DserverStartupTimeout=3600 (one hour) to the right place is preferable to modifying openjdk code.

I tried with JAVA_FLAGS_JAVAC += "-DserverStartupTimeout=36000" but it still ended up with the same failure as follows:

=== Output from failing command(s) repeated here ===
* For target buildtools_create_symbols__the.COMPILE_CREATE_SYMBOLS_batch:
Sjavac server failed to initialize: No port file values materialized. Giving up after 60424 ms
Process output:
<End of process output>
Process exit code: 0
IOException caught during compilation: Server failed to initialize: No port file values materialized. Giving up after 60424 ms <------  it means timeout = 60 secs (the default value)

Looking at the command line options:
buildtools_create_symbols__the.COMPILE_CREATE_SYMBOLS_batch.cmdline.txt
It didn't include JAVA_FLAGS_JAVAC += "-DserverStartupTimeout=36000", which means it was set up in the wrong place.

Looking at the options above in the buildtools_create_symbols__the.COMPILE_CREATE_SYMBOLS_batch.cmdline.txt

/home/jincheng/RISCV_OPENJ9/images_native_boot_jdk/jdk/bin/java
-XX:+UseSerialGC
-Xms32M
-Xmx512M
...
-m jdk.compiler.interim/com.sun.tools.sjavac.Main
--server:portfile=/.../openj9-openjdk-jdk11/build/linux-riscv64-normal-...
-XDignore.symbol.file=true  -XDstringConcat=inline <-------

The option -XDignore.symbol.file=true -XDstringConcat=inline only occurs at /openj9-openjdk-jdk11/make/common/SetupJavaCompilers.gmk

$(eval $(call SetupJavaCompiler,GENERATE_OLDBYTECODE, \
    JVM := $(JAVA_SMALL), \
    JAVAC := $(NEW_JAVAC), \
---> FLAGS := $(BOOT_JDK_SOURCETARGET) -XDignore.symbol.file=true -XDstringConcat=inline \
        $(DISABLE_WARNINGS) -Xlint:-options, \
    SERVER_DIR := $(SJAVAC_SERVER_DIR), \
    SERVER_JVM := $(SJAVAC_SERVER_JAVA))) <---------

In which case the server JVM is SJAVAC_SERVER_JAVA which is set up at /openj9-openjdk-jdk11/make/autoconf/spec.gmk.in

SJAVAC_SERVER_JAVA_FLAGS:=@SJAVAC_SERVER_JAVA_FLAGS@
...
SJAVAC_SERVER_JAVA_CMD:=@SJAVAC_SERVER_JAVA@
SJAVAC_SERVER_JAVA=@FIXPATH@ @FIXPATH_DETACH_FLAG@ $(SJAVAC_SERVER_JAVA_CMD) \
    $(SJAVAC_SERVER_JAVA_FLAGS)
...
# Include the custom-spec.gmk file if it exists
-include $(dir @SPEC@)/custom-spec.gmk

Ideally, SJAVAC_SERVER_JAVA_FLAGS should be appended with the serverStartupTimeout property in custom-spec.gmk I will try to directly append -DserverStartupTimeout=36000 to SJAVAC_SERVER_JAVA_FLAGS in custom-spec.gmk to see how it goes in this way.

@keithc-ca
Copy link
Member

It works for me. I added:

JAVA_FLAGS_JAVAC += -DserverStartupTimeout=0

to the end of custom-spec.gmk and observed the (expected) failure:

Sjavac server failed to initialize: No port file values materialized. Giving up after 566 ms

@ChengJin01
Copy link
Author

ChengJin01 commented Nov 14, 2019

It works for me. I added:

JAVA_FLAGS_JAVAC += -DserverStartupTimeout=0

to the end of custom-spec.gmk and observed the (expected) failure:

Sjavac server failed to initialize: No port file values materialized. Giving up after 566 ms

Just talked to @keithc-ca as to the results, it turns out it only works for the case of JAVA_JAVAC and fails to address the case of JAVA_SMALL (which is the failure on RISC-V).

Given that JAVA_FLAGS is set up for both JAVA_JAVAC and JAVA_SMALL in /riscv_openj9-openjdk-jdk11_v2/make/autoconf/spec.gmk.in,,

JAVA_SMALL=@FIXPATH@ $(JAVA_CMD) $(JAVA_FLAGS_SMALL) $(JAVA_FLAGS)
JAVA_JAVAC=@FIXPATH@ $(JAVA_CMD) $(JAVA_FLAGS_JAVAC) $(JAVA_FLAGS)

I will try to add JAVA_FLAGS += -DserverStartupTimeout=36000 in custom-spec.gmk.in to see whether it covers all cases this way.

@ChengJin01
Copy link
Author

I compiled the build with the change above at local VM and there was no time-out issue being detected.
In addition, It stopped compiling at the last stage in generating the jdk image on the Fyre VM (where the time-out issue was originally detected) due to the scheduled outage for maintenance last Friday. Will double-check again to confirm when it is back online this week.

So I added the change JAVA_FLAGS += -DserverStartupTimeout=36000 in custom-spec.gmk.in at #219. Will close this PR once the compilation passes on that Fyre VM.

@ChengJin01
Copy link
Author

ChengJin01 commented Nov 19, 2019

The build with JAVA_FLAGS += -DserverStartupTimeout=36000 was compiled successfully on the Fyre VM as follows:

Creating images/jmods/java.base.jmod
Creating jdk image
Finished building target 'all' in configuration 'linux-riscv64-normal-server-release'
[jincheng@stage4 openj9-openjdk-jdk11]$ ls
ADDITIONAL_LICENSE_INFO  LICENSE   README.md  build   configure  get_source.sh  omr     src
ASSEMBLY_EXCEPTION       Makefile  bin        closed  doc        make           openj9  test
[jincheng@stage4 openj9-openjdk-jdk11]$ cd build
[jincheng@stage4 build]$ ls
linux-riscv64-normal-server-release
[jincheng@stage4 build]$ cd linux-riscv64-normal-server-release
[jincheng@stage4 linux-riscv64-normal-server-release]$ cd images
[jincheng@stage4 images]$ jdk/bin/java   -version
openjdk version "11.0.6-internal" 2020-01-14
OpenJDK Runtime Environment (build 11.0.6-internal+0-adhoc.jincheng.openj9-openjdk-jdk11)
Eclipse OpenJ9 VM (build riscv_openj9_v2_uma-8166b3c98, 
JRE 11 Linux riscv-64-Bit Compressed References 20191118_000000 (JIT disabled, AOT disabled)
OpenJ9   - 8166b3c98
OMR      - 78b1cb9c
JCL      - 7516c26767 based on jdk-11.0.6+2)

So close this PR now based on the compilation result above.

@ChengJin01 ChengJin01 closed this Nov 19, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants