comparison src/cpu/sparc/vm/relocInfo_sparc.cpp @ 2389:c10b82a05d58

Merge
author trims
date Fri, 25 Mar 2011 18:04:45 -0700
parents d673ef06fe96
children 1d1603768966
comparison
equal deleted inserted replaced
2374:661c46a8434c 2389:c10b82a05d58
28 #include "code/relocInfo.hpp" 28 #include "code/relocInfo.hpp"
29 #include "nativeInst_sparc.hpp" 29 #include "nativeInst_sparc.hpp"
30 #include "oops/oop.inline.hpp" 30 #include "oops/oop.inline.hpp"
31 #include "runtime/safepoint.hpp" 31 #include "runtime/safepoint.hpp"
32 32
33 void Relocation::pd_set_data_value(address x, intptr_t o) { 33 void Relocation::pd_set_data_value(address x, intptr_t o, bool verify_only) {
34 NativeInstruction* ip = nativeInstruction_at(addr()); 34 NativeInstruction* ip = nativeInstruction_at(addr());
35 jint inst = ip->long_at(0); 35 jint inst = ip->long_at(0);
36 assert(inst != NativeInstruction::illegal_instruction(), "no breakpoint"); 36 assert(inst != NativeInstruction::illegal_instruction(), "no breakpoint");
37 switch (Assembler::inv_op(inst)) { 37 switch (Assembler::inv_op(inst)) {
38 38
81 guarantee(Assembler::inv_immed(inst), "must have a simm13 field"); 81 guarantee(Assembler::inv_immed(inst), "must have a simm13 field");
82 int simm13 = Assembler::low10((intptr_t)x) + o; 82 int simm13 = Assembler::low10((intptr_t)x) + o;
83 guarantee(Assembler::is_simm13(simm13), "offset can't overflow simm13"); 83 guarantee(Assembler::is_simm13(simm13), "offset can't overflow simm13");
84 inst &= ~Assembler::simm( -1, 13); 84 inst &= ~Assembler::simm( -1, 13);
85 inst |= Assembler::simm(simm13, 13); 85 inst |= Assembler::simm(simm13, 13);
86 ip->set_long_at(0, inst); 86 if (verify_only) {
87 assert(ip->long_at(0) == inst, "instructions must match");
88 } else {
89 ip->set_long_at(0, inst);
90 }
87 } 91 }
88 break; 92 break;
89 93
90 case Assembler::branch_op: 94 case Assembler::branch_op:
91 { 95 {
95 if (format() != 0) { 99 if (format() != 0) {
96 assert(type() == relocInfo::oop_type, "only narrow oops case"); 100 assert(type() == relocInfo::oop_type, "only narrow oops case");
97 jint np = oopDesc::encode_heap_oop((oop)x); 101 jint np = oopDesc::encode_heap_oop((oop)x);
98 inst &= ~Assembler::hi22(-1); 102 inst &= ~Assembler::hi22(-1);
99 inst |= Assembler::hi22((intptr_t)np); 103 inst |= Assembler::hi22((intptr_t)np);
100 ip->set_long_at(0, inst); 104 if (verify_only) {
105 assert(ip->long_at(0) == inst, "instructions must match");
106 } else {
107 ip->set_long_at(0, inst);
108 }
101 inst2 = ip->long_at( NativeInstruction::nop_instruction_size ); 109 inst2 = ip->long_at( NativeInstruction::nop_instruction_size );
102 guarantee(Assembler::inv_op(inst2)==Assembler::arith_op, "arith op"); 110 guarantee(Assembler::inv_op(inst2)==Assembler::arith_op, "arith op");
103 ip->set_long_at(NativeInstruction::nop_instruction_size, ip->set_data32_simm13( inst2, (intptr_t)np)); 111 if (verify_only) {
112 assert(ip->long_at(NativeInstruction::nop_instruction_size) == NativeInstruction::set_data32_simm13( inst2, (intptr_t)np),
113 "instructions must match");
114 } else {
115 ip->set_long_at(NativeInstruction::nop_instruction_size, NativeInstruction::set_data32_simm13( inst2, (intptr_t)np));
116 }
104 break; 117 break;
105 } 118 }
106 ip->set_data64_sethi( ip->addr_at(0), (intptr_t)x ); 119 if (verify_only) {
120 ip->verify_data64_sethi( ip->addr_at(0), (intptr_t)x );
121 } else {
122 ip->set_data64_sethi( ip->addr_at(0), (intptr_t)x );
123 }
107 #else 124 #else
108 guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi"); 125 guarantee(Assembler::inv_op2(inst)==Assembler::sethi_op2, "must be sethi");
109 inst &= ~Assembler::hi22( -1); 126 inst &= ~Assembler::hi22( -1);
110 inst |= Assembler::hi22((intptr_t)x); 127 inst |= Assembler::hi22((intptr_t)x);
111 // (ignore offset; it doesn't play into the sethi) 128 // (ignore offset; it doesn't play into the sethi)
112 ip->set_long_at(0, inst); 129 if (verify_only) {
130 assert(ip->long_at(0) == inst, "instructions must match");
131 } else {
132 ip->set_long_at(0, inst);
133 }
113 #endif 134 #endif
114 } 135 }
115 break; 136 break;
116 137
117 default: 138 default: