Branch: Tag:


2014-12-04 19:26:50 by Per Hedbor <>


This calls the constant in arg1 with arg2 arguments from the stack.

These opcodes are used if the number of arguments is known and bigger
than 1.

It is not really all that big an optimization, it only removes the
mark stack handling. And, in fact, due to the fact that it removes
some peep optimizations it might be somewhat slower when not using the
amd64 machine code (since, as an example, APPLY/ASSIGN_LOCAL/POP is no
longer an opcode that is used in this case).

However, when using the amd64 code the assign local + pop opcode is
higly optimized, so it's not an issue that it is not merged into the
apply opcode. It is in fact more of a feature.

For that reason the code in docode.c is currently conditional.
The only code generator using it is the amd64 one.

2493:    DO_CALL_BUILTIN(1);   });    + OPCODE2(F_CALL_BUILTIN_N, "call builtin N", I_UPDATE_ALL, { +  FAST_CHECK_THREADS_ON_CALL(); +  DO_CALL_BUILTIN(arg2); + }); +  + OPCODE2( F_APPLY_N, "apply N", I_UPDATE_ALL, { +  mega_apply( APPLY_SVALUE_STRICT, arg2, &((Pike_fp->context->prog->constants + arg1)->sval), 0 ); + }); +    OPCODE1(F_CALL_BUILTIN1_AND_POP, "call builtin1 & pop", I_UPDATE_ALL, {    FAST_CHECK_THREADS_ON_CALL();    DO_CALL_BUILTIN(1);