-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
We add a new scratchsize option (default value an arbitrary 256), and a new scratchmem dctx pointer. We allocate twice as much space as we asked for (only half of which is usable), because the verifier can only use the values of variables to adjust its bounds in very limited conditions: so we leave enough space to write the full size of scratch space to the last byte of scratch space without overflow. (Runtime checks will prohibit such things, but the verifier doesn't know about those.) The top of currently-allocated scratch space is indicated via a single new 8-byte-aligned value in the machine state, DMST_SCRATCH_TOP. It is reset to 0 before each clause is invoked. alloca itself is fairly pedestrian given all that. The size check is fairly trivial: the only fiddly bit is the alignment (thanks to Kris Van Hees for that). Overly large allocations are unconditionally refused via a compile-time error, before even generating any code, preventing the verifier from concluding that too-large allocations can't succeed and therefore the success branch in the alloca size check is unreachable code. alloca'ed pointers are not yet terribly usable at this stage: you can't dereference them because they are not map_values, just arbitrary scalars. Thus there are no tests yet either. (One new test fails temporarily: test/unittest/codegen/tst.stack_layout.sh. It needs adjusting for the new dmst variables, but we still have more to add in later commits.) Signed-off-by: Nick Alcock <nick.alcock@oracle.com> Signed-off-by: Kris Van Hees <kris.van.hees@oracle.com> Reviewed-by: Kris Van Hees <kris.van.hees@oracle.com>
- Loading branch information
1 parent
7a4b783
commit 8d43f03
Showing
7 changed files
with
127 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters