-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
`CalleeSave` is a problematic instruction that has possible race-conditions, as well as being badly behaved for recursively bound `flatMap`s. This system was designed to allow for references to reuse slots in the array when necessary. However, it is much safer to think of all the references in the universe being independent; the problem, of course, is that not all of these references are visible at the top-level, so there is likely not enough space to accommodate them. This PR reworks things so that the `Context` feeds back information to a soon-to-be-generated `flatMap` body about the currently largest residency found for references. The `flatMap` will always allocate its references above this, and emit a new instruction that *just* resizes the refs array. It is possible that global references find themselves occupying the same slot as another if it was used across two parsers, and this is more explicitly checked now up-front in the allocator. Whereas before only if a reference was out of range would it crash, now it will crash immediately as soon as a clash for the references of a parser appear: this avoids the undefined behaviour where two references would write over each other. In all, a better system. Fixes #241
- Loading branch information
Showing
12 changed files
with
57 additions
and
210 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
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
Oops, something went wrong.