fields: don't multiple the offset with 4
authorBernhard Urban <lewurm@gmail.com>
Thu, 26 Apr 2012 14:44:54 +0000 (16:44 +0200)
committerBernhard Urban <lewurm@gmail.com>
Thu, 26 Apr 2012 15:02:26 +0000 (17:02 +0200)
it's already correct in the table, noob...

Mate/X86CodeGen.hs

index ff9ca2da67521554b794660d0cfeca2f3ee6e8ce..59ccb420d4a6cd929c8bb31f7780740c2d519275 100644 (file)
@@ -307,13 +307,13 @@ emitFromBB method cls hmap =  do
         pop eax -- this pointer
         let (cname, fname) = buildFieldOffset cls x
         offset <- liftIO $ getFieldOffset cname fname
-        push (Disp (fromIntegral $ offset * 4), eax) -- get field
+        push (Disp (fromIntegral $ offset), eax) -- get field
     emit (PUTFIELD x) = do
         pop ebx -- value to write
         pop eax -- this pointer
         let (cname, fname) = buildFieldOffset cls x
         offset <- liftIO $ getFieldOffset cname fname
-        mov (Disp (fromIntegral $ offset * 4), eax) ebx -- set field
+        mov (Disp (fromIntegral $ offset), eax) ebx -- set field
 
     emit IADD = do pop ebx; pop eax; add eax ebx; push eax
     emit ISUB = do pop ebx; pop eax; sub eax ebx; push eax