Mercurial > hg > graal-compiler
diff src/cpu/x86/vm/graalCodeInstaller_x86.hpp @ 10810:4e1db4c9d4c5
Support data patches for values larger than long.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Thu, 18 Jul 2013 15:37:02 +0200 |
parents | 6ff467cdb105 |
children | ce0b00597980 |
line wrap: on
line diff
--- a/src/cpu/x86/vm/graalCodeInstaller_x86.hpp Thu Jul 18 14:35:12 2013 +0200 +++ b/src/cpu/x86/vm/graalCodeInstaller_x86.hpp Thu Jul 18 15:37:02 2013 +0200 @@ -57,14 +57,20 @@ } 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); + address pc = _instructions->start() + pc_offset; - address pc = _instructions->start() + pc_offset; + oop constant = CompilationResult_DataPatch::constant(site); + char typeChar; + if (constant != NULL) { + oop kind = Constant::kind(constant); + typeChar = Kind::typeChar(kind); + } else { + assert(!inlined, "cannot inline raw constants"); + typeChar = '*'; + } switch (typeChar) { case 'z': @@ -76,7 +82,8 @@ break; case 'f': case 'j': - case 'd': { + case 'd': + case '*': { if (inlined) { address operand = Assembler::locate_operand(pc, Assembler::imm_operand); *((jlong*) operand) = Constant::primitive(constant); @@ -91,8 +98,16 @@ // 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); + if (constant != NULL) { + uint64_t value = Constant::primitive(constant); + _constants->emit_int64(value); + } else { + arrayOop rawConstant = arrayOop(CompilationResult_DataPatch::rawConstant(site)); + int8_t *ptr = (int8_t*) rawConstant->base(T_BYTE); + for (int i = rawConstant->length(); i > 0; i--, ptr++) { + _constants->emit_int8(*ptr); + } + } long disp = dest - next_instruction; assert(disp == (jint) disp, "disp doesn't fit in 32 bits");