2#include "internal/box.h"
7#include "builtin_binary.rbbin"
9#ifndef BUILTIN_BINARY_SIZE
11#define BUILTIN_LOADED(feature_name, iseq) ((void)0)
12#include "mini_builtin.c"
16static const unsigned char *
17bin4feature(
const struct builtin_binary *bb,
const char *feature,
size_t *psize)
19 *psize = bb->bin_size;
20 return strcmp(bb->feature, feature) ? NULL : bb->bin;
23static const unsigned char*
24builtin_lookup(
const char *feature,
size_t *psize)
26 static size_t index = 0;
27 const unsigned char *bin = NULL;
50 bin = bin4feature(bb, feature, psize);
64 const unsigned char *bin = builtin_lookup(feature_name, &size);
66 rb_bug(
"builtin_lookup: can not find %s", feature_name);
71 if (vm->builtin_function_table != NULL) rb_bug(
"vm->builtin_function_table should be NULL.");
72 vm->builtin_function_table = table;
73 const rb_iseq_t *iseq = rb_iseq_ibf_load_bytes((
const char *)bin, size);
75 vm->builtin_function_table = NULL;
78 rb_iseq_eval(rb_iseq_check(iseq), target_box);
82rb_load_with_builtin_functions(
const char *feature_name,
const struct rb_builtin_function *table)
84 load_with_builtin_functions(feature_name, table, rb_root_box());
94 if (flags->error_highlight) {
97 if (flags->did_you_mean) {
100 if (flags->syntax_suggest) {
109rb_load_gem_prelude(
VALUE box)
111 load_with_builtin_functions(
"gem_prelude", NULL, (
const rb_box_t *)box);
117rb_free_loaded_builtin_table(
void)
129Init_builtin_features(
void)
132#ifdef BUILTIN_BINARY_SIZE
134 rb_load_gem_prelude((
VALUE)rb_root_box());
136 rb_load_gem_prelude((
VALUE)rb_main_box());
VALUE rb_define_module(const char *name)
Defines a top-level module.
#define ASSUME
Old name of RBIMPL_ASSUME.
#define Qnil
Old name of RUBY_Qnil.
Defines RBIMPL_HAS_BUILTIN.
#define _(args)
This was a transition path from K&R to ANSI.
Internal header for Ruby Box.
uintptr_t VALUE
Type that represents a Ruby object.