Mercurial > hg > graal-jvmci-8
diff src/cpu/sparc/vm/graalCodeInstaller_sparc.hpp @ 13576:4e679d50ba9a
Move data section building code to Java.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Thu, 09 Jan 2014 13:09:44 +0100 |
parents | d49f00604347 |
children | e14198669e5c |
line wrap: on
line diff
--- a/src/cpu/sparc/vm/graalCodeInstaller_sparc.hpp Thu Jan 09 11:46:07 2014 +0100 +++ b/src/cpu/sparc/vm/graalCodeInstaller_sparc.hpp Thu Jan 09 13:09:44 2014 +0100 @@ -42,52 +42,32 @@ } inline void CodeInstaller::pd_site_DataPatch(int pc_offset, oop site) { - oop constant = CompilationResult_DataPatch::constant(site); - int alignment = CompilationResult_DataPatch::alignment(site); - bool inlined = CompilationResult_DataPatch::inlined(site) == JNI_TRUE; - - oop kind = Constant::kind(constant); - char typeChar = Kind::typeChar(kind); - + oop inlineData = CompilationResult_DataPatch::inlineData(site); address pc = _instructions->start() + pc_offset; - switch (typeChar) { - case 'z': - case 'b': - case 's': - case 'c': - case 'i': - fatal("int-sized values not expected in DataPatch"); - break; - case 'f': - case 'j': - case 'd': { - if (inlined) { + if (inlineData != NULL) { + oop kind = Constant::kind(inlineData); + char typeChar = Kind::typeChar(kind); + + switch (typeChar) { + case 'z': + case 'b': + case 's': + case 'c': + case 'i': + fatal("int-sized values not expected in DataPatch"); + break; + case 'f': + case 'j': + case 'd': { NativeMovConstReg* move = nativeMovConstReg_at(pc); - uint64_t value = Constant::primitive(constant); + uint64_t value = Constant::primitive(inlineData); move->set_data(value); - } else { - int size = _constants->size(); - if (alignment > 0) { - guarantee(alignment <= _constants->alignment(), "Alignment inside constants section is restricted by alignment of section begin"); - size = align_size_up(size, alignment); - } - // we don't care if this is a long/double/etc., the primitive field contains the right bits - address dest = _constants->start() + size; - _constants->set_end(dest); - uint64_t value = Constant::primitive(constant); - _constants->emit_int64(value); - - NativeMovRegMem* load = nativeMovRegMem_at(pc); - int disp = _constants_size + pc_offset - size - BytesPerInstWord; - load->set_offset(-disp); + break; } - break; - } - case 'a': { - if (inlined) { + case 'a': { NativeMovConstReg* move = nativeMovConstReg_at(pc); - Handle obj = Constant::object(constant); + Handle obj = Constant::object(inlineData); jobject value = JNIHandles::make_local(obj()); move->set_data((intptr_t) value); @@ -96,30 +76,19 @@ RelocationHolder rspec = oop_Relocation::spec(oop_index); _instructions->relocate(pc + NativeMovConstReg::sethi_offset, rspec); _instructions->relocate(pc + NativeMovConstReg::add_offset, rspec); - } else { - int size = _constants->size(); - if (alignment > 0) { - guarantee(alignment <= _constants->alignment(), "Alignment inside constants section is restricted by alignment of section begin"); - size = align_size_up(size, alignment); - } - address dest = _constants->start() + size; - _constants->set_end(dest); - Handle obj = Constant::object(constant); - jobject value = JNIHandles::make_local(obj()); - _constants->emit_address((address) value); + break; + } + default: + fatal(err_msg("unexpected Kind (%d) in DataPatch", typeChar)); + break; + } + } else { + oop dataRef = CompilationResult_DataPatch::externalData(site); + jint offset = HotSpotCompiledCode_HotSpotData::offset(dataRef); - NativeMovRegMem* load = nativeMovRegMem_at(pc); - int disp = _constants_size + pc_offset - size - BytesPerInstWord; - load->set_offset(-disp); - - int oop_index = _oop_recorder->find_index(value); - _constants->relocate(dest, oop_Relocation::spec(oop_index)); - } - break; - } - default: - fatal(err_msg("unexpected Kind (%d) in DataPatch", typeChar)); - break; + NativeMovRegMem* load = nativeMovRegMem_at(pc); + int disp = _constants_size + pc_offset - offset - BytesPerInstWord; + load->set_offset(-disp); } }