X-Git-Url: http://wien.tomnetworks.com/gitweb/?p=mate.git;a=blobdiff_plain;f=Mate%2FX86CodeGen.hs;h=6def8de41da1f5d8bafee84acce33cd413297dda;hp=8f2bbfb4af28f1cdddff71d005a04f2a6ce48ac9;hb=fb42a1f78a371a5f1208998e424aee49d06281e6;hpb=33fee81a6dc52f54beda6819c95e7e4571613ea6 diff --git a/Mate/X86CodeGen.hs b/Mate/X86CodeGen.hs index 8f2bbfb..6def8de 100644 --- a/Mate/X86CodeGen.hs +++ b/Mate/X86CodeGen.hs @@ -107,7 +107,7 @@ emitFromBB cls method = do -- place a nop at the end, therefore the disasm doesn't screw up emit32 (0xffff9090 :: Word32) >> emit8 (0x90 :: Word8) -- discard arguments on stack - let argcnt = ((if hasThis then 1 else 0) + (methodGetArgsCount $ methodNameTypeByIdx cls cpidx)) * ptrSize + let argcnt = ((if hasThis then 1 else 0) + methodGetArgsCount (methodNameTypeByIdx cls cpidx)) * ptrSize when (argcnt > 0) (add esp argcnt) -- push result on stack if method has a return value when (methodHaveReturnValue cls cpidx) (push eax) @@ -120,7 +120,7 @@ emitFromBB cls method = do calladdr <- getCurrentOffset call (Disp offset, eax) -- discard arguments on stack (`+1' for "this") - let argcnt = ptrSize * (1 + (methodGetArgsCount $ methodNameTypeByIdx cls cpidx)) + let argcnt = ptrSize * (1 + methodGetArgsCount (methodNameTypeByIdx cls cpidx)) when (argcnt > 0) (add esp argcnt) -- push result on stack if method has a return value when (methodHaveReturnValue cls cpidx) (push eax)