Bug #7461
closedBlock-level prologue and epilogue must stay prologue and epilogue when sequences are mixed
100%
Description
Block-level prologue and epilogue are destroyed when blocks are merged by a wrapping block.
First of all, they must remain atomic even if there is a muti-level nesting that does complex blending. Second, they must be always attached to the top and to the bottom of the sequence respectively. This will unsure that they will do proper initialization and finalization for sequences when they are mixed. This is needed to be able to mix self-contained sequences that required initialization and finalization.
E.g. the correct result of the code below must be as follows (now it gives a random mix):
// Global prologue starts // Global prologue ends // Root block prologue starts // Root block prologue ends // Sequence 1 prologue starts // Sequence 1 prologue ends // Sequence 2 prologue starts // Sequence 2 prologue ends and $4, $2, $15 sub $2, $15, $4 or $14, $14, $4 add $4, $22, $14 // Sequence 1 epilogue starts // Sequence 1 epilogue ends // Sequence 2 epilogue starts // Sequence 2 epilogue ends // Root block epilogue starts // Root block epilogue ends // Global epilogue starts // Global epilogue ends
Template code:
class PrologueEpilogueTemplate < MiniMipsBaseTemplate
def run
prologue {
pseudo '// Global prologue starts'
pseudo '// Global prologue ends'
}
epilogue {
pseudo '// Global epilogue starts'
pseudo '// Global epilogue ends'
}
block(combinator: 'diagonal', compositor: 'catenation', obfuscator: 'random') {
prologue {
pseudo '// Root block prologue starts'
pseudo '// Root block prologue ends'
}
sequence {
prologue {
pseudo '// Sequence 1 prologue starts'
pseudo '// Sequence 1 prologue ends'
}
add reg(_), reg(_), reg(_)
sub reg(_), reg(_), reg(_)
epilogue {
pseudo '// Sequence 1 epilogue starts'
pseudo '// Sequence 1 epilogue ends'
}
}
sequence {
prologue {
pseudo '// Sequence 2 prologue starts'
pseudo '// Sequence 2 prologue ends'
}
And reg(_), reg(_), reg(_)
Or reg(_), reg(_), reg(_)
epilogue {
pseudo '// Sequence 2 epilogue starts'
pseudo '// Sequence 2 epilogue ends'
}
}
epilogue {
pseudo '// Root block epilogue starts'
pseudo '// Root block epilogue ends'
}
}.run 10
end
end
Updated by Andrei Tatarnikov over 8 years ago
- Subject changed from Block-level prologue and epilogue must stay prologue and epilogue when blocks are mixed to Block-level prologue and epilogue must stay prologue and epilogue when sequences are mixed
Updated by Andrei Tatarnikov over 8 years ago
- Status changed from New to Open
- % Done changed from 0 to 10
r6945, r6949, r6950 - Block holds prologue and epilogue
r6951 - Refactoring: Prologue and epilogue are built using BlockBuilder.
r6953, r6954 - Small refactoring
r6955 - blocks are now handled correctly.
Updated by Andrei Tatarnikov over 8 years ago
- Status changed from Open to Resolved
- % Done changed from 10 to 100
Updated by Andrei Tatarnikov over 8 years ago
- Status changed from Resolved to Closed
- Published in build set to 2.3.46