Add heaps to the Cretonne IL.
Add preamble syntax for declaring static and dynamic heaps, and update the langref section on heaps. Add IR support for heap references. Remove the heap_load and heap_store as discussed in #144. We will use heap_addr along with native load and store instructions in their place. Add the heap_addr instruction and document its bounds checking semantics.
This commit is contained in:
@@ -301,6 +301,9 @@ impl<'a> Verifier<'a> {
|
||||
UnaryGlobalVar { global_var, .. } => {
|
||||
self.verify_global_var(inst, global_var)?;
|
||||
}
|
||||
HeapAddr { heap, .. } => {
|
||||
self.verify_heap(inst, heap)?;
|
||||
}
|
||||
|
||||
// Exhaustive list so we can't forget to add new formats
|
||||
Nullary { .. } |
|
||||
@@ -367,6 +370,14 @@ impl<'a> Verifier<'a> {
|
||||
}
|
||||
}
|
||||
|
||||
fn verify_heap(&self, inst: Inst, heap: ir::Heap) -> Result {
|
||||
if !self.func.heaps.is_valid(heap) {
|
||||
err!(inst, "invalid heap {}", heap)
|
||||
} else {
|
||||
Ok(())
|
||||
}
|
||||
}
|
||||
|
||||
fn verify_value_list(&self, inst: Inst, l: &ValueList) -> Result {
|
||||
if !l.is_valid(&self.func.dfg.value_lists) {
|
||||
err!(inst, "invalid value list reference {:?}", l)
|
||||
|
||||
Reference in New Issue
Block a user