Feature #22395
closedRubyVM::InstructionSequence.load_from_binary: to optionally accept `file` and `path` arguments
Description
Context¶
I'm trying to fix the long standing [Feature #17593] issue.
In short, ISeq caching has a problematic limitation that the path and realpath of the source file is embedded in the iseq.
Meaning that if you build your application in a different path than where you later run it, the iseq cache becomes invalid, which is very problematic for some build systems like buildpacks.
[Feature #17593] proposed for load_iseq_eval to override these paths, but that would mean mutating or duping the iseq which I think would either be dangerous or inneficient.
Hence I think to solve that issue we need some change to the public API.
Proposed changes¶
Change:
to:
These optional parameters are consistent with ISeq.compile.
Consequently, VALUE rb_iseq_load_from_binary(const char *ptr, size_t len) that was introduced in [Feature #22222] (hence not yet released) would become:
VALUE rb_iseq_load_from_binary(const char *ptr, size_t len, VALUE file, VALUE path).
Proposed patch¶
Updated by mame (Yusuke Endoh) 15 days ago
- Related to Feature #17593: load_iseq_eval should override the ISeq path added
Updated by ko1 (Koichi Sasada) 15 days ago
Matz approved this proposal.
No objection in dev-meeting.
Updated by byroot (Jean Boussier) 14 days ago
- Status changed from Open to Closed
Applied in changeset git|9ce0df671980d669cbab8afc48124c7453897533.
Make ISeq binaries portable
- Make
__FILE__a frozen core method that return the iseq path. - Make
load_from_binaryacceptfile, pathlike compile.