Skip to content

Commit 1600390

Browse files
committed
[RISCV64][FIX]Forcing crash when code size is more than supported on this architecture
1 parent 6ace084 commit 1600390

File tree

2 files changed

+6
-0
lines changed

2 files changed

+6
-0
lines changed

com.oracle.max.asm/src/com/oracle/max/asm/target/riscv64/RISCV64.java

+2
Original file line numberDiff line numberDiff line change
@@ -275,6 +275,8 @@ public static boolean isGeneralPurposeReg(CiRegister reg) {
275275
return isIntReg(reg) && !reg.equals(zr) && !reg.equals(sp);
276276
}
277277

278+
public static final int MAX_DIRECT_JUMP_SIZE = CiUtil.M - CiUtil.K;
279+
278280
@Override
279281
public boolean usesTrampolines() {
280282
return true;

com.sun.c1x/src/com/sun/c1x/C1XCompiler.java

+4
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@
2020
*/
2121
package com.sun.c1x;
2222

23+
import com.oracle.max.asm.target.riscv64.RISCV64;
2324
import com.oracle.max.cri.intrinsics.IntrinsicImpl;
2425
import com.oracle.max.criutils.TTY;
2526
import com.sun.c1x.debug.CFGPrinterObserver;
@@ -114,6 +115,9 @@ public CiResult compileMethod(RiResolvedMethod method, int osrBCI, CiStatistics
114115
TTY.println(String.format("C1X %4d %-70s %-45s %-50s | %3d.%dms %5dB", index, "", "", "", time / 10, time % 10, result.targetMethod().targetCodeSize()));
115116
}
116117
}
118+
if (target.arch.isRISCV64() && result.targetMethod().targetCodeSize() >= RISCV64.MAX_DIRECT_JUMP_SIZE) {
119+
throw new CiBailout("methods larger than 1MB are not supported in RISCV64: ");
120+
}
117121

118122
return result;
119123
}

0 commit comments

Comments
 (0)