Skip to content

Support Proc.new(Void*, Void*) in the interpreter#16044

Merged
straight-shoota merged 5 commits intocrystal-lang:masterfrom
HertzDevil:feature/interpreter-proc-new
Aug 4, 2025
Merged

Support Proc.new(Void*, Void*) in the interpreter#16044
straight-shoota merged 5 commits intocrystal-lang:masterfrom
HertzDevil:feature/interpreter-proc-new

Conversation

@HertzDevil
Copy link
Contributor

@HertzDevil HertzDevil commented Aug 1, 2025

Fixes part of #12495.

This constructor is now a primitive in interpreted code, and accepts both CompiledDef pointers and C function pointers, assuming the latter by default, unless a previous ProcLiteral has created the pointer. The interpreter will then compile a wrapper on the fly; eventually the external_var_get primitive from the original issue may adopt a similar technique.

Two Procs with the same C function pointer will refer to the same CompiledDef. Each CompiledDef more or less maintains its own FFI::CallInterface; there is no FFI closure involved, unlike Crystal procs.

This enables networking on Windows inside the interpreter, and also drops a workaround in the IOCP event loop.

@straight-shoota straight-shoota added this to the 1.18.0 milestone Aug 2, 2025
@straight-shoota straight-shoota merged commit 5a5f0ae into crystal-lang:master Aug 4, 2025
49 checks passed
@HertzDevil HertzDevil deleted the feature/interpreter-proc-new branch August 4, 2025 14:24
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants