[qfcc] Skip over zero stack adjustment

This is a very tiny optimization, but there's no point in adjust the
stack if there's no actual adjustment. I didn't bother with it initially
because I thought it wouldn't happen (and I was more interested in
getting things working first), but it turns out that simple getters that
result in a zero adjustment are quite common (70/535 in qwaq-app.dat).
This commit is contained in:
Bill Currie 2022-02-05 20:36:38 +09:00
parent fbb67419f2
commit 5f2fd3cac0

View file

@ -801,7 +801,12 @@ build_code_function (symbol_t *fsym, expr_t *state_expr, expr_t *statements)
dstatement_t *st = &pr.code->code[func->code];
if (st->op == OP_ADJSTK) {
st->b = -func->params_start;
if (func->params_start) {
st->b = -func->params_start;
} else {
// skip over adjstk so a zero adjustment doesn't get executed
func->code += 1;
}
}
merge_spaces (space, func->parameters->space, STACK_ALIGN);
func->parameters->space = space;