[Date Prev][Date Next][Thread Prev][Thread Next]
[Date Index]
[Thread Index]
- Subject: Re: Question regarding code generation of OP_SELF
- From: Dibyendu Majumdar <mobile@...>
- Date: Thu, 6 Oct 2016 11:36:53 +0100
On 6 October 2016 at 01:51, Dibyendu Majumdar <mobile@majumdar.org.uk> wrote:
> I am trying to optimise the scenario where for the OP_SELF bytecode
> the table access can exploit the fact that the key is a short string.
> I am doing this by checking in luaK_self() whether the key is a
> constant short string and if so I generate a specialised bytecode.
> However, when executing the code, an assertion is raised because the
> string key is in fact a long string. I was wondering if the string
> constant type can change between luaK_self() emitting the bytecode and
> the VM executing it.
>
Looking at how strings are created this doesn't seem possible, so the
issue must be somewhere else. I am checking the type of the 'key'
parameter in the following way (in luaK_self()):
int is_string_constant_key =
key->k == VK &&
isshortstr(fs, RKASK(key->u.info));
Perhaps this is incorrect?
Regards
Dibyendu