// Test bounds checking at the end of memory with a constant base pointer. // This is intended to verify a bounds check elimination optimization in // the baseline compiler.
// This can be only a functional test, we can't really see whether // the optimization is being applied. However, manual inspection // of the generated code has verified that the optimization is // being applied.
// Memory is one page and minimum memory is one page, so accesses across // the end of the first page should fail.
// Access the first page. // None of these should have an explicit bounds check generated for them as the // effective address is less than the sum of the minimum heap length and the // offset guard length.
for ( let [x,y] of onsecond ) {
assertErrorMessage(() => { gen(x,y)() }, WebAssembly.RuntimeError, /index out of bounds/);
assertErrorMessage(() => { gen(y,x)() }, WebAssembly.RuntimeError, /index out of bounds/);
// Access the third page. // Here the explicit bounds check cannot be omitted, as the access is // beyond min + offset guard.
let onthird = [[60000, 90000]];
for ( let [x,y] of onthird ) {
assertErrorMessage(() => { gen(x,y)() }, WebAssembly.RuntimeError, /index out of bounds/);
assertErrorMessage(() => { gen(y,x)() }, WebAssembly.RuntimeError, /index out of bounds/);
assertErrorMessage(() => { gen2(x,y)() }, WebAssembly.RuntimeError, /index out of bounds/);
assertErrorMessage(() => { gen2(y,x)() }, WebAssembly.RuntimeError, /index out of bounds/);
}
Messung V0.5
¤ Dauer der Verarbeitung: 0.19 Sekunden
(vorverarbeitet)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.