< prev index next >

src/jdk.aot/share/classes/jdk.tools.jaotc/src/jdk/tools/jaotc/MetadataBuilder.java

Print this page

        

@@ -23,30 +23,31 @@
 
 
 
 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;
 import jdk.vm.ci.code.site.Mark;
 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;
 
     private final BinaryContainer binaryContainer;

@@ -79,10 +80,16 @@
      */
     private void createMethodMetadata(AOTCompiledClass compiledClass) {
         HotSpotGraalRuntimeProvider runtime = dataBuilder.getBackend().getRuntime();
         ByteContainer methodMetadataContainer = binaryContainer.getMethodMetadataContainer();
 
+        Method implicitExceptionsMethod = null;
+        try {
+            implicitExceptionsMethod = HotSpotMetaData.class.getDeclaredMethod("implicitExceptionTable");
+        } 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.
             final int startOffset = methodMetadataContainer.getByteStreamSize();
             assert startOffset % 8 == 0 : "Must be aligned on 8";

@@ -139,10 +146,15 @@
 
                 NativeOrderOutputStream.PatchableInt pcDescOffset = metadataStream.patchableInt();
                 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);
 
                 pcDescOffset.set(metadataStream.position());
                 metadataStream.put(pcDesc).align(8);

@@ -154,10 +166,16 @@
                 metadataStream.put(relocationInfo).align(8);
 
                 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);
 
                 totalSize.set(metadataStream.position());
< prev index next >