diff -r f4b2d5b83ebf -r d19dc5b10fbb src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/MetadataBuilder.java --- a/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/MetadataBuilder.java Fri Jun 07 09:16:11 2019 -0700 +++ b/src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/MetadataBuilder.java Fri Jun 07 10:26:21 2019 -0700 @@ -25,16 +25,20 @@ package jdk.tools.jaotc; +import static jdk.tools.jaotc.AOTCompiledClass.getType; +import static jdk.tools.jaotc.AOTCompiledClass.metadataName; + +import java.lang.reflect.Method; import java.util.ArrayList; import java.util.List; +import org.graalvm.compiler.code.CompilationResult; +import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider; + import jdk.tools.jaotc.binformat.BinaryContainer; import jdk.tools.jaotc.binformat.ByteContainer; import jdk.tools.jaotc.binformat.GotSymbol; import jdk.tools.jaotc.utils.NativeOrderOutputStream; -import org.graalvm.compiler.code.CompilationResult; -import org.graalvm.compiler.hotspot.HotSpotGraalRuntimeProvider; - import jdk.vm.ci.code.StackSlot; import jdk.vm.ci.code.site.DataPatch; import jdk.vm.ci.code.site.Infopoint; @@ -42,9 +46,6 @@ import jdk.vm.ci.hotspot.HotSpotCompiledCode; import jdk.vm.ci.hotspot.HotSpotMetaData; -import static jdk.tools.jaotc.AOTCompiledClass.getType; -import static jdk.tools.jaotc.AOTCompiledClass.metadataName; - final class MetadataBuilder { private final DataBuilder dataBuilder; @@ -81,6 +82,12 @@ HotSpotGraalRuntimeProvider runtime = dataBuilder.getBackend().getRuntime(); ByteContainer methodMetadataContainer = binaryContainer.getMethodMetadataContainer(); + Method implicitExceptionsMethod = null; + try { + implicitExceptionsMethod = HotSpotMetaData.class.getDeclaredMethod("implicitExceptionBytes"); + } catch (NoSuchMethodException e) { + } + // For each of the compiled java methods, create records holding information about them. for (CompiledMethodInfo methodInfo : compiledClass.getCompiledMethods()) { // Get the current offset in the methodmetadata container. @@ -141,6 +148,11 @@ NativeOrderOutputStream.PatchableInt scopeOffset = metadataStream.patchableInt(); NativeOrderOutputStream.PatchableInt relocationOffset = metadataStream.patchableInt(); NativeOrderOutputStream.PatchableInt exceptionOffset = metadataStream.patchableInt(); + NativeOrderOutputStream.PatchableInt implictTableOFfset = null; + + if (implicitExceptionsMethod != null) { + implictTableOFfset = metadataStream.patchableInt(); + } NativeOrderOutputStream.PatchableInt oopMapOffset = metadataStream.patchableInt(); metadataStream.align(8); @@ -156,6 +168,12 @@ exceptionOffset.set(metadataStream.position()); metadataStream.put(metaData.exceptionBytes()).align(8); + if (implicitExceptionsMethod != null) { + implictTableOFfset.set(metadataStream.position()); + byte[] data = (byte[]) implicitExceptionsMethod.invoke(metaData); + metadataStream.put(data).align(8); + } + // oopmaps should be last oopMapOffset.set(metadataStream.position()); metadataStream.put(oopMapInfo).align(8);