Re: Why have two RETURN opcode for function
[
Date Prev][
Date Next][
Thread Prev][
Thread Next]
[
Date Index]
[
Thread Index]
- Subject: Re: Why have two RETURN opcode for function
 
- From: Coda Highland <chighland@...>
 
- Date: 2016年3月21日 09:12:58 -0700
 
On Mon, Mar 21, 2016 at 9:10 AM, Scott Morgan <blumf@blueyonder.co.uk> wrote:
> On 21/03/16 15:59, Dirk Laurie wrote:
>> 2016年03月21日 16:32 GMT+02:00 Wangbo <wangbo.red@gmail.com>:
>>> I have simple Lua code, why have two RETURN opcode for foo function after i
>>> check compile code.
>>>
>>
>>> 6 [4] RETURN 1 2
>>> 7 [5] RETURN 0 1
>>
>> Checking all code paths to make sure that the `end` statement
>> cannot be reached would make the compiler more complicated.
>>
>
> Is this an overhead of supporting gotos?
>
> Scott
Considering this is bytecode and everything from loops to conditionals
are implemented as jumps? You could say that. But it's not
specifically tied to the "goto" language feature; it would still be
relevant even if you couldn't use "goto" in Lua code.
/s/ Adam