1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93
|
// -*- c -*-
// DO NOT MODIFY THIS FILE DIRECTLY.
// auto-generated file
// by ./tool/mk_builtin_loader.rb
// with array.rb
#include "internal/compilers.h" /* for MAYBE_UNUSED */
#include "internal/warnings.h" /* for COMPILER_WARNING_PUSH */
#include "ruby/ruby.h" /* for VALUE */
#include "builtin.h" /* for RB_BUILTIN_FUNCTION */
struct rb_execution_context_struct; /* in vm_core.h */
static void
mjit_compile_invokebuiltin_for_rb_ary_shuffle_bang(FILE *f, long index, unsigned stack_size, bool inlinable_p)
{
fprintf(f, " VALUE self = GET_SELF();\n");
fprintf(f, " typedef VALUE (*func)(rb_execution_context_t *, VALUE, VALUE);\n");
if (index == -1) {
fprintf(f, " const VALUE *argv = &stack[%d];\n", stack_size - 1);
}
else {
fprintf(f, " const unsigned int lnum = GET_ISEQ()->body->local_table_size;\n");
fprintf(f, " const VALUE *argv = GET_EP() - lnum - VM_ENV_DATA_SIZE + 1 + %ld;\n", index);
}
fprintf(f, " func f = (func)%"PRIuVALUE"; /* == rb_ary_shuffle_bang */\n", (VALUE)rb_ary_shuffle_bang);
fprintf(f, " val = f(ec, self, argv[0]);\n");
}
static void
mjit_compile_invokebuiltin_for_rb_ary_shuffle(FILE *f, long index, unsigned stack_size, bool inlinable_p)
{
fprintf(f, " VALUE self = GET_SELF();\n");
fprintf(f, " typedef VALUE (*func)(rb_execution_context_t *, VALUE, VALUE);\n");
if (index == -1) {
fprintf(f, " const VALUE *argv = &stack[%d];\n", stack_size - 1);
}
else {
fprintf(f, " const unsigned int lnum = GET_ISEQ()->body->local_table_size;\n");
fprintf(f, " const VALUE *argv = GET_EP() - lnum - VM_ENV_DATA_SIZE + 1 + %ld;\n", index);
}
fprintf(f, " func f = (func)%"PRIuVALUE"; /* == rb_ary_shuffle */\n", (VALUE)rb_ary_shuffle);
fprintf(f, " val = f(ec, self, argv[0]);\n");
}
static void
mjit_compile_invokebuiltin_for_ary_sample0(FILE *f, long index, unsigned stack_size, bool inlinable_p)
{
fprintf(f, " VALUE self = GET_SELF();\n");
fprintf(f, " typedef VALUE (*func)(rb_execution_context_t *, VALUE);\n");
fprintf(f, " func f = (func)%"PRIuVALUE"; /* == ary_sample0 */\n", (VALUE)ary_sample0);
fprintf(f, " val = f(ec, self);\n");
}
static void
mjit_compile_invokebuiltin_for_ary_sample(FILE *f, long index, unsigned stack_size, bool inlinable_p)
{
fprintf(f, " VALUE self = GET_SELF();\n");
fprintf(f, " typedef VALUE (*func)(rb_execution_context_t *, VALUE, VALUE, VALUE, VALUE);\n");
if (index == -1) {
fprintf(f, " const VALUE *argv = &stack[%d];\n", stack_size - 3);
}
else {
fprintf(f, " const unsigned int lnum = GET_ISEQ()->body->local_table_size;\n");
fprintf(f, " const VALUE *argv = GET_EP() - lnum - VM_ENV_DATA_SIZE + 1 + %ld;\n", index);
}
fprintf(f, " func f = (func)%"PRIuVALUE"; /* == ary_sample */\n", (VALUE)ary_sample);
fprintf(f, " val = f(ec, self, argv[0], argv[1], argv[2]);\n");
}
void Init_builtin_array(void)
{
// table definition
static const struct rb_builtin_function array_table[] = {
RB_BUILTIN_FUNCTION(0, rb_ary_shuffle_bang, rb_ary_shuffle_bang, 1, mjit_compile_invokebuiltin_for_rb_ary_shuffle_bang),
RB_BUILTIN_FUNCTION(1, rb_ary_shuffle, rb_ary_shuffle, 1, mjit_compile_invokebuiltin_for_rb_ary_shuffle),
RB_BUILTIN_FUNCTION(2, ary_sample0, ary_sample0, 0, mjit_compile_invokebuiltin_for_ary_sample0),
RB_BUILTIN_FUNCTION(3, ary_sample, ary_sample, 3, mjit_compile_invokebuiltin_for_ary_sample),
RB_BUILTIN_FUNCTION(-1, NULL, NULL, 0, 0),
};
// arity_check
COMPILER_WARNING_PUSH
#if GCC_VERSION_SINCE(5, 1, 0) || defined __clang__
COMPILER_WARNING_ERROR(-Wincompatible-pointer-types)
#endif
if (0) rb_builtin_function_check_arity1(rb_ary_shuffle_bang);
if (0) rb_builtin_function_check_arity1(rb_ary_shuffle);
if (0) rb_builtin_function_check_arity0(ary_sample0);
if (0) rb_builtin_function_check_arity3(ary_sample);
COMPILER_WARNING_POP
// load
rb_load_with_builtin_functions("array", array_table);
}
|