lua-users home
lua-l archive

[Date Prev][Date Next][Thread Prev][Thread Next] [Date Index] [Thread Index]


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