comparison src/share/vm/graal/graalCodeInstaller.cpp @ 3710:4e037604f6ee

use alignment for constants specified in DataPatch.alignment
author Christian Wimmer <christian.wimmer@oracle.com>
date Mon, 05 Dec 2011 18:15:25 -0800
parents 0ac36a6d5ab0
children b648304ba4ff
comparison
equal deleted inserted replaced
3709:54915831e565 3710:4e037604f6ee
733 } 733 }
734 } 734 }
735 735
736 void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site) { 736 void CodeInstaller::site_DataPatch(CodeBuffer& buffer, jint pc_offset, oop site) {
737 oop constant = CiTargetMethod_DataPatch::constant(site); 737 oop constant = CiTargetMethod_DataPatch::constant(site);
738 int alignment = CiTargetMethod_DataPatch::alignment(site);
738 oop kind = CiConstant::kind(constant); 739 oop kind = CiConstant::kind(constant);
739 740
740 address instruction = _instructions->start() + pc_offset; 741 address instruction = _instructions->start() + pc_offset;
741 742
742 char typeChar = CiKind::typeChar(kind); 743 char typeChar = CiKind::typeChar(kind);
752 case 'f': 753 case 'f':
753 case 'j': 754 case 'j':
754 case 'd': { 755 case 'd': {
755 address operand = Assembler::locate_operand(instruction, Assembler::disp32_operand); 756 address operand = Assembler::locate_operand(instruction, Assembler::disp32_operand);
756 address next_instruction = Assembler::locate_next_instruction(instruction); 757 address next_instruction = Assembler::locate_next_instruction(instruction);
758 int size = _constants->size();
759 if (alignment > 0) {
760 guarantee(alignment <= _constants->alignment(), "Alignment inside constants section is restricted by alignment of section begin");
761 size = align_size_up(size, alignment);
762 }
757 // we don't care if this is a long/double/etc., the primitive field contains the right bits 763 // we don't care if this is a long/double/etc., the primitive field contains the right bits
758 int size = _constants->size();
759 if (typeChar == 'd' || typeChar == 'j') {
760 size = _constants->align_at_start(size);
761 }
762 address dest = _constants->start() + size; 764 address dest = _constants->start() + size;
763 _constants->set_end(dest + BytesPerLong); 765 _constants->set_end(dest + BytesPerLong);
764 *(jlong*) dest = CiConstant::primitive(constant); 766 *(jlong*) dest = CiConstant::primitive(constant);
765 767
766 long disp = dest - next_instruction; 768 long disp = dest - next_instruction;