diff src/share/vm/graal/graalCodeInstaller.cpp @ 18196:ff1f1481b367

Fix bug in code installer.
author Roland Schatz <roland.schatz@oracle.com>
date Thu, 30 Oct 2014 18:14:41 +0100
parents 9619ba4daf4c
children a8cff27ca2e1 6eda3b299460
line wrap: on
line diff
--- a/src/share/vm/graal/graalCodeInstaller.cpp	Thu Oct 30 17:52:18 2014 +0100
+++ b/src/share/vm/graal/graalCodeInstaller.cpp	Thu Oct 30 18:14:41 2014 +0100
@@ -552,19 +552,18 @@
 
   buffer.initialize_oop_recorder(_oop_recorder);
 
+  // copy the constant data into the newly created CodeBuffer
+  address end_data = _constants->start() + _constants_size;
+  memcpy(_constants->start(), data_section()->base(T_BYTE), _constants_size);
+  _constants->set_end(end_data);
+
   // copy the code into the newly created CodeBuffer
   address end_pc = _instructions->start() + _code_size;
   if (!_instructions->allocates2(end_pc)) {
     return false;
   }
-  memcpy(_instructions->start(), code()->base(T_BYTE), code()->length());
+  memcpy(_instructions->start(), code()->base(T_BYTE), _code_size);
   _instructions->set_end(end_pc);
-
-  // copy the constant data into the newly created CodeBuffer
-  address end_data = _constants->start() + _constants_size;
-  memcpy(_constants->start(), data_section()->base(T_BYTE), _constants_size);
-  _constants->set_end(end_data);
-
   
   for (int i = 0; i < data_section_patches()->length(); i++) {
     Handle patch = data_section_patches()->obj_at(i);