Please sign in to comment.
Fix block migration in thunk gen; skids++ for the assist
Phixes #1212 Fixes RT#130575: https://rt.perl.org/Ticket/Display.html?id=130575 Fixes RT#132337: https://rt.perl.org/Ticket/Display.html?id=132337 Fixes RT#131548: https://rt.perl.org/Ticket/Display.html?id=131548 Fixes RT#132211: https://rt.perl.org/Ticket/Display.html?id=132211 Fixes RT#126569: https://rt.perl.org/Ticket/Display.html?id=126569 Fixes RT#128054: https://rt.perl.org/Ticket/Display.html?id=128054 Fixes RT#126413: https://rt.perl.org/Ticket/Display.html?id=126413 Fixes RT#126984: https://rt.perl.org/Ticket/Display.html?id=126984 Fixes RT#132172: https://rt.perl.org/Ticket/Display.html?id=132172 All of the bugs in the tickets are caused by mis-scoped blocks resulting in p6capturelex failing to set outers correctly, and thus resulting in issues with updating of values in lexicals. The mis-scoping occurs during migration of blocks when we're generating thunks with causes being one or several of: 1) WhateverCode QAST missing `statement_id` annotation, resuling in migration predicate being false, and thus not migrating the QAST 2) andthen/notandthen/orelse thunks being nested into one another instead of being alongside each other, as these operators aren't chained and instead are called with all the thunks present in a single operator call 3) Missing truthy `in_stmt_mod` annotation on first argument of the andthen/notandthen/orelse calls. These aren't thunked for the operator call, but they can have thunks due to other constructs present in them, so they need the annotation for proper migration 4) Present truthy `in_stmt_mod` annotation on non-first arguments of the andthen/notandthen/orelse calls. This occurs when we have one of these operators as a conditional in one of the statement modifiers. Mis-migration occurs because despite being in non-first argument of the operator, the migrator still thinks we're directly in statement modifier code 5) We can have sub-staments within our thunks that get an increased statement ID, but the migrator only migrates blocks with the same statement ID as the thunk itself, missing substatements Fix all the issues with: - Add `statement_id` annotation to WhateverCode QAST - Annotate andthen/notandthen/orelse thunks and make migrator skip them, which avoids unwanted nesting - Specially annotate first argument of andthen/notandthen/orelse ops with `in_stmt_mod_andnotelse` annotation to ensure we migrate any thunks inside appropriately. We can't just re-use `in_stmt_mod` annotation here, since we need to address cause (4) above as well, so we have two separate annotations and a somewhat convoluted migrator condition that covers all the cases - Look for statement IDs equal to *or greater* than our thunk. This ensures all substatement inside our thunk get migrated right, as only blocks that have greater ID than us at this point in time would all be from within our thunk.
- Loading branch information...