diff graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java @ 13588:8aee7169dbe4

Improve documentation of data section building code.
author Roland Schatz <roland.schatz@oracle.com>
date Fri, 10 Jan 2014 11:30:04 +0100
parents 4e679d50ba9a
children b1838411e896
line wrap: on
line diff
--- a/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java	Thu Jan 09 20:14:11 2014 -0800
+++ b/graal/com.oracle.graal.api.code/src/com/oracle/graal/api/code/CompilationResult.java	Fri Jan 10 11:30:04 2014 +0100
@@ -137,6 +137,9 @@
         }
     }
 
+    /**
+     * Represents some external data that is referenced by the code.
+     */
     public abstract static class Data {
 
         public final int size;
@@ -161,7 +164,12 @@
 
         @Override
         public void emit(ByteBuffer buffer) {
-            constant.putPrimitive(buffer);
+            if (constant.getKind().isPrimitive()) {
+                buffer.putLong(constant.getPrimitive());
+            } else {
+                // emit placeholder for oop value
+                buffer.putLong(0);
+            }
         }
 
         @Override
@@ -197,9 +205,9 @@
     }
 
     /**
-     * Represents a reference to data from the code. The associated data can be either a
-     * {@link Constant} or a raw byte array. The raw byte array is patched as is, no endian swapping
-     * is done on it.
+     * Represents a code site that references some data. The associated data can be either a
+     * reference to an external {@link Data} item in the data section, or it may be an inlined
+     * {@link Constant} that needs to be patched.
      */
     public static final class DataPatch extends Site {