diff src/share/vm/code/relocInfo.cpp @ 18177:89f97291c3a5

Hotspot: Support narrow oop relocations in constants section.
author Roland Schatz <roland.schatz@oracle.com>
date Mon, 27 Oct 2014 14:24:02 +0100
parents 52b4284cb496
children 7848fc12602b
line wrap: on
line diff
--- a/src/share/vm/code/relocInfo.cpp	Mon Oct 27 14:07:49 2014 +0100
+++ b/src/share/vm/code/relocInfo.cpp	Mon Oct 27 14:24:02 2014 +0100
@@ -30,6 +30,7 @@
 #include "memory/resourceArea.hpp"
 #include "runtime/stubCodeGenerator.hpp"
 #include "utilities/copy.hpp"
+#include "oops/oop.inline.hpp"
 
 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
 
@@ -424,6 +425,30 @@
   ShouldNotReachHere();
 }
 
+void Relocation::const_set_data_value(address x) {
+#ifdef _LP64
+  if (format() == relocInfo::narrow_oop_in_const) {
+    *(narrowOop*)addr() = oopDesc::encode_heap_oop((oop) x);
+  } else {
+#endif
+    *(address*)addr() = x;
+#ifdef _LP64
+  }
+#endif
+}
+
+void Relocation::const_verify_data_value(address x) {
+#ifdef _LP64
+  if (format() == relocInfo::narrow_oop_in_const) {
+    assert(*(narrowOop*)addr() == oopDesc::encode_heap_oop((oop) x), "must agree");
+  } else {
+#endif
+    assert(*(address*)addr() == x, "must agree");
+#ifdef _LP64
+  }
+#endif
+}
+
 
 RelocationHolder Relocation::spec_simple(relocInfo::relocType rtype) {
   if (rtype == relocInfo::none)  return RelocationHolder::none;