< prev index next >

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

Print this page

        

@@ -1,7 +1,7 @@
 /*
- * Copyright (c) 2016, 2018, Oracle and/or its affiliates. All rights reserved.
+ * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved.
  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
  *
  * This code is free software; you can redistribute it and/or modify it
  * under the terms of the GNU General Public License version 2 only, as
  * published by the Free Software Foundation.

@@ -45,10 +45,11 @@
 import jdk.vm.ci.hotspot.HotSpotConstantPoolObject;
 import jdk.vm.ci.hotspot.HotSpotMetaspaceConstant;
 import jdk.vm.ci.hotspot.HotSpotObjectConstant;
 import jdk.vm.ci.hotspot.HotSpotResolvedObjectType;
 import jdk.vm.ci.hotspot.HotSpotSentinelConstant;
+import jdk.vm.ci.meta.JavaConstant;
 import jdk.vm.ci.meta.VMConstant;
 
 final class DataPatchProcessor {
 
     private final TargetDescription target;

@@ -93,25 +94,28 @@
             } else if (metaspaceConstant.asResolvedJavaMethod() != null && action == HotSpotConstantLoadAction.LOAD_COUNTERS) {
                 targetSymbol = "counters." + JavaMethodInfo.uniqueMethodName(metaspaceConstant.asResolvedJavaMethod());
                 gotName = "got." + targetSymbol;
                 binaryContainer.addCountersSymbol(targetSymbol);
             }
-        } else if (constant instanceof HotSpotObjectConstant) {
-            HotSpotObjectConstant oopConstant = (HotSpotObjectConstant) constant;
-            if (oopConstant instanceof HotSpotConstantPoolObject) {
-                HotSpotConstantPoolObject cpo = (HotSpotConstantPoolObject) oopConstant;
+        } else if (constant instanceof JavaConstant) {
+            JavaConstant jConstant = (JavaConstant) constant;
+            if (jConstant instanceof HotSpotConstantPoolObject) {
+                HotSpotConstantPoolObject cpo = (HotSpotConstantPoolObject) jConstant;
                 // Even if two locations use the same object, resolve separately
-                targetSymbol = "ldc." + cpo.getCpType().getName() + cpo.getCpi();
-            } else {
+                targetSymbol = "ldc." + cpo.toValueString();
+                Integer offset = binaryContainer.addOopSymbol(targetSymbol);
+                gotName = "got.ldc." + offset;
+            } else if (jConstant instanceof HotSpotObjectConstant) {
+                HotSpotObjectConstant oopConstant = (HotSpotObjectConstant) jConstant;
                 // String constant.
                 targetSymbol = "ldc." + oopConstant.toValueString();
+                Integer offset = binaryContainer.addOopSymbol(targetSymbol);
+                gotName = "got.ldc." + offset;
+            } else if (jConstant instanceof HotSpotSentinelConstant) {
+                targetSymbol = "state.M" + methodInfo.getCodeId();
+                gotName = "got." + targetSymbol;
             }
-            Integer offset = binaryContainer.addOopSymbol(targetSymbol);
-            gotName = "got.ldc." + offset;
-        } else if (constant instanceof HotSpotSentinelConstant) {
-            targetSymbol = "state.M" + methodInfo.getCodeId();
-            gotName = "got." + targetSymbol;
         }
 
         assert gotName != null : "Unknown constant type: " + constant;
 
         InstructionDecoder decoder = InstructionDecoder.getInstructionDecoder(target);
< prev index next >