Fix legalization of heap_addrs with 32-bit indices. (#480)
This makes several changes: - It adds an index_type to heap declarations, allowing heaps to specify the type for indexing. This also anticipates 64-bit heap support. - It adds a memory_type to deref global values, allowing deref globals to have types other than pointers. This is used to allow the bound variable in dynamic heaps to have type i32, to match the index type in heaps with i32 index type. - And, it fixes heap legalization to do the bounds check in the heap's index type.
This commit is contained in:
@@ -17,7 +17,7 @@ ebb0(v0: i64):
|
||||
|
||||
function %deref(i64 vmctx) -> i32 {
|
||||
gv3 = vmctx+16
|
||||
gv4 = deref(gv3)-32
|
||||
gv4 = deref(gv3)-32: i32
|
||||
; check: gv4 = deref(gv3)-32
|
||||
ebb0(v0: i64):
|
||||
v1 = global_value.i32 gv4
|
||||
@@ -27,7 +27,7 @@ ebb0(v0: i64):
|
||||
|
||||
; Refer to a global value before it's been declared.
|
||||
function %backref(i64 vmctx) -> i32 {
|
||||
gv1 = deref(gv2)-32
|
||||
gv1 = deref(gv2)-32: i32
|
||||
; check: gv1 = deref(gv2)-32
|
||||
gv2 = vmctx+16
|
||||
; check: gv2 = vmctx+16
|
||||
|
||||
Reference in New Issue
Block a user