diff src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp @ 22690:3da4f19cf93b

Implement inline metaspace constant patching for SPARC (Compressed/Uncompressed)
author Stefan Anzinger <stefan.anzinger@oracle.com>
date Fri, 16 Oct 2015 14:06:20 +0200
parents ceca35d52380
children 37505a836aaf
line wrap: on
line diff
--- a/src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp	Fri Oct 16 13:44:47 2015 +0200
+++ b/src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp	Fri Oct 16 14:06:20 2015 +0200
@@ -66,7 +66,21 @@
 
 void CodeInstaller::pd_patch_MetaspaceConstant(int pc_offset, Handle& constant) {
   address pc = _instructions->start() + pc_offset;
-  fatal(err_msg("unexpected inline metaspace constant at %p (+%d)", pc, pc_offset));
+  if (HotSpotMetaspaceConstantImpl::compressed(constant)) {
+#ifdef _LP64
+    NativeMovConstReg32* move = nativeMovConstReg32_at(pc);
+    narrowKlass narrowOop = record_narrow_metadata_reference(constant);
+    move->set_data((intptr_t)narrowOop);
+    TRACE_jvmci_3("relocating (narrow metaspace constant) at %p/%p", pc, narrowOop);
+#else
+    fatal("compressed Klass* on 32bit");
+#endif
+  } else {
+    NativeMovConstReg* move = nativeMovConstReg_at(pc);
+    Metadata* reference = record_metadata_reference(constant);
+    move->set_data((intptr_t)reference);
+    TRACE_jvmci_3("relocating (metaspace constant) at %p/%p", pc, reference);
+  }
 }
 
 void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) {