mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	process.c: don't wait JIT queue flush on rb_f_exec
This wasn't intended in r64253. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64254 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
		
							parent
							
								
									212a77ed46
								
							
						
					
					
						commit
						2e003f6c87
					
				
					 4 changed files with 23 additions and 17 deletions
				
			
		| 
						 | 
				
			
			@ -1401,7 +1401,7 @@ VALUE rb_math_sqrt(VALUE);
 | 
			
		|||
 | 
			
		||||
/* mjit.c */
 | 
			
		||||
extern int mjit_enabled;
 | 
			
		||||
VALUE mjit_pause(int argc, VALUE *argv, VALUE recv);
 | 
			
		||||
VALUE mjit_pause(int wait_p);
 | 
			
		||||
VALUE mjit_resume(void);
 | 
			
		||||
 | 
			
		||||
/* newline.c */
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										17
									
								
								mjit.c
									
										
									
									
									
								
							
							
						
						
									
										17
									
								
								mjit.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -1782,19 +1782,8 @@ stop_worker(void)
 | 
			
		|||
 | 
			
		||||
/* Stop JIT-compiling methods but compiled code is kept available. */
 | 
			
		||||
VALUE
 | 
			
		||||
mjit_pause(int argc, VALUE *argv, RB_UNUSED_VAR(VALUE self))
 | 
			
		||||
mjit_pause(int wait_p)
 | 
			
		||||
{
 | 
			
		||||
    VALUE options = Qnil;
 | 
			
		||||
    VALUE wait = Qtrue;
 | 
			
		||||
    rb_scan_args(argc, argv, "0:", &options);
 | 
			
		||||
 | 
			
		||||
    if (!NIL_P(options)) {
 | 
			
		||||
        static ID keyword_ids[1];
 | 
			
		||||
        if (!keyword_ids[0])
 | 
			
		||||
            keyword_ids[0] = rb_intern("wait");
 | 
			
		||||
        rb_get_kwargs(options, keyword_ids, 0, 1, &wait);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    if (!mjit_enabled) {
 | 
			
		||||
        rb_raise(rb_eRuntimeError, "MJIT is not enabled");
 | 
			
		||||
    }
 | 
			
		||||
| 
						 | 
				
			
			@ -1802,8 +1791,8 @@ mjit_pause(int argc, VALUE *argv, RB_UNUSED_VAR(VALUE self))
 | 
			
		|||
        return Qfalse;
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    /* Flush all queued units with `wait: true` (default) */
 | 
			
		||||
    if (RTEST(wait)) {
 | 
			
		||||
    /* Flush all queued units with no option or `wait: true` */
 | 
			
		||||
    if (wait_p) {
 | 
			
		||||
        struct timeval tv;
 | 
			
		||||
        tv.tv_sec = 0;
 | 
			
		||||
        tv.tv_usec = 1000;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -2883,7 +2883,7 @@ rb_f_exec(int argc, const VALUE *argv)
 | 
			
		|||
 | 
			
		||||
    execarg_obj = rb_execarg_new(argc, argv, TRUE, FALSE);
 | 
			
		||||
    eargp = rb_execarg_get(execarg_obj);
 | 
			
		||||
    if (mjit_enabled) mjit_pause(0, NULL, Qnil); /* do not leak children */
 | 
			
		||||
    if (mjit_enabled) mjit_pause(FALSE); /* do not leak children */
 | 
			
		||||
    before_exec(); /* stop timer thread before redirects */
 | 
			
		||||
    rb_execarg_parent_start(execarg_obj);
 | 
			
		||||
    fail_str = eargp->use_shell ? eargp->invoke.sh.shell_script : eargp->invoke.cmd.command_name;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										19
									
								
								vm.c
									
										
									
									
									
								
							
							
						
						
									
										19
									
								
								vm.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -2770,6 +2770,23 @@ mjit_enabled_p(void)
 | 
			
		|||
    return mjit_enabled ? Qtrue : Qfalse;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static VALUE
 | 
			
		||||
mjit_pause_m(int argc, VALUE *argv, RB_UNUSED_VAR(VALUE self))
 | 
			
		||||
{
 | 
			
		||||
    VALUE options = Qnil;
 | 
			
		||||
    VALUE wait = Qtrue;
 | 
			
		||||
    rb_scan_args(argc, argv, "0:", &options);
 | 
			
		||||
 | 
			
		||||
    if (!NIL_P(options)) {
 | 
			
		||||
        static ID keyword_ids[1];
 | 
			
		||||
        if (!keyword_ids[0])
 | 
			
		||||
            keyword_ids[0] = rb_intern("wait");
 | 
			
		||||
        rb_get_kwargs(options, keyword_ids, 0, 1, &wait);
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
    return mjit_pause(RTEST(wait));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
extern VALUE *rb_gc_stack_start;
 | 
			
		||||
extern size_t rb_gc_stack_maxsize;
 | 
			
		||||
#ifdef __ia64
 | 
			
		||||
| 
						 | 
				
			
			@ -2858,7 +2875,7 @@ Init_VM(void)
 | 
			
		|||
    /* RubyVM::MJIT */
 | 
			
		||||
    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, -1);
 | 
			
		||||
    rb_define_singleton_method(mjit, "pause", mjit_pause_m, -1);
 | 
			
		||||
    rb_define_singleton_method(mjit, "resume", mjit_resume, 0);
 | 
			
		||||
 | 
			
		||||
    /*
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue