diff src/share/vm/c1x/c1x_CodeInstaller.cpp @ 2494:e88293edf07c

Fixed an issue with alignment of double/long values in the code buffer. Can now run Scimark again. Results for Scimark on i5 (client/graal/server) are (625/634/1120). Bootstrap of C1X is at 3.7s.
author Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
date Fri, 22 Apr 2011 21:13:09 +0200
parents 0309d394eb5f
children c737ee310b39
line wrap: on
line diff
--- a/src/share/vm/c1x/c1x_CodeInstaller.cpp	Fri Apr 22 19:41:55 2011 +0200
+++ b/src/share/vm/c1x/c1x_CodeInstaller.cpp	Fri Apr 22 21:13:09 2011 +0200
@@ -593,7 +593,8 @@
 
   address instruction = _instructions->start() + pc_offset;
 
-  switch (CiKind::typeChar(kind)) {
+  char typeChar = CiKind::typeChar(kind);
+  switch (typeChar) {
     case 'z':
     case 'b':
     case 's':
@@ -608,16 +609,20 @@
       address operand = Assembler::locate_operand(instruction, Assembler::disp32_operand);
       address next_instruction = Assembler::locate_next_instruction(instruction);
       // we don't care if this is a long/double/etc., the primitive field contains the right bits
-      address dest = _constants->end();
+      int size = _constants->size();
+      if (typeChar == 'd' || typeChar == 'l') {
+        size = _constants->align_at_start(size);
+      }
+      address dest = _constants->start() + size;
+      _constants->set_end(dest + BytesPerLong);
       *(jlong*) dest = CiConstant::primitive(constant);
-      _constants->set_end(dest + BytesPerLong);
 
       long disp = dest - next_instruction;
       assert(disp == (jint) disp, "disp doesn't fit in 32 bits");
       *((jint*) operand) = (jint) disp;
 
       _instructions->relocate(instruction, section_word_Relocation::spec((address) dest, CodeBuffer::SECT_CONSTS), Assembler::disp32_operand);
-      TRACE_C1X_3("relocating (Float/Long/Double) at %016x/%016x", instruction, operand);
+      TRACE_C1X_3("relocating (%c) at %016x/%016x with destination at %016x (%d)", typeChar, instruction, operand, dest, size);
       break;
     }
     case 'a': {