Actions
Bug #7461
closedBlock-level prologue and epilogue must stay prologue and epilogue when sequences are mixed
Start date:
08/11/2016
Due date:
% Done:
100%
Estimated time:
Detected in build:
svn
Platform:
Published in build:
2.3.46
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
Actions