From 3acbce8afc32509a3aeda46759ea9720bbd488d7 Mon Sep 17 00:00:00 2001 From: mrab Date: Thu, 13 Jun 2024 21:02:00 +0200 Subject: [PATCH] fixed invalid dup depth for postinc/dec --- src/ByteCode/Generator.hs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/ByteCode/Generator.hs b/src/ByteCode/Generator.hs index 6928e3e..65f3e6a 100644 --- a/src/ByteCode/Generator.hs +++ b/src/ByteCode/Generator.hs @@ -442,7 +442,7 @@ assembleStatementExpression expr = (TypedExpression dtype (LocalVariable name)) (exprConstants, exprOps, _) = assembleExpression (constants, ops, lvars) expr in case localIndex of - Just index -> (exprConstants, exprOps ++ [Opsipush 1, Opiadd, Opdup_x1, Opistore (fromIntegral index)], lvars) + Just index -> (exprConstants, exprOps ++ [Opsipush 1, Opiadd, Opdup, Opistore (fromIntegral index)], lvars) Nothing -> error("No such local variable found in local variable pool: " ++ name) (TypedExpression dtype (FieldVariable name)) -> let owner = resolveNameChainOwner (TypedExpression dtype receiver) @@ -464,7 +464,7 @@ assembleStatementExpression expr = (TypedExpression dtype (LocalVariable name)) (exprConstants, exprOps, _) = assembleExpression (constants, ops, lvars) expr in case localIndex of - Just index -> (exprConstants, exprOps ++ [Opsipush 1, Opisub, Opdup_x1, Opistore (fromIntegral index)], lvars) + Just index -> (exprConstants, exprOps ++ [Opsipush 1, Opisub, Opdup, Opistore (fromIntegral index)], lvars) Nothing -> error("No such local variable found in local variable pool: " ++ name) (TypedExpression dtype (FieldVariable name)) -> let owner = resolveNameChainOwner (TypedExpression dtype receiver) @@ -486,7 +486,7 @@ assembleStatementExpression expr = (TypedExpression dtype (LocalVariable name)) (exprConstants, exprOps, _) = assembleExpression (constants, ops, lvars) expr in case localIndex of - Just index -> (exprConstants, exprOps ++ [Opdup_x1, Opsipush 1, Opiadd, Opistore (fromIntegral index)], lvars) + Just index -> (exprConstants, exprOps ++ [Opdup, Opsipush 1, Opiadd, Opistore (fromIntegral index)], lvars) Nothing -> error("No such local variable found in local variable pool: " ++ name) (TypedExpression dtype (FieldVariable name)) -> let owner = resolveNameChainOwner (TypedExpression dtype receiver) @@ -508,7 +508,7 @@ assembleStatementExpression expr = (TypedExpression dtype (LocalVariable name)) (exprConstants, exprOps, _) = assembleExpression (constants, ops, lvars) expr in case localIndex of - Just index -> (exprConstants, exprOps ++ [Opdup_x1, Opsipush 1, Opisub, Opistore (fromIntegral index)], lvars) + Just index -> (exprConstants, exprOps ++ [Opdup, Opsipush 1, Opisub, Opistore (fromIntegral index)], lvars) Nothing -> error("No such local variable found in local variable pool: " ++ name) (TypedExpression dtype (FieldVariable name)) -> let owner = resolveNameChainOwner (TypedExpression dtype receiver)