Include emergency stack slots when laying out the stack.

Emergency stack slots are a new kind of stack slot added relatively
recently. They need to be allocated a stack offset just like explicit
and spill slots.

Also, make StackSlotData's offset field an Option, to catch problems
like this in the future. Previously the value 0 was used when offsets
weren't assigned yet, however that made it non-obvious when the field
meant "not assigned yet" and when it meant "assigned the value 0".
This commit is contained in:
Dan Gohman
2018-03-03 13:21:10 -08:00
parent a301280d94
commit 13b167770c
9 changed files with 81 additions and 60 deletions

View File

@@ -1070,7 +1070,7 @@ impl<'a> Parser<'a> {
// Take additional options.
while self.optional(Token::Comma) {
match self.match_any_identifier("expected stack slot flags")? {
"offset" => data.offset = self.match_imm32("expected byte offset")?,
"offset" => data.offset = Some(self.match_imm32("expected byte offset")?),
other => return err!(self.loc, "Unknown stack slot flag '{}'", other),
}
}