Mercurial > hg > truffle
comparison src/cpu/x86/vm/graalCodeInstaller_x86.cpp @ 18176:c2270ad35f57
Better construction of data section and data patches.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Mon, 27 Oct 2014 14:07:49 +0100 |
parents | 4e2d34d7715b |
children | a8cff27ca2e1 |
comparison
equal
deleted
inserted
replaced
18175:cf09e921458f | 18176:c2270ad35f57 |
---|---|
56 fatal("unsupported type of instruction for call site"); | 56 fatal("unsupported type of instruction for call site"); |
57 return 0; | 57 return 0; |
58 } | 58 } |
59 } | 59 } |
60 | 60 |
61 void CodeInstaller::pd_patch_OopData(int pc_offset, oop data) { | 61 void CodeInstaller::pd_patch_OopConstant(int pc_offset, Handle& constant) { |
62 address pc = _instructions->start() + pc_offset; | 62 address pc = _instructions->start() + pc_offset; |
63 Handle obj = OopData::object(data); | 63 Handle obj = HotSpotObjectConstant::object(constant); |
64 jobject value = JNIHandles::make_local(obj()); | 64 jobject value = JNIHandles::make_local(obj()); |
65 if (OopData::compressed(data)) { | 65 if (HotSpotObjectConstant::compressed(constant)) { |
66 address operand = Assembler::locate_operand(pc, Assembler::narrow_oop_operand); | 66 address operand = Assembler::locate_operand(pc, Assembler::narrow_oop_operand); |
67 int oop_index = _oop_recorder->find_index(value); | 67 int oop_index = _oop_recorder->find_index(value); |
68 _instructions->relocate(pc, oop_Relocation::spec(oop_index), Assembler::narrow_oop_operand); | 68 _instructions->relocate(pc, oop_Relocation::spec(oop_index), Assembler::narrow_oop_operand); |
69 TRACE_graal_3("relocating (narrow oop constant) at %p/%p", pc, operand); | 69 TRACE_graal_3("relocating (narrow oop constant) at %p/%p", pc, operand); |
70 } else { | 70 } else { |
73 _instructions->relocate(pc, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); | 73 _instructions->relocate(pc, oop_Relocation::spec_for_immediate(), Assembler::imm_operand); |
74 TRACE_graal_3("relocating (oop constant) at %p/%p", pc, operand); | 74 TRACE_graal_3("relocating (oop constant) at %p/%p", pc, operand); |
75 } | 75 } |
76 } | 76 } |
77 | 77 |
78 void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, oop data) { | 78 void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) { |
79 address pc = _instructions->start() + pc_offset; | 79 address pc = _instructions->start() + pc_offset; |
80 jint offset = DataSectionReference::offset(data); | |
81 | 80 |
82 address operand = Assembler::locate_operand(pc, Assembler::disp32_operand); | 81 address operand = Assembler::locate_operand(pc, Assembler::disp32_operand); |
83 address next_instruction = Assembler::locate_next_instruction(pc); | 82 address next_instruction = Assembler::locate_next_instruction(pc); |
84 address dest = _constants->start() + offset; | 83 address dest = _constants->start() + data_offset; |
85 | 84 |
86 long disp = dest - next_instruction; | 85 long disp = dest - next_instruction; |
87 assert(disp == (jint) disp, "disp doesn't fit in 32 bits"); | 86 assert(disp == (jint) disp, "disp doesn't fit in 32 bits"); |
88 *((jint*) operand) = (jint) disp; | 87 *((jint*) operand) = (jint) disp; |
89 | 88 |
90 _instructions->relocate(pc, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS), Assembler::disp32_operand); | 89 _instructions->relocate(pc, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS), Assembler::disp32_operand); |
91 TRACE_graal_3("relocating at %p/%p with destination at %p (%d)", pc, operand, dest, offset); | 90 TRACE_graal_3("relocating at %p/%p with destination at %p (%d)", pc, operand, dest, data_offset); |
92 } | 91 } |
93 | 92 |
94 void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) { | 93 void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) { |
95 if (cb->is_nmethod()) { | 94 if (cb->is_nmethod()) { |
96 nmethod* nm = (nmethod*) cb; | 95 nmethod* nm = (nmethod*) cb; |