diff --git a/builtin.h b/builtin.h index 96339afdb5..b827b28928 100644 --- a/builtin.h +++ b/builtin.h @@ -33,28 +33,65 @@ typedef struct rb_execution_context_struct rb_execution_context_t; /* The following code is generated by the following Ruby script: +typedef = proc {|i, args| + "typedef VALUE (*rb_builtin_arity#{i}_function_type)(rb_execution_context_t *ec, VALUE self#{args});" +} +puts typedef[0, ""] +(1..15).each {|i| + puts typedef[i, ",\n " + (0...i).map{"VALUE"}.join(", ")] +} 16.times{|i| - args = (i > 0 ? ', ' : '') + (0...i).map{"VALUE"}.join(', ') - puts "static inline void rb_builtin_function_check_arity#{i}(VALUE (*f)(rb_execution_context_t *ec, VALUE self#{args})){}" + puts "static inline void rb_builtin_function_check_arity#{i}(rb_builtin_arity#{i}_function_type f){}" } */ -static inline void rb_builtin_function_check_arity0(VALUE (*f)(rb_execution_context_t *ec, VALUE self)){} -static inline void rb_builtin_function_check_arity1(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE)){} -static inline void rb_builtin_function_check_arity2(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE, VALUE)){} -static inline void rb_builtin_function_check_arity3(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE, VALUE, VALUE)){} -static inline void rb_builtin_function_check_arity4(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE, VALUE, VALUE, VALUE)){} -static inline void rb_builtin_function_check_arity5(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE, VALUE, VALUE, VALUE, VALUE)){} -static inline void rb_builtin_function_check_arity6(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)){} -static inline void rb_builtin_function_check_arity7(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)){} -static inline void rb_builtin_function_check_arity8(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)){} -static inline void rb_builtin_function_check_arity9(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)){} -static inline void rb_builtin_function_check_arity10(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)){} -static inline void rb_builtin_function_check_arity11(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)){} -static inline void rb_builtin_function_check_arity12(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)){} -static inline void rb_builtin_function_check_arity13(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)){} -static inline void rb_builtin_function_check_arity14(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)){} -static inline void rb_builtin_function_check_arity15(VALUE (*f)(rb_execution_context_t *ec, VALUE self, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE)){} +typedef VALUE (*rb_builtin_arity0_function_type)(rb_execution_context_t *ec, VALUE self); +typedef VALUE (*rb_builtin_arity1_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE); +typedef VALUE (*rb_builtin_arity2_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE, VALUE); +typedef VALUE (*rb_builtin_arity3_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE, VALUE, VALUE); +typedef VALUE (*rb_builtin_arity4_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE, VALUE, VALUE, VALUE); +typedef VALUE (*rb_builtin_arity5_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE, VALUE, VALUE, VALUE, VALUE); +typedef VALUE (*rb_builtin_arity6_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE, VALUE, VALUE, VALUE, VALUE, VALUE); +typedef VALUE (*rb_builtin_arity7_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE); +typedef VALUE (*rb_builtin_arity8_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE); +typedef VALUE (*rb_builtin_arity9_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE); +typedef VALUE (*rb_builtin_arity10_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE); +typedef VALUE (*rb_builtin_arity11_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE); +typedef VALUE (*rb_builtin_arity12_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE); +typedef VALUE (*rb_builtin_arity13_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE); +typedef VALUE (*rb_builtin_arity14_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE); +typedef VALUE (*rb_builtin_arity15_function_type)(rb_execution_context_t *ec, VALUE self, + VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE); +static inline void rb_builtin_function_check_arity0(rb_builtin_arity0_function_type f){} +static inline void rb_builtin_function_check_arity1(rb_builtin_arity1_function_type f){} +static inline void rb_builtin_function_check_arity2(rb_builtin_arity2_function_type f){} +static inline void rb_builtin_function_check_arity3(rb_builtin_arity3_function_type f){} +static inline void rb_builtin_function_check_arity4(rb_builtin_arity4_function_type f){} +static inline void rb_builtin_function_check_arity5(rb_builtin_arity5_function_type f){} +static inline void rb_builtin_function_check_arity6(rb_builtin_arity6_function_type f){} +static inline void rb_builtin_function_check_arity7(rb_builtin_arity7_function_type f){} +static inline void rb_builtin_function_check_arity8(rb_builtin_arity8_function_type f){} +static inline void rb_builtin_function_check_arity9(rb_builtin_arity9_function_type f){} +static inline void rb_builtin_function_check_arity10(rb_builtin_arity10_function_type f){} +static inline void rb_builtin_function_check_arity11(rb_builtin_arity11_function_type f){} +static inline void rb_builtin_function_check_arity12(rb_builtin_arity12_function_type f){} +static inline void rb_builtin_function_check_arity13(rb_builtin_arity13_function_type f){} +static inline void rb_builtin_function_check_arity14(rb_builtin_arity14_function_type f){} +static inline void rb_builtin_function_check_arity15(rb_builtin_arity15_function_type f){} PUREFUNC(VALUE rb_vm_lvar_exposed(rb_execution_context_t *ec, int index)); VALUE rb_vm_lvar_exposed(rb_execution_context_t *ec, int index); diff --git a/gc.c b/gc.c index 11121bc256..5bce7e1e25 100644 --- a/gc.c +++ b/gc.c @@ -10569,7 +10569,7 @@ gc_verify_compaction_references(rb_execution_context_t *ec, VALUE self, VALUE do return gc_compact_stats(self); } #else -# define gc_verify_compaction_references (VALUE (*)(rb_execution_context_t*, VALUE, VALUE, VALUE))rb_f_notimplement +# define gc_verify_compaction_references (rb_builtin_arity2_function_type)rb_f_notimplement #endif VALUE