comparison src/cpu/sparc/vm/graalCodeInstaller_sparc.hpp @ 14561:e14198669e5c

Make data patch system use vm specific NarrowOop kind.
author Roland Schatz <roland.schatz@oracle.com>
date Mon, 17 Mar 2014 11:53:51 +0100
parents 4e679d50ba9a
children 6bab029d6e3a
comparison
equal deleted inserted replaced
14560:570910f5412b 14561:e14198669e5c
39 fatal("unsupported type of instruction for call site"); 39 fatal("unsupported type of instruction for call site");
40 return 0; 40 return 0;
41 } 41 }
42 } 42 }
43 43
44 inline void CodeInstaller::pd_site_DataPatch(int pc_offset, oop site) { 44 inline void CodeInstaller::pd_patch_OopData(int pc_offset, oop data) {
45 oop inlineData = CompilationResult_DataPatch::inlineData(site); 45 if (OopData::compressed(obj)) {
46 fatal("unimplemented: narrow oop relocation");
47 } else {
48 address pc = _instructions->start() + pc_offset;
49 Handle obj = OopData::object(data);
50 jobject value = JNIHandles::make_local(obj());
51
52 NativeMovConstReg* move = nativeMovConstReg_at(pc);
53 move->set_data((intptr_t) value);
54
55 // We need two relocations: one on the sethi and one on the add.
56 int oop_index = _oop_recorder->find_index(value);
57 RelocationHolder rspec = oop_Relocation::spec(oop_index);
58 _instructions->relocate(pc + NativeMovConstReg::sethi_offset, rspec);
59 _instructions->relocate(pc + NativeMovConstReg::add_offset, rspec);
60 }
61 }
62
63 inline void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, oop data) {
46 address pc = _instructions->start() + pc_offset; 64 address pc = _instructions->start() + pc_offset;
65 jint offset = DataSectionReference::offset(data);
47 66
48 if (inlineData != NULL) { 67 NativeMovRegMem* load = nativeMovRegMem_at(pc);
49 oop kind = Constant::kind(inlineData); 68 int disp = _constants_size + pc_offset - offset - BytesPerInstWord;
50 char typeChar = Kind::typeChar(kind); 69 load->set_offset(-disp);
51
52 switch (typeChar) {
53 case 'z':
54 case 'b':
55 case 's':
56 case 'c':
57 case 'i':
58 fatal("int-sized values not expected in DataPatch");
59 break;
60 case 'f':
61 case 'j':
62 case 'd': {
63 NativeMovConstReg* move = nativeMovConstReg_at(pc);
64 uint64_t value = Constant::primitive(inlineData);
65 move->set_data(value);
66 break;
67 }
68 case 'a': {
69 NativeMovConstReg* move = nativeMovConstReg_at(pc);
70 Handle obj = Constant::object(inlineData);
71 jobject value = JNIHandles::make_local(obj());
72 move->set_data((intptr_t) value);
73
74 // We need two relocations: one on the sethi and one on the add.
75 int oop_index = _oop_recorder->find_index(value);
76 RelocationHolder rspec = oop_Relocation::spec(oop_index);
77 _instructions->relocate(pc + NativeMovConstReg::sethi_offset, rspec);
78 _instructions->relocate(pc + NativeMovConstReg::add_offset, rspec);
79 break;
80 }
81 default:
82 fatal(err_msg("unexpected Kind (%d) in DataPatch", typeChar));
83 break;
84 }
85 } else {
86 oop dataRef = CompilationResult_DataPatch::externalData(site);
87 jint offset = HotSpotCompiledCode_HotSpotData::offset(dataRef);
88
89 NativeMovRegMem* load = nativeMovRegMem_at(pc);
90 int disp = _constants_size + pc_offset - offset - BytesPerInstWord;
91 load->set_offset(-disp);
92 }
93 } 70 }
94 71
95 inline void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) { 72 inline void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) {
96 fatal("CodeInstaller::pd_relocate_CodeBlob - sparc unimp"); 73 fatal("CodeInstaller::pd_relocate_CodeBlob - sparc unimp");
97 } 74 }