changeset 8196:60a90f433459

alignment bug fix (contributed by Mick Jordan)
author Doug Simon <doug.simon@oracle.com>
date Mon, 11 Mar 2013 14:01:16 +0100
parents 75e8020ed0f5
children 4f81da21fa06
files graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java
diffstat 1 files changed, 4 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java	Mon Mar 11 12:07:28 2013 +0100
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Call.java	Mon Mar 11 14:01:16 2013 +0100
@@ -63,7 +63,10 @@
             // make sure that the displacement word of the call ends up word aligned
             int offset = masm.codeBuffer.position();
             offset += tasm.target.arch.getMachineCodeCallDisplacementOffset();
-            masm.nop(tasm.target.wordSize - offset % tasm.target.wordSize);
+            int modulus = tasm.target.wordSize;
+            if (offset % modulus != 0) {
+                masm.nop(modulus - offset % modulus);
+            }
         }
     }