2#include "internal/array.h"
3#include "internal/eval.h"
8#include "miniprelude.c"
11prelude_ast_value(
VALUE name,
VALUE code,
int line)
14 VALUE ast_value = rb_parser_compile_string_path(rb_parser_new(), name, code, line);
15 ast = rb_ruby_ast_data_get(ast_value);
16 if (!ast || !ast->body.root) {
17 if (ast) rb_ast_dispose(ast);
26 pm_parse_result_init(result);
27 pm_options_line_set(result->
options, line);
28 VALUE error = pm_parse_string(result, code, name, NULL);
31 pm_parse_result_free(result);
42 VALUE code = rb_builtin_find(feature_name, &name_str, &start_line);
44 rb_fatal(
"builtin_iseq_load: can not find %s; "
45 "probably miniprelude.c is out of date",
51 .inline_const_cache = TRUE,
52 .peephole_optimization = TRUE,
53 .tailcall_optimization = FALSE,
54 .specialized_instruction = TRUE,
55 .operands_unification = TRUE,
56 .instructions_unification = TRUE,
57 .frozen_string_literal = TRUE,
58 .debug_frozen_string_literal = FALSE,
59 .coverage_enabled = FALSE,
63 if (rb_ruby_prism_p()) {
65 pm_prelude_load(&result, name_str, code, start_line);
67 vm->builtin_function_table = table;
69 iseq = pm_iseq_new_with_opt(&result.
node, name_str, name_str,
Qnil, 0, NULL, 0, ISEQ_TYPE_TOP, &optimization, &error_state);
71 vm->builtin_function_table = NULL;
72 pm_parse_result_free(&result);
76 rb_jump_tag(error_state);
80 VALUE ast_value = prelude_ast_value(name_str, code, start_line);
81 rb_ast_t *ast = rb_ruby_ast_data_get(ast_value);
83 vm->builtin_function_table = table;
84 iseq = rb_iseq_new_with_opt(ast_value, name_str, name_str,
Qnil, 0, NULL, 0, ISEQ_TYPE_TOP, &optimization,
Qnil);
86 vm->builtin_function_table = NULL;
91 if (0 && strcmp(
"prelude", feature_name) == 0) {
95 BUILTIN_LOADED(feature_name, iseq);
101rb_load_with_builtin_functions(
const char *feature_name,
const struct rb_builtin_function *table)
103 const rb_iseq_t *iseq = builtin_iseq_load(feature_name, table);
104 rb_iseq_eval(iseq, rb_root_box());
115rb_load_gem_prelude(
VALUE _)
#define RUBY_ASSERT(...)
Asserts that the given expression is truthy if and only if RUBY_DEBUG is truthy.
#define Qnil
Old name of RUBY_Qnil.
#define NIL_P
Old name of RB_NIL_P.
void rb_exc_raise(VALUE mesg)
Raises an exception in the current thread.
VALUE rb_stdout
STDOUT constant.
Defines RBIMPL_HAS_BUILTIN.
#define _(args)
This was a transition path from K&R to ANSI.
pm_scope_node_t node
The resulting scope node that will hold the generated AST.
pm_options_t * options
The options that will be passed to the parser.
uintptr_t VALUE
Type that represents a Ruby object.