< prev index next >
src/share/vm/code/relocInfo.cpp
Print this page
@@ -28,10 +28,11 @@
#include "code/nmethod.hpp"
#include "code/relocInfo.hpp"
#include "memory/resourceArea.hpp"
#include "runtime/stubCodeGenerator.hpp"
#include "utilities/copy.hpp"
+#include "oops/oop.inline.hpp"
PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
const RelocationHolder RelocationHolder::none; // its type is relocInfo::none
@@ -422,10 +423,34 @@
void Relocation::set_value(address x) {
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;
relocInfo ri = relocInfo(rtype, 0);
RelocIterator itr;
@@ -578,11 +603,12 @@
dest->set_locs_end((relocInfo*) p);
}
void static_stub_Relocation::unpack_data() {
address base = binding()->section_start(CodeBuffer::SECT_INSTS);
- _static_call = address_from_scaled_offset(unpack_1_int(), base);
+ jint offset = unpack_1_int();
+ _static_call = address_from_scaled_offset(offset, base);
}
void trampoline_stub_Relocation::pack_data_to(CodeSection* dest ) {
short* p = (short*) dest->locs_end();
CodeSection* insts = dest->outer()->insts();
@@ -792,11 +818,12 @@
// search for the static stub who points back to this static call
address static_call_addr = addr();
RelocIterator iter(code());
while (iter.next()) {
if (iter.type() == relocInfo::static_stub_type) {
- if (iter.static_stub_reloc()->static_call() == static_call_addr) {
+ static_stub_Relocation* stub_reloc = iter.static_stub_reloc();
+ if (stub_reloc->static_call() == static_call_addr) {
return iter.addr();
}
}
}
return NULL;
@@ -814,11 +841,12 @@
// search for the static stub who points back to this static call
address static_call_addr = addr();
RelocIterator iter(code());
while (iter.next()) {
if (iter.type() == relocInfo::static_stub_type) {
- if (iter.static_stub_reloc()->static_call() == static_call_addr) {
+ static_stub_Relocation* stub_reloc = iter.static_stub_reloc();
+ if (stub_reloc->static_call() == static_call_addr) {
return iter.addr();
}
}
}
return NULL;
< prev index next >