comparison 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
comparison
equal deleted inserted replaced
18176:c2270ad35f57 18177:89f97291c3a5
28 #include "code/nmethod.hpp" 28 #include "code/nmethod.hpp"
29 #include "code/relocInfo.hpp" 29 #include "code/relocInfo.hpp"
30 #include "memory/resourceArea.hpp" 30 #include "memory/resourceArea.hpp"
31 #include "runtime/stubCodeGenerator.hpp" 31 #include "runtime/stubCodeGenerator.hpp"
32 #include "utilities/copy.hpp" 32 #include "utilities/copy.hpp"
33 #include "oops/oop.inline.hpp"
33 34
34 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC 35 PRAGMA_FORMAT_MUTE_WARNINGS_FOR_GCC
35 36
36 const RelocationHolder RelocationHolder::none; // its type is relocInfo::none 37 const RelocationHolder RelocationHolder::none; // its type is relocInfo::none
37 38
422 423
423 void Relocation::set_value(address x) { 424 void Relocation::set_value(address x) {
424 ShouldNotReachHere(); 425 ShouldNotReachHere();
425 } 426 }
426 427
428 void Relocation::const_set_data_value(address x) {
429 #ifdef _LP64
430 if (format() == relocInfo::narrow_oop_in_const) {
431 *(narrowOop*)addr() = oopDesc::encode_heap_oop((oop) x);
432 } else {
433 #endif
434 *(address*)addr() = x;
435 #ifdef _LP64
436 }
437 #endif
438 }
439
440 void Relocation::const_verify_data_value(address x) {
441 #ifdef _LP64
442 if (format() == relocInfo::narrow_oop_in_const) {
443 assert(*(narrowOop*)addr() == oopDesc::encode_heap_oop((oop) x), "must agree");
444 } else {
445 #endif
446 assert(*(address*)addr() == x, "must agree");
447 #ifdef _LP64
448 }
449 #endif
450 }
451
427 452
428 RelocationHolder Relocation::spec_simple(relocInfo::relocType rtype) { 453 RelocationHolder Relocation::spec_simple(relocInfo::relocType rtype) {
429 if (rtype == relocInfo::none) return RelocationHolder::none; 454 if (rtype == relocInfo::none) return RelocationHolder::none;
430 relocInfo ri = relocInfo(rtype, 0); 455 relocInfo ri = relocInfo(rtype, 0);
431 RelocIterator itr; 456 RelocIterator itr;