Skip to content

Commit

Permalink
Update java code for RISC-V (src)
Browse files Browse the repository at this point in the history
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]>
  • Loading branch information
Cheng Jin committed Oct 11, 2019
1 parent 642d340 commit 69a94ea
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* ===========================================================================
* (c) Copyright IBM Corp. 2019, 2019 All Rights Reserved
* ===========================================================================
*/

package com.sun.tools.sjavac.client;

Expand Down Expand Up @@ -84,6 +89,8 @@ public class SjavacClient implements Sjavac {

// Store the server conf settings here.
private final String settings;

private boolean isRiscv = System.getProperty("os.arch").toLowerCase().contains("riscv");

public SjavacClient(Options options) {
String tmpServerConf = options.getServerConf();
Expand Down Expand Up @@ -183,10 +190,15 @@ private Socket tryConnect() throws IOException, InterruptedException {
try {
return makeConnectionAttempt();
} catch (IOException ex) {
Log.error("Connection attempt failed: " + ex.getMessage());
if (attempt >= MAX_CONNECT_ATTEMPTS) {
Log.error("Giving up");
throw new IOException("Could not connect to server", ex);
/* Keep trying to connect as the native compilation with a non-JIT cross build
* on Linux/RISCV is extremely slow.
*/
if (!isRiscv) {
Log.error("Connection attempt failed: " + ex.getMessage());
if (attempt >= MAX_CONNECT_ATTEMPTS) {
Log.error("Giving up");
throw new IOException("Could not connect to server", ex);
}
}
}
Thread.sleep(WAIT_BETWEEN_CONNECT_ATTEMPTS);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
/*
* ===========================================================================
* (c) Copyright IBM Corp. 2019, 2019 All Rights Reserved
* ===========================================================================
*/

package com.sun.tools.sjavac.server;

Expand Down Expand Up @@ -76,6 +81,7 @@ public class PortFile {
private long serverCookie;
private int myServerPort;
private long myServerCookie;
private boolean isRiscv = System.getProperty("os.arch").toLowerCase().contains("riscv");

/**
* Create a new portfile.
Expand Down Expand Up @@ -247,7 +253,11 @@ public void waitForValidValues() throws IOException, InterruptedException {
Log.debug("Valid port file values found after " + (System.currentTimeMillis() - startTime) + " ms");
return;
}
if (System.currentTimeMillis() > timeout) {

/* Keep waiting for port file values as the native compilation with a non-JIT cross build
* on Linux/RISCV is extremely slow.
*/
if (!isRiscv && (System.currentTimeMillis() > timeout)) {
break;
}
Thread.sleep(MS_BETWEEN_ATTEMPTS);
Expand Down

0 comments on commit 69a94ea

Please sign in to comment.