comparison src/cpu/sparc/vm/graalCodeInstaller_sparc.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
38 fatal("unsupported type of instruction for call site"); 38 fatal("unsupported type of instruction for call site");
39 return 0; 39 return 0;
40 } 40 }
41 } 41 }
42 42
43 void CodeInstaller::pd_patch_OopData(int pc_offset, oop data) { 43 void CodeInstaller::pd_patch_OopConstant(int pc_offset, Handle& constant) {
44 address pc = _instructions->start() + pc_offset; 44 address pc = _instructions->start() + pc_offset;
45 Handle obj = OopData::object(data); 45 Handle obj = HotSpotObjectConstant::object(constant);
46 jobject value = JNIHandles::make_local(obj()); 46 jobject value = JNIHandles::make_local(obj());
47 if (OopData::compressed(data)) { 47 if (HotSpotObjectConstant::compressed(constant)) {
48 fatal("unimplemented: narrow oop relocation"); 48 fatal("unimplemented: narrow oop relocation");
49 } else { 49 } else {
50 NativeMovConstReg* move = nativeMovConstReg_at(pc); 50 NativeMovConstReg* move = nativeMovConstReg_at(pc);
51 move->set_data((intptr_t) value); 51 move->set_data((intptr_t) value);
52 52
56 _instructions->relocate(pc + NativeMovConstReg::sethi_offset, rspec); 56 _instructions->relocate(pc + NativeMovConstReg::sethi_offset, rspec);
57 _instructions->relocate(pc + NativeMovConstReg::add_offset, rspec); 57 _instructions->relocate(pc + NativeMovConstReg::add_offset, rspec);
58 } 58 }
59 } 59 }
60 60
61 void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, oop data) { 61 void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) {
62 address pc = _instructions->start() + pc_offset; 62 address pc = _instructions->start() + pc_offset;
63 address const_start = _constants->start(); 63 address const_start = _constants->start();
64 jint offset = DataSectionReference::offset(data); 64 address dest = _constants->start() + data_offset;
65 address dest = _constants->start() + offset;
66 65
67 _instructions->relocate(pc + NativeMovConstReg::sethi_offset, internal_word_Relocation::spec((address) dest)); 66 _instructions->relocate(pc + NativeMovConstReg::sethi_offset, internal_word_Relocation::spec((address) dest));
68 _instructions->relocate(pc + NativeMovConstReg::add_offset, internal_word_Relocation::spec((address) dest)); 67 _instructions->relocate(pc + NativeMovConstReg::add_offset, internal_word_Relocation::spec((address) dest));
69 TRACE_graal_3("relocating at %p with destination at %p (%d)", pc, dest, offset); 68 TRACE_graal_3("relocating at %p with destination at %p (%d)", pc, dest, data_offset);
70 } 69 }
71 70
72 void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) { 71 void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) {
73 fatal("CodeInstaller::pd_relocate_CodeBlob - sparc unimp"); 72 fatal("CodeInstaller::pd_relocate_CodeBlob - sparc unimp");
74 } 73 }