diff options
-rw-r--r-- | src/Compile.hs | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/src/Compile.hs b/src/Compile.hs index c134824..4e60ace 100644 --- a/src/Compile.hs +++ b/src/Compile.hs @@ -1020,13 +1020,15 @@ compile' env = \case shsizename <- genName' "acshsz" ivar <- genName' "i" ((), stmts1) <- scope $ add t1 (d++".j.buf->xs["++ivar++"]") (s++".j.buf->xs["++ivar++"]") + ((), stmtsDecr) <- scope $ incrementVarAlways "accumarr" Decrement (STArr n (CHAD.d2 t1)) (s++".j") emit $ SIf (CEBinop (CELit (s++".tag")) "==" (CELit "1")) (pure (SIf (CEBinop (CELit (d++".tag")) "==" (CELit "0")) (pure (SAsg d (CELit s))) (pure (SVarDecl True (repSTy tIx) shsizename (compileArrShapeSize n (s++".j"))) -- TODO: emit check here for the source being either equal in shape to the destination <> pure (SLoop (repSTy tIx) ivar (CELit "0") (CELit shsizename) - stmts1)))) + stmts1) + <> stmtsDecr))) mempty add (STScal sty) d s = case sty of STI32 -> return () @@ -1039,8 +1041,6 @@ compile' env = \case emit $ SVerbatim $ "// compile EAccum start (" ++ show prj ++ ")" dest <- accumRef t prj (nameacc++".buf->ac") nameidx add (acPrjTy prj t) dest nameval - - incrementVarAlways "accumval" Decrement (typeOf eval) nameval emit $ SVerbatim $ "// compile EAccum end" return $ CEStruct (repSTy STNil) [] |