IE:
/* the OP_IS_(SOCKET|FILETEST) macros are optimized to a simple range
check because all the member OPs are contiguous in opcode.pl
<DATA> table. opcode.pl verifies the range contiguity. */
#define OP_IS_SOCKET(op) \
((op) >= OP_SEND && (op) <= OP_GETPEERNAME)
#define OP_IS_FILETEST(op) \
((op) >= OP_FTRREAD && (op) <= OP_FTBINARY)
This optimized form is generated automatically when
the set of OPs have consecutive opnumbers, otherwize
the traditional form is generated.
I moved send & recv ops down in opcode.pl <DATA>
so that theyre contiguous with the others.
the OP_FT* ops were already consecutive.
Also, 1 unrelated touch to change enum opcode syntax
to explicitly number the enum symbols.
typedef enum opcode {
OP_NULL = 0,
OP_STUB = 1,
OP_SCALAR = 2,
OP_PUSHMARK = 3,
OP_WANTARRAY = 4,
Oooh, util.o gets 1% smaller:
util.o.orig : 35352 1.010
util.o : 35016 1.000
Thanks, applied (change 33267)
Nicholas Clark
cool - heres an add-on.
1 - fix bug in gen_op_is_macro()
I missed a variable change, so unoptimized macros would be wrong.
while there, hoisted print "#define $macname" out of if/else,
added paranoid check (if range was ill-def'd)
Obviously, this (4th) chunk is needed, please take it, whether or not
you like the rest. Or ask, and I'll resend.
2 - remove OP_IS_FILETEST_ACCESS from op.h
3 - add it into opcode.pl
RFC - I tweak the DATA by adding a '+' flag to
the filetest-access OPs so that opcode.pl could handle the
macro-gen the same way as the previous patch did.
I had misgivings about this approach, since it crams yet another
crypto-spec into the DATA, but its simpler (and clearer) than populating
%OP_IS_FT_ACCESS purely with code.
this is a truly tiny shrink.
125018 0 0 125018 1e85a fta/op.o
125034 0 0 125034 1e86a blead/op.o
Thanks, applied as #33364. I also fixed the calls to the
OP_IS_FILETEST_ACCESS macro, that was expecting an OP*, and now
expects an integer.