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.
20 lines
450 B
Plaintext
20 lines
450 B
Plaintext
test verifier
|
|
target x86_64
|
|
|
|
function %deref_base_type(i64 vmctx) {
|
|
gv0 = vmctx+0
|
|
gv1 = deref(gv0): i32
|
|
gv2 = deref(gv1): i32 ; error: deref base gv1 has type i32, which is not the pointer type i64
|
|
|
|
ebb0(v0: i64):
|
|
return
|
|
}
|
|
|
|
function %global_value_wrong_type(i64 vmctx) {
|
|
gv0 = vmctx+0
|
|
|
|
ebb0(v0: i64):
|
|
v1 = global_value.i32 gv0 ; error: global_value instruction with type i32 references global value with type i64
|
|
return
|
|
}
|