changeset 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 d8891d81dc8e
children c737ee310b39
files src/share/vm/asm/codeBuffer.cpp src/share/vm/c1x/c1x_CodeInstaller.cpp src/share/vm/compiler/compileBroker.cpp src/share/vm/runtime/sharedRuntime.cpp
diffstat 4 files changed, 19 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/src/share/vm/asm/codeBuffer.cpp	Fri Apr 22 19:41:55 2011 +0200
+++ b/src/share/vm/asm/codeBuffer.cpp	Fri Apr 22 21:13:09 2011 +0200
@@ -435,9 +435,8 @@
 
   {
     // not sure why this is here, but why not...
-    // (tw) disabled assert
-    // int alignSize = MAX2((intx) sizeof(jdouble), CodeEntryAlignment);
-    // assert( (dest->_total_start - _insts.start()) % alignSize == 0, "copy must preserve alignment");
+    int alignSize = MAX2((intx) sizeof(jdouble), CodeEntryAlignment);
+    assert( (dest->_total_start - _insts.start()) % alignSize == 0, "copy must preserve alignment");
   }
 
   const CodeSection* prev_cs      = NULL;
--- 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': {
--- a/src/share/vm/compiler/compileBroker.cpp	Fri Apr 22 19:41:55 2011 +0200
+++ b/src/share/vm/compiler/compileBroker.cpp	Fri Apr 22 21:13:09 2011 +0200
@@ -631,7 +631,7 @@
 void CompileBroker::bootstrap_c1x() {
   HandleMark hm;
   Thread* THREAD = Thread::current();
-  tty->print_cr("Bootstrapping C1X...");
+  tty->print_cr("Bootstrapping C1X....");
 
   C1XCompiler* compiler = C1XCompiler::instance();
   if (compiler == NULL) fatal("must use flag -XX:+UseC1X");
--- a/src/share/vm/runtime/sharedRuntime.cpp	Fri Apr 22 19:41:55 2011 +0200
+++ b/src/share/vm/runtime/sharedRuntime.cpp	Fri Apr 22 21:13:09 2011 +0200
@@ -698,6 +698,10 @@
 {
   address target_pc = NULL;
 
+  if (TraceSignals) {
+    tty->print_cr("Searching for continuation for implicit exception at %d", pc);
+  }
+
   if (Interpreter::contains(pc)) {
 #ifdef CC_INTERP
     // C++ interpreter doesn't throw implicit exceptions
@@ -796,7 +800,9 @@
         _implicit_div0_throws++;
 #endif
         if (UseC1X) {
-          tty->print_cr("c1x implicit div0");
+          if (TraceSignals) {
+            tty->print_cr("c1x implicit div0");
+          }
           target_pc = Runtime1::entry_for(Runtime1::c1x_throw_div0_exception_id);
         } else {
           target_pc = nm->continuation_for_implicit_exception(pc);