Project

General

Profile

Actions

Feature #22222

open

Expose a C API equivalent of `RubyVM::InstructionSequence.load_from_binary`

Feature #22222: Expose a C API equivalent of `RubyVM::InstructionSequence.load_from_binary`

Added by byroot (Jean Boussier) 1 day ago. Updated 1 day ago.

Status:
Open
Assignee:
-
Target version:
-
[ruby-core:126211]

Description

Currently the only API to deserialize instruction sequence is RubyVM::InstructionSequence.load_from_binary(String).

It works fine, but isn't ideal for gems like bootsnap, as it needs to allocate a fairly large string and memcpy into it.

I would like to be able to directly pass a char *ptr and size_t len pair, so that I can directly pass a internal buffer or even mmapped file.

Proposed API:

VALUE rb_iseq_load_from_binary(const char *ptr, size_t len)

Pull request: https://github.com/ruby/ruby/pull/18136

Actions

Also available in: PDF Atom