mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	drop-in type check for rb_define_singleton_method
We can check the function pointer passed to rb_define_singleton_method like how we do so in rb_define_method. Doing so revealed many arity mismatches.
This commit is contained in:
		
							parent
							
								
									bfe5d22f89
								
							
						
					
					
						commit
						3df37259d8
					
				
					 16 changed files with 270 additions and 151 deletions
				
			
		
							
								
								
									
										3
									
								
								class.c
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								class.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1746,6 +1746,9 @@ rb_singleton_class(VALUE obj)
 | 
			
		|||
 * \{
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifdef rb_define_singleton_method
 | 
			
		||||
#undef rb_define_singleton_method
 | 
			
		||||
#endif
 | 
			
		||||
/*!
 | 
			
		||||
 * Defines a singleton method for \a obj.
 | 
			
		||||
 * \param obj    an arbitrary object
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								eval.c
									
										
									
									
									
								
							
							
						
						
									
										4
									
								
								eval.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -355,7 +355,7 @@ ruby_exec_node(void *n)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_mod_nesting(void)
 | 
			
		||||
rb_mod_nesting(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE ary = rb_ary_new();
 | 
			
		||||
    const rb_cref_t *cref = rb_vm_cref();
 | 
			
		||||
| 
						 | 
				
			
			@ -1614,7 +1614,7 @@ used_modules_i(VALUE _, VALUE mod, VALUE ary)
 | 
			
		|||
 *     [B, A]
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_mod_s_used_modules(void)
 | 
			
		||||
rb_mod_s_used_modules(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    const rb_cref_t *cref = rb_vm_cref();
 | 
			
		||||
    VALUE ary = rb_ary_new();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1382,7 +1382,7 @@ readline_s_set_basic_word_break_characters(VALUE self, VALUE str)
 | 
			
		|||
 * Raises NotImplementedError if the using readline library does not support.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
readline_s_get_basic_word_break_characters(VALUE self, VALUE str)
 | 
			
		||||
readline_s_get_basic_word_break_characters(VALUE self)
 | 
			
		||||
{
 | 
			
		||||
    if (rl_basic_word_break_characters == NULL)
 | 
			
		||||
        return Qnil;
 | 
			
		||||
| 
						 | 
				
			
			@ -1437,7 +1437,7 @@ readline_s_set_completer_word_break_characters(VALUE self, VALUE str)
 | 
			
		|||
 * Raises NotImplementedError if the using readline library does not support.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
readline_s_get_completer_word_break_characters(VALUE self, VALUE str)
 | 
			
		||||
readline_s_get_completer_word_break_characters(VALUE self)
 | 
			
		||||
{
 | 
			
		||||
    if (rl_completer_word_break_characters == NULL)
 | 
			
		||||
        return Qnil;
 | 
			
		||||
| 
						 | 
				
			
			@ -1552,7 +1552,7 @@ readline_s_set_basic_quote_characters(VALUE self, VALUE str)
 | 
			
		|||
 * Raises NotImplementedError if the using readline library does not support.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
readline_s_get_basic_quote_characters(VALUE self, VALUE str)
 | 
			
		||||
readline_s_get_basic_quote_characters(VALUE self)
 | 
			
		||||
{
 | 
			
		||||
    if (rl_basic_quote_characters == NULL)
 | 
			
		||||
        return Qnil;
 | 
			
		||||
| 
						 | 
				
			
			@ -1608,7 +1608,7 @@ readline_s_set_completer_quote_characters(VALUE self, VALUE str)
 | 
			
		|||
 * Raises NotImplementedError if the using readline library does not support.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
readline_s_get_completer_quote_characters(VALUE self, VALUE str)
 | 
			
		||||
readline_s_get_completer_quote_characters(VALUE self)
 | 
			
		||||
{
 | 
			
		||||
    if (rl_completer_quote_characters == NULL)
 | 
			
		||||
        return Qnil;
 | 
			
		||||
| 
						 | 
				
			
			@ -1662,7 +1662,7 @@ readline_s_set_filename_quote_characters(VALUE self, VALUE str)
 | 
			
		|||
 * Raises NotImplementedError if the using readline library does not support.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
readline_s_get_filename_quote_characters(VALUE self, VALUE str)
 | 
			
		||||
readline_s_get_filename_quote_characters(VALUE self)
 | 
			
		||||
{
 | 
			
		||||
    if (rl_filename_quote_characters == NULL)
 | 
			
		||||
        return Qnil;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -672,7 +672,7 @@ bsock_recv_nonblock(VALUE sock, VALUE len, VALUE flg, VALUE str, VALUE ex)
 | 
			
		|||
 *   BasicSocket.do_not_reverse_lookup  #=> false
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
bsock_do_not_rev_lookup(void)
 | 
			
		||||
bsock_do_not_rev_lookup(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return rsock_do_not_reverse_lookup?Qtrue:Qfalse;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1042,7 +1042,7 @@ sock_s_gethostbyname(VALUE obj, VALUE host)
 | 
			
		|||
 *
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
sock_s_gethostbyaddr(int argc, VALUE *argv)
 | 
			
		||||
sock_s_gethostbyaddr(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE addr, family;
 | 
			
		||||
    struct hostent *h;
 | 
			
		||||
| 
						 | 
				
			
			@ -1104,7 +1104,7 @@ sock_s_gethostbyaddr(int argc, VALUE *argv)
 | 
			
		|||
 *   Socket.getservbyname("syslog", "udp") #=> 514
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
sock_s_getservbyname(int argc, VALUE *argv)
 | 
			
		||||
sock_s_getservbyname(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE service, proto;
 | 
			
		||||
    struct servent *sp;
 | 
			
		||||
| 
						 | 
				
			
			@ -1145,7 +1145,7 @@ sock_s_getservbyname(int argc, VALUE *argv)
 | 
			
		|||
 *
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
sock_s_getservbyport(int argc, VALUE *argv)
 | 
			
		||||
sock_s_getservbyport(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE port, proto;
 | 
			
		||||
    struct servent *sp;
 | 
			
		||||
| 
						 | 
				
			
			@ -1203,7 +1203,7 @@ sock_s_getservbyport(int argc, VALUE *argv)
 | 
			
		|||
 * If Addrinfo object is preferred, use Addrinfo.getaddrinfo.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
sock_s_getaddrinfo(int argc, VALUE *argv)
 | 
			
		||||
sock_s_getaddrinfo(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE host, port, family, socktype, protocol, flags, ret, revlookup;
 | 
			
		||||
    struct addrinfo hints;
 | 
			
		||||
| 
						 | 
				
			
			@ -1257,7 +1257,7 @@ sock_s_getaddrinfo(int argc, VALUE *argv)
 | 
			
		|||
 * If Addrinfo object is preferred, use Addrinfo#getnameinfo.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
sock_s_getnameinfo(int argc, VALUE *argv)
 | 
			
		||||
sock_s_getnameinfo(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE sa, af = Qnil, host = Qnil, port = Qnil, flags, tmp;
 | 
			
		||||
    char *hptr, *pptr;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										52
									
								
								file.c
									
										
									
									
									
								
							
							
						
						
									
										52
									
								
								file.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2538,7 +2538,7 @@ chmod_internal(const char *path, void *mode)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_file_s_chmod(int argc, VALUE *argv)
 | 
			
		||||
rb_file_s_chmod(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    mode_t mode;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2610,7 +2610,7 @@ lchmod_internal(const char *path, void *mode)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_file_s_lchmod(int argc, VALUE *argv)
 | 
			
		||||
rb_file_s_lchmod(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    mode_t mode;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2669,7 +2669,7 @@ chown_internal(const char *path, void *arg)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_file_s_chown(int argc, VALUE *argv)
 | 
			
		||||
rb_file_s_chown(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    struct chown_args arg;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2741,7 +2741,7 @@ lchown_internal(const char *path, void *arg)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_file_s_lchown(int argc, VALUE *argv)
 | 
			
		||||
rb_file_s_lchown(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    struct chown_args arg;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2919,7 +2919,7 @@ utime_internal_i(int argc, VALUE *argv, int follow)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_file_s_utime(int argc, VALUE *argv)
 | 
			
		||||
rb_file_s_utime(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return utime_internal_i(argc, argv, FALSE);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -2938,7 +2938,7 @@ rb_file_s_utime(int argc, VALUE *argv)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_file_s_lutime(int argc, VALUE *argv)
 | 
			
		||||
rb_file_s_lutime(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return utime_internal_i(argc, argv, TRUE);
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -3217,7 +3217,7 @@ rb_file_s_rename(VALUE klass, VALUE from, VALUE to)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_file_s_umask(int argc, VALUE *argv)
 | 
			
		||||
rb_file_s_umask(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    mode_t omask = 0;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -4032,6 +4032,13 @@ rb_file_expand_path_fast(VALUE fname, VALUE dname)
 | 
			
		|||
    return expand_path(fname, dname, 0, 0, EXPAND_PATH_BUFFER());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_file_s_expand_path(int argc, const VALUE *argv)
 | 
			
		||||
{
 | 
			
		||||
    rb_check_arity(argc, 1, 2);
 | 
			
		||||
    return rb_file_expand_path(argv[0], argc > 1 ? argv[1] : Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *  call-seq:
 | 
			
		||||
 *     File.expand_path(file_name [, dir_string] )  ->  abs_file_name
 | 
			
		||||
| 
						 | 
				
			
			@ -4060,11 +4067,10 @@ rb_file_expand_path_fast(VALUE fname, VALUE dname)
 | 
			
		|||
 *  parent, the root of the project and appends +lib/mygem.rb+.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_file_s_expand_path(int argc, const VALUE *argv)
 | 
			
		||||
static VALUE
 | 
			
		||||
s_expand_path(int c, const VALUE * v, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    rb_check_arity(argc, 1, 2);
 | 
			
		||||
    return rb_file_expand_path(argv[0], argc > 1 ? argv[1] : Qnil);
 | 
			
		||||
    return rb_file_s_expand_path(c, v);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -4074,6 +4080,13 @@ rb_file_absolute_path(VALUE fname, VALUE dname)
 | 
			
		|||
    return expand_path(fname, dname, 1, 1, EXPAND_PATH_BUFFER());
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_file_s_absolute_path(int argc, const VALUE *argv)
 | 
			
		||||
{
 | 
			
		||||
    rb_check_arity(argc, 1, 2);
 | 
			
		||||
    return rb_file_absolute_path(argv[0], argc > 1 ? argv[1] : Qnil);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *  call-seq:
 | 
			
		||||
 *     File.absolute_path(file_name [, dir_string] )  ->  abs_file_name
 | 
			
		||||
| 
						 | 
				
			
			@ -4087,11 +4100,10 @@ rb_file_absolute_path(VALUE fname, VALUE dname)
 | 
			
		|||
 *     File.absolute_path("~oracle/bin")       #=> "<relative_path>/~oracle/bin"
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_file_s_absolute_path(int argc, const VALUE *argv)
 | 
			
		||||
static VALUE
 | 
			
		||||
s_absolute_path(int c, const VALUE * v, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    rb_check_arity(argc, 1, 2);
 | 
			
		||||
    return rb_file_absolute_path(argv[0], argc > 1 ? argv[1] : Qnil);
 | 
			
		||||
    return rb_file_s_absolute_path(c, v);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
enum rb_realpath_mode {
 | 
			
		||||
| 
						 | 
				
			
			@ -4556,7 +4568,7 @@ ruby_enc_find_basename(const char *name, long *baselen, long *alllen, rb_encodin
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_file_s_basename(int argc, VALUE *argv)
 | 
			
		||||
rb_file_s_basename(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE fname, fext, basename;
 | 
			
		||||
    const char *name, *p;
 | 
			
		||||
| 
						 | 
				
			
			@ -4800,7 +4812,7 @@ static VALUE
 | 
			
		|||
rb_file_s_split(VALUE klass, VALUE path)
 | 
			
		||||
{
 | 
			
		||||
    FilePathStringValue(path);		/* get rid of converting twice */
 | 
			
		||||
    return rb_assoc_new(rb_file_dirname(path), rb_file_s_basename(1,&path));
 | 
			
		||||
    return rb_assoc_new(rb_file_dirname(path), rb_file_s_basename(1,&path,Qundef));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -6032,7 +6044,7 @@ nogvl_mkfifo(void *ptr)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_file_s_mkfifo(int argc, VALUE *argv)
 | 
			
		||||
rb_file_s_mkfifo(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE path;
 | 
			
		||||
    struct mkfifo_arg ma;
 | 
			
		||||
| 
						 | 
				
			
			@ -6490,8 +6502,8 @@ Init_File(void)
 | 
			
		|||
    rb_define_singleton_method(rb_cFile, "umask", rb_file_s_umask, -1);
 | 
			
		||||
    rb_define_singleton_method(rb_cFile, "truncate", rb_file_s_truncate, 2);
 | 
			
		||||
    rb_define_singleton_method(rb_cFile, "mkfifo", rb_file_s_mkfifo, -1);
 | 
			
		||||
    rb_define_singleton_method(rb_cFile, "expand_path", rb_file_s_expand_path, -1);
 | 
			
		||||
    rb_define_singleton_method(rb_cFile, "absolute_path", rb_file_s_absolute_path, -1);
 | 
			
		||||
    rb_define_singleton_method(rb_cFile, "expand_path", s_expand_path, -1);
 | 
			
		||||
    rb_define_singleton_method(rb_cFile, "absolute_path", s_absolute_path, -1);
 | 
			
		||||
    rb_define_singleton_method(rb_cFile, "realpath", rb_file_s_realpath, -1);
 | 
			
		||||
    rb_define_singleton_method(rb_cFile, "realdirpath", rb_file_s_realdirpath, -1);
 | 
			
		||||
    rb_define_singleton_method(rb_cFile, "basename", rb_file_s_basename, -1);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										52
									
								
								gc.c
									
										
									
									
									
								
							
							
						
						
									
										52
									
								
								gc.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -9108,6 +9108,16 @@ gc_stress_set_m(VALUE self, VALUE flag)
 | 
			
		|||
    return flag;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_gc_enable(void)
 | 
			
		||||
{
 | 
			
		||||
    rb_objspace_t *objspace = &rb_objspace;
 | 
			
		||||
    int old = dont_gc;
 | 
			
		||||
 | 
			
		||||
    dont_gc = FALSE;
 | 
			
		||||
    return old ? Qtrue : Qfalse;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *  call-seq:
 | 
			
		||||
 *     GC.enable    -> true or false
 | 
			
		||||
| 
						 | 
				
			
			@ -9120,15 +9130,10 @@ gc_stress_set_m(VALUE self, VALUE flag)
 | 
			
		|||
 *     GC.enable    #=> false
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_gc_enable(void)
 | 
			
		||||
static VALUE
 | 
			
		||||
gc_enable(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    rb_objspace_t *objspace = &rb_objspace;
 | 
			
		||||
    int old = dont_gc;
 | 
			
		||||
 | 
			
		||||
    dont_gc = FALSE;
 | 
			
		||||
    return old ? Qtrue : Qfalse;
 | 
			
		||||
    return rb_gc_enable();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -9140,6 +9145,15 @@ rb_gc_disable_no_rest(void)
 | 
			
		|||
    return old ? Qtrue : Qfalse;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_gc_disable(void)
 | 
			
		||||
{
 | 
			
		||||
    rb_objspace_t *objspace = &rb_objspace;
 | 
			
		||||
    gc_rest(objspace);
 | 
			
		||||
    return rb_gc_disable_no_rest();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *  call-seq:
 | 
			
		||||
 *     GC.disable    -> true or false
 | 
			
		||||
| 
						 | 
				
			
			@ -9152,12 +9166,10 @@ rb_gc_disable_no_rest(void)
 | 
			
		|||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_gc_disable(void)
 | 
			
		||||
static VALUE
 | 
			
		||||
gc_disable(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    rb_objspace_t *objspace = &rb_objspace;
 | 
			
		||||
    gc_rest(objspace);
 | 
			
		||||
    return rb_gc_disable_no_rest();
 | 
			
		||||
    return rb_gc_disable();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int
 | 
			
		||||
| 
						 | 
				
			
			@ -10794,7 +10806,7 @@ gc_prof_set_heap_info(rb_objspace_t *objspace)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
gc_profile_clear(void)
 | 
			
		||||
gc_profile_clear(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    rb_objspace_t *objspace = &rb_objspace;
 | 
			
		||||
    void *p = objspace->profile.records;
 | 
			
		||||
| 
						 | 
				
			
			@ -10859,7 +10871,7 @@ gc_profile_clear(void)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
gc_profile_record_get(void)
 | 
			
		||||
gc_profile_record_get(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE prof;
 | 
			
		||||
    VALUE gc_profile = rb_ary_new();
 | 
			
		||||
| 
						 | 
				
			
			@ -11046,7 +11058,7 @@ gc_profile_dump_on(VALUE out, VALUE (*append)(VALUE, VALUE))
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
gc_profile_result(void)
 | 
			
		||||
gc_profile_result(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE str = rb_str_buf_new(0);
 | 
			
		||||
    gc_profile_dump_on(str, rb_str_buf_append);
 | 
			
		||||
| 
						 | 
				
			
			@ -11120,7 +11132,7 @@ gc_profile_enable_get(VALUE self)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
gc_profile_enable(void)
 | 
			
		||||
gc_profile_enable(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    rb_objspace_t *objspace = &rb_objspace;
 | 
			
		||||
    objspace->profile.run = TRUE;
 | 
			
		||||
| 
						 | 
				
			
			@ -11137,7 +11149,7 @@ gc_profile_enable(void)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
gc_profile_disable(void)
 | 
			
		||||
gc_profile_disable(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    rb_objspace_t *objspace = &rb_objspace;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -11669,8 +11681,8 @@ Init_GC(void)
 | 
			
		|||
 | 
			
		||||
    rb_mGC = rb_define_module("GC");
 | 
			
		||||
    rb_define_singleton_method(rb_mGC, "start", gc_start_internal, -1);
 | 
			
		||||
    rb_define_singleton_method(rb_mGC, "enable", rb_gc_enable, 0);
 | 
			
		||||
    rb_define_singleton_method(rb_mGC, "disable", rb_gc_disable, 0);
 | 
			
		||||
    rb_define_singleton_method(rb_mGC, "enable", gc_enable, 0);
 | 
			
		||||
    rb_define_singleton_method(rb_mGC, "disable", gc_disable, 0);
 | 
			
		||||
    rb_define_singleton_method(rb_mGC, "stress", gc_stress_get, 0);
 | 
			
		||||
    rb_define_singleton_method(rb_mGC, "stress=", gc_stress_set_m, 1);
 | 
			
		||||
    rb_define_singleton_method(rb_mGC, "count", gc_count, 0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										111
									
								
								hash.c
									
										
									
									
									
								
							
							
						
						
									
										111
									
								
								hash.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -4808,7 +4808,7 @@ rb_f_getenv(VALUE obj, VALUE name)
 | 
			
		|||
 * be returned when no block is given.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_fetch(int argc, VALUE *argv)
 | 
			
		||||
env_fetch(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE key;
 | 
			
		||||
    long block_given;
 | 
			
		||||
| 
						 | 
				
			
			@ -5138,12 +5138,6 @@ env_aset(VALUE nm, VALUE val)
 | 
			
		|||
    return val;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * call-seq:
 | 
			
		||||
 *   ENV.keys -> Array
 | 
			
		||||
 *
 | 
			
		||||
 * Returns every environment variable name in an Array
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_keys(void)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -5163,6 +5157,19 @@ env_keys(void)
 | 
			
		|||
    return ary;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * call-seq:
 | 
			
		||||
 *   ENV.keys -> Array
 | 
			
		||||
 *
 | 
			
		||||
 * Returns every environment variable name in an Array
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
env_f_keys(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return env_keys();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_env_size(VALUE ehash, VALUE args, VALUE eobj)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -5202,12 +5209,6 @@ env_each_key(VALUE ehash)
 | 
			
		|||
    return ehash;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * call-seq:
 | 
			
		||||
 *   ENV.values -> Array
 | 
			
		||||
 *
 | 
			
		||||
 * Returns every environment variable value as an Array
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_values(void)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -5227,6 +5228,19 @@ env_values(void)
 | 
			
		|||
    return ary;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * call-seq:
 | 
			
		||||
 *   ENV.values -> Array
 | 
			
		||||
 *
 | 
			
		||||
 * Returns every environment variable value as an Array
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
env_f_values(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return env_values();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * call-seq:
 | 
			
		||||
 *   ENV.each_value { |value| block } -> Hash
 | 
			
		||||
| 
						 | 
				
			
			@ -5354,7 +5368,7 @@ env_delete_if(VALUE ehash)
 | 
			
		|||
 * the given names.  See also ENV.select.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_values_at(int argc, VALUE *argv)
 | 
			
		||||
env_values_at(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE result;
 | 
			
		||||
    long i;
 | 
			
		||||
| 
						 | 
				
			
			@ -5465,7 +5479,7 @@ env_keep_if(VALUE ehash)
 | 
			
		|||
 *     ENV.slice("TERM","HOME")  #=> {"TERM"=>"xterm-256color", "HOME"=>"/Users/rhc"}
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_slice(int argc, VALUE *argv)
 | 
			
		||||
env_slice(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    int i;
 | 
			
		||||
    VALUE key, value, result;
 | 
			
		||||
| 
						 | 
				
			
			@ -5485,12 +5499,6 @@ env_slice(int argc, VALUE *argv)
 | 
			
		|||
    return result;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * call-seq:
 | 
			
		||||
 *   ENV.clear
 | 
			
		||||
 *
 | 
			
		||||
 * Removes every environment variable.
 | 
			
		||||
 */
 | 
			
		||||
VALUE
 | 
			
		||||
rb_env_clear(void)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -5508,6 +5516,18 @@ rb_env_clear(void)
 | 
			
		|||
    return envtbl;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * call-seq:
 | 
			
		||||
 *   ENV.clear
 | 
			
		||||
 *
 | 
			
		||||
 * Removes every environment variable.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_clear(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return rb_env_clear();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * call-seq:
 | 
			
		||||
 *   ENV.to_s -> "ENV"
 | 
			
		||||
| 
						 | 
				
			
			@ -5515,7 +5535,7 @@ rb_env_clear(void)
 | 
			
		|||
 * Returns "ENV"
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_to_s(void)
 | 
			
		||||
env_to_s(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return rb_usascii_str_new2("ENV");
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -5527,7 +5547,7 @@ env_to_s(void)
 | 
			
		|||
 * Returns the contents of the environment as a String.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_inspect(void)
 | 
			
		||||
env_inspect(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    char **env;
 | 
			
		||||
    VALUE str, i;
 | 
			
		||||
| 
						 | 
				
			
			@ -5566,7 +5586,7 @@ env_inspect(void)
 | 
			
		|||
 *
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_to_a(void)
 | 
			
		||||
env_to_a(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    char **env;
 | 
			
		||||
    VALUE ary;
 | 
			
		||||
| 
						 | 
				
			
			@ -5593,7 +5613,7 @@ env_to_a(void)
 | 
			
		|||
 * compatibility with Hash.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_none(void)
 | 
			
		||||
env_none(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return Qnil;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -5606,7 +5626,7 @@ env_none(void)
 | 
			
		|||
 * Returns the number of environment variables.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_size(void)
 | 
			
		||||
env_size(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    int i;
 | 
			
		||||
    char **env;
 | 
			
		||||
| 
						 | 
				
			
			@ -5625,7 +5645,7 @@ env_size(void)
 | 
			
		|||
 * Returns true when there are no environment variables
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_empty_p(void)
 | 
			
		||||
env_empty_p(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    char **env;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -5782,13 +5802,6 @@ env_index(VALUE dmy, VALUE value)
 | 
			
		|||
    return env_key(dmy, value);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * call-seq:
 | 
			
		||||
 *   ENV.to_hash -> hash
 | 
			
		||||
 *
 | 
			
		||||
 * Creates a hash with a copy of the environment variables.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_to_hash(void)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			@ -5809,6 +5822,20 @@ env_to_hash(void)
 | 
			
		|||
    return hash;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * call-seq:
 | 
			
		||||
 *   ENV.to_hash -> hash
 | 
			
		||||
 *
 | 
			
		||||
 * Creates a hash with a copy of the environment variables.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
env_f_to_hash(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return env_to_hash();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * call-seq:
 | 
			
		||||
 *   ENV.to_h                        -> hash
 | 
			
		||||
| 
						 | 
				
			
			@ -5818,7 +5845,7 @@ env_to_hash(void)
 | 
			
		|||
 *
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_to_h(void)
 | 
			
		||||
env_to_h(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE hash = env_to_hash();
 | 
			
		||||
    if (rb_block_given_p()) {
 | 
			
		||||
| 
						 | 
				
			
			@ -5836,7 +5863,7 @@ env_to_h(void)
 | 
			
		|||
 * environment.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_reject(void)
 | 
			
		||||
env_reject(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return rb_hash_delete_if(env_to_hash());
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -5863,7 +5890,7 @@ env_freeze(VALUE self)
 | 
			
		|||
 * an Array.  Returns +nil+ if when the environment is empty.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_shift(void)
 | 
			
		||||
env_shift(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    char **env;
 | 
			
		||||
    VALUE result = Qnil;
 | 
			
		||||
| 
						 | 
				
			
			@ -5890,7 +5917,7 @@ env_shift(void)
 | 
			
		|||
 * and values as names.
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
env_invert(void)
 | 
			
		||||
env_invert(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return rb_hash_invert(env_to_hash());
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -6203,7 +6230,7 @@ Init_Hash(void)
 | 
			
		|||
    rb_define_singleton_method(envtbl, "delete_if", env_delete_if, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "keep_if", env_keep_if, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "slice", env_slice, -1);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "clear", rb_env_clear, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "clear", env_clear, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "reject", env_reject, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "reject!", env_reject_bang, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "select", env_select, 0);
 | 
			
		||||
| 
						 | 
				
			
			@ -6225,8 +6252,8 @@ Init_Hash(void)
 | 
			
		|||
    rb_define_singleton_method(envtbl, "size", env_size, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "length", env_size, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "empty?", env_empty_p, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "keys", env_keys, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "values", env_values, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "keys", env_f_keys, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "values", env_f_values, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "values_at", env_values_at, -1);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "include?", env_has_key, 1);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "member?", env_has_key, 1);
 | 
			
		||||
| 
						 | 
				
			
			@ -6234,7 +6261,7 @@ Init_Hash(void)
 | 
			
		|||
    rb_define_singleton_method(envtbl, "has_value?", env_has_value, 1);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "key?", env_has_key, 1);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "value?", env_has_value, 1);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "to_hash", env_to_hash, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "to_hash", env_f_to_hash, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "to_h", env_to_h, 0);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "assoc", env_assoc, 1);
 | 
			
		||||
    rb_define_singleton_method(envtbl, "rassoc", env_rassoc, 1);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1127,6 +1127,47 @@ __attribute__((__unused__,__weakref__("rb_define_private_method"),__nonnull__(2,
 | 
			
		|||
#define rb_define_private_method_choose_prototypem2(n)    rb_define_method_if_constexpr((n)==-2,rb_define_private_methodm2,rb_define_private_method_choose_prototypem1(n))
 | 
			
		||||
#define rb_define_private_method_choose_prototypem3(n, f) rb_define_method_if_constexpr(rb_f_notimplement_p(f),rb_define_private_methodm3,rb_define_private_method_choose_prototypem2(n))
 | 
			
		||||
#define rb_define_private_method(klass, mid, func, arity) rb_define_private_method_choose_prototypem3((arity),(func))((klass),(mid),(func),(arity));
 | 
			
		||||
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_methodm3(VALUE,const char*,VALUE(*)(ANYARGS),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_methodm2(VALUE,const char*,VALUE(*)(VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_methodm1(VALUE,const char*,VALUE(*)(int,union __attribute__((__transparent_union__)){VALUE*x;const VALUE*y;},VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method0 (VALUE,const char*,VALUE(*)(VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method1 (VALUE,const char*,VALUE(*)(VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method2 (VALUE,const char*,VALUE(*)(VALUE,VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method3 (VALUE,const char*,VALUE(*)(VALUE,VALUE,VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method4 (VALUE,const char*,VALUE(*)(VALUE,VALUE,VALUE,VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method5 (VALUE,const char*,VALUE(*)(VALUE,VALUE,VALUE,VALUE,VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method6 (VALUE,const char*,VALUE(*)(VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method7 (VALUE,const char*,VALUE(*)(VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method8 (VALUE,const char*,VALUE(*)(VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method9 (VALUE,const char*,VALUE(*)(VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method10(VALUE,const char*,VALUE(*)(VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method11(VALUE,const char*,VALUE(*)(VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method12(VALUE,const char*,VALUE(*)(VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method13(VALUE,const char*,VALUE(*)(VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method14(VALUE,const char*,VALUE(*)(VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE),int);
 | 
			
		||||
__attribute__((__unused__,__weakref__("rb_define_singleton_method"),__nonnull__(2,3)))static void rb_define_singleton_method15(VALUE,const char*,VALUE(*)(VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE,VALUE),int);
 | 
			
		||||
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype15(n)    rb_define_method_if_constexpr((n)==15,rb_define_singleton_method15,rb_define_singleton_methodm3)
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype14(n)    rb_define_method_if_constexpr((n)==14,rb_define_singleton_method14,rb_define_singleton_method_choose_prototype15(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype13(n)    rb_define_method_if_constexpr((n)==13,rb_define_singleton_method13,rb_define_singleton_method_choose_prototype14(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype12(n)    rb_define_method_if_constexpr((n)==12,rb_define_singleton_method12,rb_define_singleton_method_choose_prototype13(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype11(n)    rb_define_method_if_constexpr((n)==11,rb_define_singleton_method11,rb_define_singleton_method_choose_prototype12(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype10(n)    rb_define_method_if_constexpr((n)==10,rb_define_singleton_method10,rb_define_singleton_method_choose_prototype11(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype9(n)     rb_define_method_if_constexpr((n)== 9,rb_define_singleton_method9, rb_define_singleton_method_choose_prototype10(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype8(n)     rb_define_method_if_constexpr((n)== 8,rb_define_singleton_method8, rb_define_singleton_method_choose_prototype9(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype7(n)     rb_define_method_if_constexpr((n)== 7,rb_define_singleton_method7, rb_define_singleton_method_choose_prototype8(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype6(n)     rb_define_method_if_constexpr((n)== 6,rb_define_singleton_method6, rb_define_singleton_method_choose_prototype7(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype5(n)     rb_define_method_if_constexpr((n)== 5,rb_define_singleton_method5, rb_define_singleton_method_choose_prototype6(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype4(n)     rb_define_method_if_constexpr((n)== 4,rb_define_singleton_method4, rb_define_singleton_method_choose_prototype5(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype3(n)     rb_define_method_if_constexpr((n)== 3,rb_define_singleton_method3, rb_define_singleton_method_choose_prototype4(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype2(n)     rb_define_method_if_constexpr((n)== 2,rb_define_singleton_method2, rb_define_singleton_method_choose_prototype3(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype1(n)     rb_define_method_if_constexpr((n)== 1,rb_define_singleton_method1, rb_define_singleton_method_choose_prototype2(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototype0(n)     rb_define_method_if_constexpr((n)== 0,rb_define_singleton_method0, rb_define_singleton_method_choose_prototype1(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototypem1(n)    rb_define_method_if_constexpr((n)==-1,rb_define_singleton_methodm1,rb_define_singleton_method_choose_prototype0(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototypem2(n)    rb_define_method_if_constexpr((n)==-2,rb_define_singleton_methodm2,rb_define_singleton_method_choose_prototypem1(n))
 | 
			
		||||
#define rb_define_singleton_method_choose_prototypem3(n, f) rb_define_method_if_constexpr(rb_f_notimplement_p(f),rb_define_singleton_methodm3,rb_define_singleton_method_choose_prototypem2(n))
 | 
			
		||||
#define rb_define_singleton_method(klass, mid, func, arity) rb_define_singleton_method_choose_prototypem3((arity),(func))((klass),(mid),(func),(arity));
 | 
			
		||||
#endif
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								io.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								io.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -7042,7 +7042,7 @@ rb_io_s_open(int argc, VALUE *argv, VALUE klass)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_io_s_sysopen(int argc, VALUE *argv)
 | 
			
		||||
rb_io_s_sysopen(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE fname, vmode, vperm;
 | 
			
		||||
    VALUE intmode;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								random.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								random.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -93,14 +93,14 @@ typedef struct {
 | 
			
		|||
static rb_random_t default_rand;
 | 
			
		||||
 | 
			
		||||
static VALUE rand_init(struct MT *mt, VALUE vseed);
 | 
			
		||||
static VALUE random_seed(void);
 | 
			
		||||
static VALUE random_seed(VALUE);
 | 
			
		||||
 | 
			
		||||
static rb_random_t *
 | 
			
		||||
rand_start(rb_random_t *r)
 | 
			
		||||
{
 | 
			
		||||
    struct MT *mt = &r->mt;
 | 
			
		||||
    if (!genrand_initialized(mt)) {
 | 
			
		||||
	r->seed = rand_init(mt, random_seed());
 | 
			
		||||
        r->seed = rand_init(mt, random_seed(Qundef));
 | 
			
		||||
    }
 | 
			
		||||
    return r;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -261,7 +261,7 @@ random_init(int argc, VALUE *argv, VALUE obj)
 | 
			
		|||
 | 
			
		||||
    if (rb_check_arity(argc, 0, 1) == 0) {
 | 
			
		||||
	rb_check_frozen(obj);
 | 
			
		||||
	vseed = random_seed();
 | 
			
		||||
        vseed = random_seed(obj);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
	vseed = argv[0];
 | 
			
		||||
| 
						 | 
				
			
			@ -498,7 +498,7 @@ make_seed_value(uint32_t *ptr, size_t len)
 | 
			
		|||
 *   Random.new_seed  #=> 115032730400174366788466674494640623225
 | 
			
		||||
 */
 | 
			
		||||
static VALUE
 | 
			
		||||
random_seed(void)
 | 
			
		||||
random_seed(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE v;
 | 
			
		||||
    uint32_t buf[DEFAULT_SEED_CNT+1];
 | 
			
		||||
| 
						 | 
				
			
			@ -691,7 +691,7 @@ rb_f_srand(int argc, VALUE *argv, VALUE obj)
 | 
			
		|||
    rb_random_t *r = &default_rand;
 | 
			
		||||
 | 
			
		||||
    if (rb_check_arity(argc, 0, 1) == 0) {
 | 
			
		||||
	seed = random_seed();
 | 
			
		||||
        seed = random_seed(obj);
 | 
			
		||||
    }
 | 
			
		||||
    else {
 | 
			
		||||
	seed = rb_to_int(argv[0]);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										2
									
								
								re.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								re.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -3998,7 +3998,7 @@ match_setter(VALUE val, ID _x, VALUE *_y)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_reg_s_last_match(int argc, VALUE *argv)
 | 
			
		||||
rb_reg_s_last_match(int argc, VALUE *argv, VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    if (rb_check_arity(argc, 0, 1) == 1) {
 | 
			
		||||
        VALUE match = rb_backref_get();
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										24
									
								
								string.c
									
										
									
									
									
								
							
							
						
						
									
										24
									
								
								string.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -11196,6 +11196,28 @@ rb_to_symbol(VALUE name)
 | 
			
		|||
    return rb_str_intern(name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *  call-seq:
 | 
			
		||||
 *     Symbol.all_symbols    => array
 | 
			
		||||
 *
 | 
			
		||||
 *  Returns an array of all the symbols currently in Ruby's symbol
 | 
			
		||||
 *  table.
 | 
			
		||||
 *
 | 
			
		||||
 *     Symbol.all_symbols.size    #=> 903
 | 
			
		||||
 *     Symbol.all_symbols[1,20]   #=> [:floor, :ARGV, :Binding, :symlink,
 | 
			
		||||
 *                                     :chown, :EOFError, :$;, :String,
 | 
			
		||||
 *                                     :LOCK_SH, :"setuid?", :$<,
 | 
			
		||||
 *                                     :default_proc, :compact, :extend,
 | 
			
		||||
 *                                     :Tms, :getwd, :$=, :ThreadGroup,
 | 
			
		||||
 *                                     :wait2, :$>]
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
sym_all_symbols(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return rb_sym_all_symbols();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *  A String object holds and manipulates an arbitrary sequence of
 | 
			
		||||
 *  bytes, typically representing characters. String objects may be created
 | 
			
		||||
| 
						 | 
				
			
			@ -11382,7 +11404,7 @@ Init_String(void)
 | 
			
		|||
    rb_include_module(rb_cSymbol, rb_mComparable);
 | 
			
		||||
    rb_undef_alloc_func(rb_cSymbol);
 | 
			
		||||
    rb_undef_method(CLASS_OF(rb_cSymbol), "new");
 | 
			
		||||
    rb_define_singleton_method(rb_cSymbol, "all_symbols", rb_sym_all_symbols, 0); /* in symbol.c */
 | 
			
		||||
    rb_define_singleton_method(rb_cSymbol, "all_symbols", sym_all_symbols, 0);
 | 
			
		||||
 | 
			
		||||
    rb_define_method(rb_cSymbol, "==", sym_equal, 1);
 | 
			
		||||
    rb_define_method(rb_cSymbol, "===", sym_equal, 1);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										16
									
								
								symbol.c
									
										
									
									
									
								
							
							
						
						
									
										16
									
								
								symbol.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -843,22 +843,6 @@ symbols_i(st_data_t key, st_data_t value, st_data_t arg)
 | 
			
		|||
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *  call-seq:
 | 
			
		||||
 *     Symbol.all_symbols    => array
 | 
			
		||||
 *
 | 
			
		||||
 *  Returns an array of all the symbols currently in Ruby's symbol
 | 
			
		||||
 *  table.
 | 
			
		||||
 *
 | 
			
		||||
 *     Symbol.all_symbols.size    #=> 903
 | 
			
		||||
 *     Symbol.all_symbols[1,20]   #=> [:floor, :ARGV, :Binding, :symlink,
 | 
			
		||||
 *                                     :chown, :EOFError, :$;, :String,
 | 
			
		||||
 *                                     :LOCK_SH, :"setuid?", :$<,
 | 
			
		||||
 *                                     :default_proc, :compact, :extend,
 | 
			
		||||
 *                                     :Tms, :getwd, :$=, :ThreadGroup,
 | 
			
		||||
 *                                     :wait2, :$>]
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_sym_all_symbols(void)
 | 
			
		||||
{
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										72
									
								
								thread.c
									
										
									
									
									
								
							
							
						
						
									
										72
									
								
								thread.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2494,7 +2494,7 @@ rb_thread_s_kill(VALUE obj, VALUE th)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_thread_exit(void)
 | 
			
		||||
rb_thread_exit(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    rb_thread_t *th = GET_THREAD();
 | 
			
		||||
    return rb_thread_kill(th->self);
 | 
			
		||||
| 
						 | 
				
			
			@ -2573,6 +2573,17 @@ rb_thread_run(VALUE thread)
 | 
			
		|||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_thread_stop(void)
 | 
			
		||||
{
 | 
			
		||||
    if (rb_thread_alone()) {
 | 
			
		||||
        rb_raise(rb_eThreadError,
 | 
			
		||||
                 "stopping only thread\n\tnote: use sleep to stop forever");
 | 
			
		||||
    }
 | 
			
		||||
    rb_thread_sleep_deadly();
 | 
			
		||||
    return Qnil;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *  call-seq:
 | 
			
		||||
 *     Thread.stop   -> nil
 | 
			
		||||
| 
						 | 
				
			
			@ -2588,19 +2599,34 @@ rb_thread_run(VALUE thread)
 | 
			
		|||
 *     #=> "abc"
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_thread_stop(void)
 | 
			
		||||
static VALUE
 | 
			
		||||
thread_stop(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    if (rb_thread_alone()) {
 | 
			
		||||
	rb_raise(rb_eThreadError,
 | 
			
		||||
		 "stopping only thread\n\tnote: use sleep to stop forever");
 | 
			
		||||
    }
 | 
			
		||||
    rb_thread_sleep_deadly();
 | 
			
		||||
    return Qnil;
 | 
			
		||||
    return rb_thread_stop();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/********************************************************************/
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_thread_list(void)
 | 
			
		||||
{
 | 
			
		||||
    VALUE ary = rb_ary_new();
 | 
			
		||||
    rb_vm_t *vm = GET_THREAD()->vm;
 | 
			
		||||
    rb_thread_t *th = 0;
 | 
			
		||||
 | 
			
		||||
    list_for_each(&vm->living_threads, th, vmlt_node) {
 | 
			
		||||
        switch (th->status) {
 | 
			
		||||
          case THREAD_RUNNABLE:
 | 
			
		||||
          case THREAD_STOPPED:
 | 
			
		||||
          case THREAD_STOPPED_FOREVER:
 | 
			
		||||
            rb_ary_push(ary, th->self);
 | 
			
		||||
          default:
 | 
			
		||||
            break;
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
    return ary;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 *  call-seq:
 | 
			
		||||
 *     Thread.list   -> array
 | 
			
		||||
| 
						 | 
				
			
			@ -2621,24 +2647,10 @@ rb_thread_stop(void)
 | 
			
		|||
 *     #<Thread:0x401bdf4c run>
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
rb_thread_list(void)
 | 
			
		||||
static VALUE
 | 
			
		||||
thread_list(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    VALUE ary = rb_ary_new();
 | 
			
		||||
    rb_vm_t *vm = GET_THREAD()->vm;
 | 
			
		||||
    rb_thread_t *th = 0;
 | 
			
		||||
 | 
			
		||||
    list_for_each(&vm->living_threads, th, vmlt_node) {
 | 
			
		||||
	switch (th->status) {
 | 
			
		||||
	  case THREAD_RUNNABLE:
 | 
			
		||||
	  case THREAD_STOPPED:
 | 
			
		||||
	  case THREAD_STOPPED_FOREVER:
 | 
			
		||||
	    rb_ary_push(ary, th->self);
 | 
			
		||||
	  default:
 | 
			
		||||
	    break;
 | 
			
		||||
	}
 | 
			
		||||
    }
 | 
			
		||||
    return ary;
 | 
			
		||||
    return rb_thread_list();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
VALUE
 | 
			
		||||
| 
						 | 
				
			
			@ -2703,7 +2715,7 @@ rb_thread_s_main(VALUE klass)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_thread_s_abort_exc(void)
 | 
			
		||||
rb_thread_s_abort_exc(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return GET_THREAD()->vm->thread_abort_on_exception ? Qtrue : Qfalse;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -2833,7 +2845,7 @@ rb_thread_abort_exc_set(VALUE thread, VALUE val)
 | 
			
		|||
 */
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
rb_thread_s_report_exc(void)
 | 
			
		||||
rb_thread_s_report_exc(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return GET_THREAD()->vm->thread_report_on_exception ? Qtrue : Qfalse;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -5132,11 +5144,11 @@ Init_Thread(void)
 | 
			
		|||
    rb_define_singleton_method(rb_cThread, "fork", thread_start, -2);
 | 
			
		||||
    rb_define_singleton_method(rb_cThread, "main", rb_thread_s_main, 0);
 | 
			
		||||
    rb_define_singleton_method(rb_cThread, "current", thread_s_current, 0);
 | 
			
		||||
    rb_define_singleton_method(rb_cThread, "stop", rb_thread_stop, 0);
 | 
			
		||||
    rb_define_singleton_method(rb_cThread, "stop", thread_stop, 0);
 | 
			
		||||
    rb_define_singleton_method(rb_cThread, "kill", rb_thread_s_kill, 1);
 | 
			
		||||
    rb_define_singleton_method(rb_cThread, "exit", rb_thread_exit, 0);
 | 
			
		||||
    rb_define_singleton_method(rb_cThread, "pass", thread_s_pass, 0);
 | 
			
		||||
    rb_define_singleton_method(rb_cThread, "list", rb_thread_list, 0);
 | 
			
		||||
    rb_define_singleton_method(rb_cThread, "list", thread_list, 0);
 | 
			
		||||
    rb_define_singleton_method(rb_cThread, "abort_on_exception", rb_thread_s_abort_exc, 0);
 | 
			
		||||
    rb_define_singleton_method(rb_cThread, "abort_on_exception=", rb_thread_s_abort_exc_set, 1);
 | 
			
		||||
    rb_define_singleton_method(rb_cThread, "report_on_exception", rb_thread_s_report_exc, 0);
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										10
									
								
								vm.c
									
										
									
									
									
								
							
							
						
						
									
										10
									
								
								vm.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2827,7 +2827,7 @@ core_hash_merge_kwd(VALUE hash, VALUE kw)
 | 
			
		|||
 | 
			
		||||
/* Returns true if JIT is enabled */
 | 
			
		||||
static VALUE
 | 
			
		||||
mjit_enabled_p(void)
 | 
			
		||||
mjit_enabled_p(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return mjit_enabled ? Qtrue : Qfalse;
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -2849,6 +2849,12 @@ mjit_pause_m(int argc, VALUE *argv, RB_UNUSED_VAR(VALUE self))
 | 
			
		|||
    return mjit_pause(RTEST(wait));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
mjit_resume_m(VALUE _)
 | 
			
		||||
{
 | 
			
		||||
    return mjit_resume();
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern VALUE *rb_gc_stack_start;
 | 
			
		||||
extern size_t rb_gc_stack_maxsize;
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			@ -2974,7 +2980,7 @@ Init_VM(void)
 | 
			
		|||
    mjit = rb_define_module_under(rb_cRubyVM, "MJIT");
 | 
			
		||||
    rb_define_singleton_method(mjit, "enabled?", mjit_enabled_p, 0);
 | 
			
		||||
    rb_define_singleton_method(mjit, "pause", mjit_pause_m, -1);
 | 
			
		||||
    rb_define_singleton_method(mjit, "resume", mjit_resume, 0);
 | 
			
		||||
    rb_define_singleton_method(mjit, "resume", mjit_resume_m, 0);
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
     * Document-class: Thread
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue