Skip to content

Commit

Permalink
Fix thread safety of "foo{$x}bar"
Browse files Browse the repository at this point in the history
Previously, we didn't do a closure clone of the block, which meant it
could get its outer captured by a different thread (or go very wrong
if a recursive call was done inside of the closure). Doing this clone
corrects the bug, and brings it in line with other closures, though
does cause a change to `state` inside such as block (again, bringing
it in line with how things usually work, though there was a spectest
based around the previous wrong expectation).
  • Loading branch information
jnthn committed Sep 6, 2017
1 parent d0d105b commit 59454b0
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/Perl6/Actions.nqp
Expand Up @@ -9694,10 +9694,9 @@ class Perl6::QActions is HLL::Actions does STDActions {
$blast.annotate('past_block', WANTALL($blast.ann('past_block'),'escape{}'));
make QAST::Op.new(
:op('callmethod'), :name('Stringy'),
WANTED(QAST::Op.new(
:op('call'),
QAST::Op.new( :op('p6capturelex'), $blast ),
:node($/)), 'escape{}'));
WANTED(
QAST::Op.new( :op('call'), block_closure($blast), :node($/) ),
'escape{}'));
}

# The next three are currently only used for tr///.
Expand Down

0 comments on commit 59454b0

Please sign in to comment.