changeset 9980:8369c5780c77

Refactoring
author Christos Kotselidis <christos.kotselidis@oracle.com>
date Mon, 10 Jun 2013 13:04:38 +0200
parents 70ffc60dbce7
children a5adff75cb93
files graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java
diffstat 2 files changed, 10 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Mon Jun 10 12:40:36 2013 +0200
+++ b/graal/com.oracle.graal.hotspot.amd64/src/com/oracle/graal/hotspot/amd64/AMD64HotSpotLIRGenerator.java	Mon Jun 10 13:04:38 2013 +0200
@@ -461,7 +461,6 @@
         RegisterValue raxRes = AMD64.rax.asValue(kind);
         emitMove(raxRes, expected);
         if (runtime().config.useCompressedOops && node.compress()) {
-            assert kind == Kind.Object;
             Variable scratch = newVariable(Kind.Long);
             append(new CompareAndSwapCompressedOp(raxRes, address, raxRes, newValue, scratch, runtime().config.narrowOopBase, runtime().config.narrowOopShift, runtime().config.logMinObjAlignment));
         } else {
--- a/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java	Mon Jun 10 12:40:36 2013 +0200
+++ b/graal/com.oracle.graal.lir.amd64/src/com/oracle/graal/lir/amd64/AMD64Move.java	Mon Jun 10 13:04:38 2013 +0200
@@ -423,6 +423,7 @@
             this.address = address;
             this.cmpValue = cmpValue;
             this.newValue = newValue;
+            assert cmpValue.getKind() == Kind.Object;
         }
 
         @Override
@@ -643,23 +644,16 @@
     protected static void compareAndSwapCompressed(TargetMethodAssembler tasm, AMD64MacroAssembler masm, AllocatableValue result, AMD64AddressValue address, AllocatableValue cmpValue,
                     AllocatableValue newValue, AllocatableValue scratch, long narrowOopBase, int narrowOopShift, int logMinObjAlignment) {
         assert asRegister(cmpValue) == AMD64.rax && asRegister(result) == AMD64.rax;
-
-        switch (cmpValue.getKind()) {
-            case Object:
-                final Register scratchRegister = asRegister(scratch);
-                final Register cmpRegister = asRegister(cmpValue);
-                final Register newRegister = asRegister(newValue);
-                encodeOop(masm, cmpRegister, narrowOopBase, narrowOopShift, logMinObjAlignment);
-                masm.movq(scratchRegister, newRegister);
-                encodeOop(masm, scratchRegister, narrowOopBase, narrowOopShift, logMinObjAlignment);
-                if (tasm.target.isMP) {
-                    masm.lock();
-                }
-                masm.cmpxchgl(scratchRegister, address.toAddress());
-                break;
-            default:
-                throw GraalInternalError.shouldNotReachHere();
+        final Register scratchRegister = asRegister(scratch);
+        final Register cmpRegister = asRegister(cmpValue);
+        final Register newRegister = asRegister(newValue);
+        encodeOop(masm, cmpRegister, narrowOopBase, narrowOopShift, logMinObjAlignment);
+        masm.movq(scratchRegister, newRegister);
+        encodeOop(masm, scratchRegister, narrowOopBase, narrowOopShift, logMinObjAlignment);
+        if (tasm.target.isMP) {
+            masm.lock();
         }
+        masm.cmpxchgl(scratchRegister, address.toAddress());
     }
 
     private static void encodeOop(AMD64MacroAssembler masm, Register scratchRegister, long narrowOopBase, int narrowOopShift, int logMinObjAlignment) {