[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Extraneous return
- From: Daniel Silverstone <dsilvers@...>
- Date: Wed, 10 Nov 2004 21:18:33 +0000
Hi,
I often see function disassemblies where the last two instructions of a
function are OP_RETURN statements.
in close_func() in lparser.c there's an unconditional adding of a return
statement.
By making it conditional in the form:
if (GET_OPCODE(f->code[fs->pc-1]) != OP_RETURN)
luaK_codeABC(fs, OP_RETURN, 0, 1, 0); /* final return */
I think you can avoid that extra opcode. Which potentially saves space
if there are a lot of Protos in use.
Now this seems so obvious to me that there must be a damned good reason
why I'm a fool and that this will break everything.
Please someone put me out of my misery and explain why I shouldn't
commit this to my tree?
D.
--
Daniel Silverstone http://www.digital-scurf.org/
PGP mail accepted and encouraged. Key Id: 2BC8 4016 2068 7895