Mercurial > hg > truffle
comparison src/cpu/sparc/vm/graalCodeInstaller_sparc.hpp @ 10792:7a8d6ba83a04
SPARC: fixes and more stuff works
author | twisti |
---|---|
date | Tue, 16 Jul 2013 17:41:21 -0700 |
parents | 6ff467cdb105 |
children | e1fcdda22831 |
comparison
equal
deleted
inserted
replaced
10791:e2786e2c491a | 10792:7a8d6ba83a04 |
---|---|
41 oop kind = Constant::kind(constant); | 41 oop kind = Constant::kind(constant); |
42 char typeChar = Kind::typeChar(kind); | 42 char typeChar = Kind::typeChar(kind); |
43 | 43 |
44 address pc = _instructions->start() + pc_offset; | 44 address pc = _instructions->start() + pc_offset; |
45 | 45 |
46 tty->print_cr("CodeInstaller::pd_site_DataPatch: typeChar=%c, inlined=%d", typeChar, inlined); | |
47 | |
48 switch (typeChar) { | 46 switch (typeChar) { |
49 case 'z': | 47 case 'z': |
50 case 'b': | 48 case 'b': |
51 case 's': | 49 case 's': |
52 case 'c': | 50 case 'c': |
55 break; | 53 break; |
56 case 'f': | 54 case 'f': |
57 case 'j': | 55 case 'j': |
58 case 'd': { | 56 case 'd': { |
59 if (inlined) { | 57 if (inlined) { |
60 fatal(err_msg("inlined: type=%c, constant=%lx", inlined, Constant::primitive(constant))); | 58 NativeMovConstReg* move = nativeMovConstReg_at(pc); |
59 uint64_t value = Constant::primitive(constant); | |
60 move->set_data(value); | |
61 } else { | 61 } else { |
62 int size = _constants->size(); | 62 int size = _constants->size(); |
63 if (alignment > 0) { | 63 if (alignment > 0) { |
64 guarantee(alignment <= _constants->alignment(), "Alignment inside constants section is restricted by alignment of section begin"); | 64 guarantee(alignment <= _constants->alignment(), "Alignment inside constants section is restricted by alignment of section begin"); |
65 size = align_size_up(size, alignment); | 65 size = align_size_up(size, alignment); |
71 _constants->emit_int64(value); | 71 _constants->emit_int64(value); |
72 | 72 |
73 NativeMovRegMem* load = nativeMovRegMem_at(pc); | 73 NativeMovRegMem* load = nativeMovRegMem_at(pc); |
74 int disp = _constants_size + pc_offset - size - BytesPerInstWord; | 74 int disp = _constants_size + pc_offset - size - BytesPerInstWord; |
75 load->set_offset(-disp); | 75 load->set_offset(-disp); |
76 | |
77 // assert(disp == (jint) disp, "disp doesn't fit in 32 bits"); | |
78 // *((jint*) operand) = (jint) disp; | |
79 | |
80 // _instructions->relocate(instruction, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS) /*, Assembler::disp32_operand*/); | |
81 // TRACE_graal_3("relocating (%c) at %p/%p with destination at %p (%d)", typeChar, instruction, operand, dest, size); | |
82 } | 76 } |
83 break; | 77 break; |
84 } | 78 } |
85 case 'a': { | 79 case 'a': { |
86 // address operand = Assembler::locate_operand(instruction, Assembler::imm_operand); | 80 int size = _constants->size(); |
87 // Handle obj = Constant::object(constant); | 81 if (alignment > 0) { |
88 // | 82 guarantee(alignment <= _constants->alignment(), "Alignment inside constants section is restricted by alignment of section begin"); |
89 // jobject value = JNIHandles::make_local(obj()); | 83 size = align_size_up(size, alignment); |
90 // *((jobject*) operand) = value; | 84 } |
91 // _instructions->relocate(instruction, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); | 85 address dest = _constants->start() + size; |
92 // TRACE_graal_3("relocating (oop constant) at %p/%p", instruction, operand); | 86 _constants->set_end(dest); |
87 Handle obj = Constant::object(constant); | |
88 jobject value = JNIHandles::make_local(obj()); | |
89 _constants->emit_address((address) value); | |
90 | |
91 NativeMovRegMem* load = nativeMovRegMem_at(pc); | |
92 int disp = _constants_size + pc_offset - size - BytesPerInstWord; | |
93 load->set_offset(-disp); | |
94 | |
95 int oop_index = _oop_recorder->find_index(value); | |
96 _constants->relocate(dest, oop_Relocation::spec(oop_index)); | |
93 break; | 97 break; |
94 } | 98 } |
95 default: | 99 default: |
96 fatal(err_msg("unexpected Kind (%d) in DataPatch", typeChar)); | 100 fatal(err_msg("unexpected Kind (%d) in DataPatch", typeChar)); |
97 break; | 101 break; |
120 case MARK_INVOKEVIRTUAL: | 124 case MARK_INVOKEVIRTUAL: |
121 case MARK_INVOKEINTERFACE: { | 125 case MARK_INVOKEINTERFACE: { |
122 assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface"); | 126 assert(method == NULL || !method->is_static(), "cannot call static method with invokeinterface"); |
123 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); | 127 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); |
124 call->set_destination(SharedRuntime::get_resolve_virtual_call_stub()); | 128 call->set_destination(SharedRuntime::get_resolve_virtual_call_stub()); |
125 // _instructions->relocate(call->instruction_address(), | 129 _instructions->relocate(call->instruction_address(), virtual_call_Relocation::spec(_invoke_mark_pc)); |
126 // virtual_call_Relocation::spec(_invoke_mark_pc), | 130 /*, Assembler::call32_operand); */ |
127 // Assembler::call32_operand); | |
128 fatal("NYI"); | |
129 break; | 131 break; |
130 } | 132 } |
131 case MARK_INVOKESTATIC: { | 133 case MARK_INVOKESTATIC: { |
132 assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic"); | 134 assert(method == NULL || method->is_static(), "cannot call non-static method with invokestatic"); |
133 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); | 135 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); |
134 call->set_destination(SharedRuntime::get_resolve_static_call_stub()); | 136 call->set_destination(SharedRuntime::get_resolve_static_call_stub()); |
135 _instructions->relocate(call->instruction_address(), | 137 _instructions->relocate(call->instruction_address(), relocInfo::static_call_type); |
136 relocInfo::static_call_type /*, Assembler::call32_operand*/); | 138 /*, Assembler::call32_operand); */ |
137 break; | 139 break; |
138 } | 140 } |
139 case MARK_INVOKESPECIAL: { | 141 case MARK_INVOKESPECIAL: { |
140 assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial"); | 142 assert(method == NULL || !method->is_static(), "cannot call static method with invokespecial"); |
141 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); | 143 NativeCall* call = nativeCall_at(_instructions->start() + pc_offset); |