mirror of
				https://github.com/ruby/ruby.git
				synced 2022-11-09 12:17:21 -05:00 
			
		
		
		
	Avoid hanging on --jit-wait after MJIT.pause
When a worker is stopped, nobody will JIT a method for you.
This commit is contained in:
		
							parent
							
								
									09ec8d6866
								
							
						
					
					
						commit
						4724bf856f
					
				
					 3 changed files with 12 additions and 1 deletions
				
			
		
							
								
								
									
										3
									
								
								mjit.c
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								mjit.c
									
										
									
									
									
								
							| 
						 | 
				
			
			@ -328,6 +328,9 @@ mjit_wait(struct rb_iseq_constant_body *body)
 | 
			
		|||
VALUE
 | 
			
		||||
rb_mjit_wait_call(rb_execution_context_t *ec, struct rb_iseq_constant_body *body)
 | 
			
		||||
{
 | 
			
		||||
    if (worker_stopped)
 | 
			
		||||
        return Qundef;
 | 
			
		||||
 | 
			
		||||
    mjit_wait(body);
 | 
			
		||||
    if ((uintptr_t)body->jit_func <= (uintptr_t)LAST_JIT_ISEQ_FUNC) {
 | 
			
		||||
        return Qundef;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -236,7 +236,7 @@ static int total_unloads = 0;
 | 
			
		|||
// Set to true to stop worker.
 | 
			
		||||
static bool stop_worker_p;
 | 
			
		||||
// Set to true if worker is stopped.
 | 
			
		||||
static bool worker_stopped;
 | 
			
		||||
static bool worker_stopped = true;
 | 
			
		||||
 | 
			
		||||
// Path of "/tmp", which can be changed to $TMP in MinGW.
 | 
			
		||||
static char *tmp_dir;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -1070,6 +1070,14 @@ class TestJIT < Test::Unit::TestCase
 | 
			
		|||
    end;
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_mjit_pause_wait
 | 
			
		||||
    assert_eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", stdout: '', success_count: 0, min_calls: 1)
 | 
			
		||||
    begin;
 | 
			
		||||
      RubyVM::MJIT.pause
 | 
			
		||||
      proc {}.call
 | 
			
		||||
    end;
 | 
			
		||||
  end
 | 
			
		||||
 | 
			
		||||
  def test_caller_locations_without_catch_table
 | 
			
		||||
    out, _ = eval_with_jit("#{<<~"begin;"}\n#{<<~"end;"}", min_calls: 1)
 | 
			
		||||
    begin;
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue