Mercurial > hg > graal-jvmci-8
diff src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp @ 22114:d9f3acb4a9a1
[SPARC] Implement constant loads from constant table with base register
author | Stefan Anzinger <stefan.anzinger@oracle.com> |
---|---|
date | Sat, 27 Jun 2015 18:02:44 +0200 |
parents | be896a1983c0 |
children | a0d0ecbceeb4 |
line wrap: on
line diff
--- a/src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp Sat Jun 27 17:59:37 2015 +0200 +++ b/src/cpu/sparc/vm/jvmciCodeInstaller_sparc.cpp Sat Jun 27 18:02:44 2015 +0200 @@ -66,12 +66,22 @@ void CodeInstaller::pd_patch_DataSectionReference(int pc_offset, int data_offset) { address pc = _instructions->start() + pc_offset; - address const_start = _constants->start(); - address dest = _constants->start() + data_offset; - - _instructions->relocate(pc + NativeMovConstReg::sethi_offset, internal_word_Relocation::spec((address) dest)); - _instructions->relocate(pc + NativeMovConstReg::add_offset, internal_word_Relocation::spec((address) dest)); - TRACE_jvmci_3("relocating at %p with destination at %p (%d)", pc, dest, data_offset); + NativeInstruction* inst = nativeInstruction_at(pc); + NativeInstruction* inst1 = nativeInstruction_at(pc + 4); + if(inst->is_sethi() && inst1->is_nop()) { + address const_start = _constants->start(); + address dest = _constants->start() + data_offset; + if(_constants_size > 0) { + _instructions->relocate(pc + NativeMovConstReg::sethi_offset, internal_word_Relocation::spec((address) dest)); + _instructions->relocate(pc + NativeMovConstReg::add_offset, internal_word_Relocation::spec((address) dest)); + } + TRACE_jvmci_3("relocating at %p (+%d) with destination at %d", pc, pc_offset, data_offset); + } else { + NativeMovRegMem* load = nativeMovRegMem_at(pc); + // The base pointer is set 4k off (see SPARCLoadConstantTableBaseOp) + load->set_offset(data_offset - (1<<12)); + TRACE_jvmci_3("relocating ld at %p (+%d) with destination at %d", pc, pc_offset, data_offset); + } } void CodeInstaller::pd_relocate_CodeBlob(CodeBlob* cb, NativeInstruction* inst) {