You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
pstate { stateTypes =Map.insert x t (stateTypes pstate)})
260
+
_setRawType x t = modify (\pstate ->
261
+
pstate { stateRawVarTypes =Map.insert x t (stateRawVarTypes pstate)})
262
+
263
+
_setLValType x t = modify (\pstate ->
264
+
pstate { stateLValTypes =Map.insert x t (stateLValTypes pstate)})
261
265
262
266
-- Partially evaluate instruction. This is called multiple times in the optimization sequence.
263
267
-- First pass: partially evaluate functions (instructions).
@@ -275,7 +279,7 @@ pevalInst i = do
275
279
case monLookup p pstate of-- lookup the known state of the monitor component
276
280
Just r' -> _omit $ addSubst r r' -- The state can already be found in r', therefore the assignment to r can be omitted, and we have to remember to substitute r with r'.
277
281
Nothing-> _keep $ monInsert p r -- remember that PC/block can be found in variable r
278
-
AssignRaw r (BinBasics.LatticeJoin x y) ->do
282
+
AssignRaw r (BinBasics.LatticeJoin(UseNativeBinopFalse) x y) ->do
279
283
if x == y then _omit (addSubst r x) -- trivial join
280
284
elsedo
281
285
caseMap.lookup (x,y) (stateJoins pstate) of
@@ -303,21 +307,34 @@ pevalInst i = do
303
307
let m0 = stateLVals pstate
304
308
let m1 =Map.insert (v, field) r m0
305
309
put $ pstate { stateLVals = m1 }
310
+
311
+
-- 2025-07-31; now also examine the type information
312
+
-- which is useful for booleans
313
+
case (Map.lookup v (stateLValTypes pstate)) of
314
+
Nothing->return()
315
+
Just t -> _setRawType r t
316
+
306
317
AssignRaw r rexpr -> _keep $do
307
318
markUsed rexpr
308
319
case guessType rexpr of
309
320
Nothing->return()
310
-
Just ty ->_setType r ty
321
+
Just ty ->_setRawType r ty
311
322
312
323
313
-
AssignLVal v complexExpr -> _keep $ markUsed complexExpr
324
+
AssignLVal v complexExpr -> _keep $do
325
+
case complexExpr of
326
+
Bin op (UseNativeBinopFalse) r1 r2 | op `elem` [Basics.Eq, Basics.Neq] ->
327
+
_setLValType v RawBoolean
328
+
_ ->return()
329
+
_keep $ markUsed complexExpr
330
+
314
331
SetState p r -> _keep $do
315
332
markUsed r
316
333
monInsert p r
317
334
RTAssertion (AssertType r rt) ->do
318
-
caseMap.lookup r (stateTypes pstate) of
335
+
caseMap.lookup r (stateRawVarTypes pstate) of
319
336
Just rt' | rt' == rt ->returnNothing
320
-
_ -> _keep $_setType r rt >> markUsed r
337
+
_ -> _keep $_setRawType r rt >> markUsed r
321
338
-- RTAssertion (AssertEqTypes opt_ls x y) -> do
322
339
-- let _m = stateTypes pstate
323
340
-- let keep = _keep $ markUsed [x,y]
@@ -331,7 +348,7 @@ pevalInst i = do
331
348
-- else keep
332
349
-- _ -> keep
333
350
RTAssertion (AssertTypesBothStringsOrBothNumbers x y) ->do
0 commit comments