< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.lir/src/org/graalvm/compiler/lir/asm/CompilationResultBuilder.java

Print this page

        

@@ -78,14 +78,14 @@
  *
  * @see CompilationResultBuilderFactory
  */
 public class CompilationResultBuilder {
 
-    // @formatter:off
-    @Option(help = "Include the LIR as comments with the final assembly.", type = OptionType.Debug)
+    public static class Options {
+        @Option(help = "Include the LIR as comments with the final assembly.", type = OptionType.Debug) //
     public static final OptionKey<Boolean> PrintLIRWithAssembly = new OptionKey<>(false);
-    // @formatter:on
+    }
 
     private static class ExceptionInfo {
 
         public final int codeOffset;
         public final LabelRef exceptionEdge;

@@ -293,17 +293,28 @@
     }
 
     public AbstractAddress recordDataReferenceInCode(Constant constant, int alignment) {
         assert constant != null;
         debug.log("Constant reference in code: pos = %d, data = %s", asm.position(), constant);
+        Data data = createDataItem(constant);
+        data.updateAlignment(alignment);
+        return recordDataSectionReference(data);
+    }
+
+    public AbstractAddress recordDataReferenceInCode(Data data, int alignment) {
+        assert data != null;
+        data.updateAlignment(alignment);
+        return recordDataSectionReference(data);
+    }
+
+    public Data createDataItem(Constant constant) {
         Data data = dataCache.get(constant);
         if (data == null) {
             data = dataBuilder.createDataItem(constant);
             dataCache.put(constant, data);
         }
-        data.updateAlignment(alignment);
-        return recordDataSectionReference(data);
+        return data;
     }
 
     public AbstractAddress recordDataReferenceInCode(byte[] data, int alignment) {
         assert data != null;
         if (debug.isLogEnabled()) {

@@ -470,11 +481,11 @@
 
     private void emitBlock(AbstractBlockBase<?> block) {
         if (block == null) {
             return;
         }
-        boolean emitComment = debug.isDumpEnabled(DebugContext.BASIC_LEVEL) || PrintLIRWithAssembly.getValue(getOptions());
+        boolean emitComment = debug.isDumpEnabled(DebugContext.BASIC_LEVEL) || Options.PrintLIRWithAssembly.getValue(getOptions());
         if (emitComment) {
             blockComment(String.format("block B%d %s", block.getId(), block.getLoop()));
         }
 
         for (LIRInstruction op : lir.getLIRforBlock(block)) {
< prev index next >