comparison src/cpu/sparc/vm/graalCodeInstaller_sparc.hpp @ 11233:5a9d68c3a7d7

SPARC: a lot of fixes and more
author twisti
date Mon, 05 Aug 2013 22:23:00 -0700
parents c3b09d69dfde
children ce0b00597980
comparison
equal deleted inserted replaced
11232:22d3ee2fcb97 11233:5a9d68c3a7d7
29 #include "graal/graalJavaAccess.hpp" 29 #include "graal/graalJavaAccess.hpp"
30 30
31 inline jint CodeInstaller::pd_next_offset(NativeInstruction* inst, jint pc_offset, oop method) { 31 inline jint CodeInstaller::pd_next_offset(NativeInstruction* inst, jint pc_offset, oop method) {
32 if (inst->is_call() || inst->is_jump()) { 32 if (inst->is_call() || inst->is_jump()) {
33 return pc_offset + NativeCall::instruction_size; 33 return pc_offset + NativeCall::instruction_size;
34 } else if (inst->is_call_reg()) {
35 return pc_offset + NativeCallReg::instruction_size;
34 } else if (inst->is_sethi()) { 36 } else if (inst->is_sethi()) {
35 return pc_offset + NativeFarCall::instruction_size; 37 return pc_offset + NativeFarCall::instruction_size;
36 } else { 38 } else {
37 fatal("unsupported type of instruction for call site"); 39 fatal("unsupported type of instruction for call site");
38 return 0; 40 return 0;
81 load->set_offset(-disp); 83 load->set_offset(-disp);
82 } 84 }
83 break; 85 break;
84 } 86 }
85 case 'a': { 87 case 'a': {
86 int size = _constants->size(); 88 if (inlined) {
87 if (alignment > 0) { 89 NativeMovConstReg* move = nativeMovConstReg_at(pc);
88 guarantee(alignment <= _constants->alignment(), "Alignment inside constants section is restricted by alignment of section begin"); 90 Handle obj = Constant::object(constant);
89 size = align_size_up(size, alignment); 91 jobject value = JNIHandles::make_local(obj());
92 move->set_data((intptr_t) value);
93
94 // We need two relocations: one on the sethi and one on the add.
95 int oop_index = _oop_recorder->find_index(value);
96 RelocationHolder rspec = oop_Relocation::spec(oop_index);
97 _instructions->relocate(pc + NativeMovConstReg::sethi_offset, rspec);
98 _instructions->relocate(pc + NativeMovConstReg::add_offset, rspec);
99 } else {
100 int size = _constants->size();
101 if (alignment > 0) {
102 guarantee(alignment <= _constants->alignment(), "Alignment inside constants section is restricted by alignment of section begin");
103 size = align_size_up(size, alignment);
104 }
105 address dest = _constants->start() + size;
106 _constants->set_end(dest);
107 Handle obj = Constant::object(constant);
108 jobject value = JNIHandles::make_local(obj());
109 _constants->emit_address((address) value);
110
111 NativeMovRegMem* load = nativeMovRegMem_at(pc);
112 int disp = _constants_size + pc_offset - size - BytesPerInstWord;
113 load->set_offset(-disp);
114
115 int oop_index = _oop_recorder->find_index(value);
116 _constants->relocate(dest, oop_Relocation::spec(oop_index));
90 } 117 }
91 address dest = _constants->start() + size;
92 _constants->set_end(dest);
93 Handle obj = Constant::object(constant);
94 jobject value = JNIHandles::make_local(obj());
95 _constants->emit_address((address) value);
96
97 NativeMovRegMem* load = nativeMovRegMem_at(pc);
98 int disp = _constants_size + pc_offset - size - BytesPerInstWord;
99 load->set_offset(-disp);
100
101 int oop_index = _oop_recorder->find_index(value);
102 _constants->relocate(dest, oop_Relocation::spec(oop_index));
103 break; 118 break;
104 } 119 }
105 default: 120 default:
106 fatal(err_msg("unexpected Kind (%d) in DataPatch", typeChar)); 121 fatal(err_msg("unexpected Kind (%d) in DataPatch", typeChar));
107 break; 122 break;