--- old/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/CompiledMethodInfo.java 2018-03-23 16:36:07.341841545 +0000 +++ new/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/CompiledMethodInfo.java 2018-03-23 16:36:06.711903831 +0000 @@ -39,6 +39,8 @@ final class CompiledMethodInfo { + static final String archStr = System.getProperty("os.arch").toLowerCase(); + private static final int UNINITIALIZED_OFFSET = -1; private static class AOTMethodOffsets { @@ -304,10 +306,18 @@ boolean hasMark(Site call, MarkId id) { for (Mark m : compilationResult.getMarks()) { - // TODO: X64-specific code. - // Call instructions are aligned to 8 - // bytes - 1 on x86 to patch address atomically, - int adjOffset = (m.pcOffset & (-8)) + 7; + int adjOffset = m.pcOffset; + if (archStr.equals("aarch64")) { + // FIXME: This is very ugly. + // The mark is at the end of a group of three instructions: + // adrp; add; ldr + adjOffset += 12; + } else { + // TODO: X64-specific code. + // Call instructions are aligned to 8 + // bytes - 1 on x86 to patch address atomically, + adjOffset = (adjOffset & (-8)) + 7; + } // Mark points before aligning nops. if ((call.pcOffset == adjOffset) && MarkId.getEnum((int) m.id) == id) { return true;