[ruby-cvs:73135] k0kubun:r66035 (trunk): mjit_worker.c: promote mjit_copy_job from function

k0kubun at ruby-lang.org k0kubun at ruby-lang.org
Tue Nov 27 21:00:51 JST 2018


k0kubun	2018-11-27 21:00:51 +0900 (Tue, 27 Nov 2018)

  New Revision: 66035

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=66035

  Log:
    mjit_worker.c: promote mjit_copy_job from function
    
    -local variable to global variable.
    
    Consider this case:
    1. MJIT worker: dequeue ISeq (stop_worker_p was still FALSE)
    2. Ruby thread: call Kernel#exec, which calls mjit_finish(FALSE),
                    sets `stop_worker_p = TRUE`, and fires RUBY_VM_CHECK_INTS() once
    3. MJIT worker: register copy job, but found stop_worker_p is TRUE.
                    set `worker_stopped = TRUE` and the thread stops.
    4. Function-local job variable expires by the thread stop (this is eliminated by this commit)
    5. Ruby thread: find `worker_stopped` becamse TRUE, start Kernel#exec.
                    Kernel#exec fails but exception is rescued.
    6. Ruby thread: call RUBY_VM_CHECK_INTS. copy job is dispatched but job variable
                    is already expired.

  Modified files:
    trunk/mjit.c
    trunk/mjit_worker.c


More information about the ruby-cvs mailing list