// Various tests for unaligned float accesses. These are specifically meant to // test the SIGBUS handling on 32-bit ARM by exercising odd addresses and odd // offsets.
// For a triple of (numBallast, ty, offset), create the text for a pair of // functions "get_ty_offset" and "set_ty_offset" where each has numBallast live // dummy values across the operation of interest to force the use of different // register numbers. (This is primarily for the FP registers as ARM code // generation currently always uses the same scratch register for the base // address of the access.) // // These must be augmented with a memory. Memory addresses 0-255 are reserved // for internal use by these functions. The memory must start as zero.
function makeLoadStore(numBallast, ty, offset) { // The general idea of the ballast is that we occupy some FP registers and // some int registers with non-dead values before we perform an operation, // and then we consume the occupied registers after. // // In the case of load, the loaded result is stored back in memory before we // consume the ballast, thus the ion regalloc will not simply always load // the result into d0, but usually into some temp other than d0. Thus the // amount of ballast affects the register. (Ditto baseline though the // reasoning is simpler.) // // In the case of store, we keep the parameter value live until the end so // that the tmp that we compute for the store is moved into a different // register. The tmp has the same value as the parameter value but a // non-JIT compiler can't know that.
function ballast(thunk) {
let s = ""; for ( let i=0 ; i < numBallast; i++ )
s += thunk(); return s;
}
}
// The complexity here comes from trying to force the source/target FP registers // in the FP access instruction to vary. For Baseline this is not hard; for Ion // trickier.
// `offset` corresponds to the "offset" directive in the instruction for ( let offset=0 ; offset < 8; offset++ ) {
// `numBallast` represents the amount of ballast registers we're trying to use, // see comments above. for ( let numBallast=0; numBallast < 16; numBallast++ ) {
let ins = makeInstance(numBallast, offset);
let mem = ins.exports.memory;
let buf = new DataView(mem.buffer);
// `i` represents the offset in the pointer from a proper boundary for ( let i=0; i < 9; i++ ) {
let offs = 256+i;
let val = Math.PI+i;
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.