Skip to content

Commit

Permalink
In MVMLexicalRegistry, lexreg[i]->value is always i.
Browse files Browse the repository at this point in the history
The value *is* the index in the array - it's used to find the correct array
index when doing a hash lookup by name. Hence use the `i` directly,
avoiding a dereference.

This code was initially in src/6model/reprs/MVMIter.c, added in Oct 2015
by commit 5075f5b:
    Make context iterator include values.

    Before it just had keys, but skipped the values, menaing that things
    like CORE::.values in Rakudo just gave a load of (Mu).

`lexreg[i]->value` was always `i` back then too, so it's been a tiny bit
Less Than Optimal since day 1.
  • Loading branch information
nwc10 committed Jun 14, 2020
1 parent 5d98d8e commit 12c7a44
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/spesh/frame_walker.c
Expand Up @@ -342,7 +342,7 @@ MVMObject * MVM_spesh_frame_walker_get_lexicals_hash(MVMThreadContext *tc, MVMSp
MVMuint32 i;
for (i = 0; i < sf->body.num_lexicals; i++) {
MVMuint16 type = sf->body.lexical_types[i];
MVMuint32 idx = base_index + lexreg[i]->value;
MVMuint32 idx = base_index + i;
switch (type) {
case MVM_reg_obj: {
MVMObject *obj = frame->env[idx].o;
Expand Down

0 comments on commit 12c7a44

Please sign in to comment.