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
We are increasingly running into areas where the ASL specs contain runtime bugs that are not being detected by testing.
In particular, a slice assignment such as "x[i] = '1';" should generate a compile time or runtime error if "i" is too big but, instead, the write is often silently ignored.
The full range of runtime checks required is
Array indexing
All four variants of bitslice indexing
Checked type conversions such as "r as {0..255}"
Division by zero
Shift distances must be in the range 0..N (or 0..N-1?) todo: what about rotations?
Exact division operator (not done yet because exact division checks break specs that still expect DIX to mean inexact division)
There is no need for the following runtime checks because typechecking will catch these
Initialization of a constrained integer variable(e.g., "var/let x : integer {0..255} = y;"
Assignment to a constrained integer (e.g., "var x : integer {0..255}; .... x = y;"
Returning a constrained integer
Passing a constrained integer as function argument
Plan
Extend ASLi with an internal "let-expression" representation "__let x : = __in ". This can be used to avoid evaluating index expressions twice (which would matter if they had side effects)
Extend ASLi with an internal "assert-expression" representation "__assert __in ". This can be used to insert runtime checks.
Extend ASLi's typechecker to insert runtime checks as it typechecks code. (Putting this in the typechecker adds complexity to an already complex pass - but it is the place where type information is most readily available.)
Check that optimizations are able to delete most of the runtime checks using range analysis, exploiting constraint information, etc.
Not done yet: constprop does not perform range analysis
Add ability to generate compile-time warnings to help us track down places where runtime checks are required - maybe constraint information needs to be tightened up in those places?
Not done yet: without optimizations to remove most of the checks, this would be far too noisy
The text was updated successfully, but these errors were encountered:
Motivation
We are increasingly running into areas where the ASL specs contain runtime bugs that are not being detected by testing.
In particular, a slice assignment such as "x[i] = '1';" should generate a compile time or runtime error if "i" is too big but, instead, the write is often silently ignored.
The full range of runtime checks required is
There is no need for the following runtime checks because typechecking will catch these
Plan
The text was updated successfully, but these errors were encountered: