Skip to content

Remove capacity from constant id lists - #4337

Merged
kddnewton merged 2 commits into
mainfrom
constant-id-capacity
Nov 17, 2026
Merged

kddnewton merged 2 commits into
mainfrom
constant-id-capacity

Conversation

@kddnewton

Copy link
Copy Markdown
Collaborator

No description provided.

@kddnewton
kddnewton added this pull request to stack #4338 November 5, 2026 13:36
@hasannadeem

hasannadeem commented Nov 6, 2026 •

Copy link
Copy Markdown

The two test-all failures (here and on #4339 and #4340, which stack on this) come from building CRuby, not from the tests. ruby/ruby still uses the old pm_constant_id_list_t API in two places. CI only shows the first one, because make stops at compile.o before it compiles vm.o:

  1. prism_compile.c:3611 sets the removed field when it builds the synthetic pm_def_node_t for mandatory_only_iseq:

    prism_compile.c:3611:14: error: 'pm_constant_id_list_t' has no member named 'capacity'
     3611 |             .capacity = def_node->locals.capacity
    

    Deleting that line is enough, since .size there already comes from parameters_node->requireds.size.

  2. vm_eval.c:1871, which is compiled as part of vm.c, calls pm_constant_id_list_init(&parent_scope->locals) with the old one-argument signature. pm_constant_id_list_init(result.arena, &parent_scope->locals, 0) keeps its behaviour, because the loop after it fills the list with pm_constant_id_list_append.

I compiled both call sites, unchanged, against this branch's constant_pool.h. They give exactly those two errors (too few arguments to function call, expected 3, have 1 for the second), and with both changes they compile cleanly. Nothing else in ruby/ruby outside prism/ uses the API this changes, so the sync needs both changes.

Also, the CHANGELOG entry covers the struct change, but pm_constant_id_list_init is exported and its signature changed too, from (list) to (arena, list, size). It also now sets size instead of starting the list empty. That could be worth a line for other C API users.

Edited: the first version of this comment missed vm_eval.c and said CRuby doesn't call pm_constant_id_list_init.

@kddnewton
kddnewton force-pushed the constant-id-capacity branch from 08c411b to 415c0ca Compare November 11, 2026 20:46
Base automatically changed from node-chunks to main November 17, 2026 17:12
@kddnewton
kddnewton force-pushed the constant-id-capacity branch from 415c0ca to 256e060 Compare November 17, 2026 19:58
@kddnewton
kddnewton merged commit 60c9efe into main Nov 17, 2026
118 of 120 checks passed
@kddnewton
kddnewton deleted the constant-id-capacity branch November 17, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants