Skip to content

Commit

Permalink
Outputs should be cleared too if they're wildcards, remove condition.
Browse files Browse the repository at this point in the history
(and factor out common IsFlat test).
  • Loading branch information
spathiwa authored and rajsite committed Mar 22, 2018
1 parent ed0960c commit 1b2d590
Showing 1 changed file with 15 additions and 14 deletions.
29 changes: 15 additions & 14 deletions source/core/VirtualInstrument.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -988,20 +988,21 @@ InstructionCore* ClumpParseState::EmitCallVIInstruction()
snippetBuilder.InternalAddArg(viArgTypes[i], viArgPointers[i]);
snippetBuilder.EmitInstruction();
}
if (!paramType->IsFlat() && viArgPointers[i] != null) {
// If it is non flat then it has to be owned. Unwired parameters should have been allocated a private copy.
// Zero out all traces of the non flat value passed in
snippetBuilder.StartInstruction(&zeroOutTopOpName);
snippetBuilder.InternalAddArg(null, paramType);
snippetBuilder.InternalAddArg(paramType, pParamData + offset);
snippetBuilder.EmitInstruction();
}
if (!paramType->IsFlat() && viArgPointers[i] == null && !paramType->IsOutputParam()) {
// Wild card argument was passed, so it was allocated in param block. We should clear the data.
snippetBuilder.StartInstruction(&clearOpName);
snippetBuilder.InternalAddArg(null, paramType);
snippetBuilder.InternalAddArg(paramType, pParamData + offset);
snippetBuilder.EmitInstruction();
if (!paramType->IsFlat()) {
if (viArgPointers[i] != null) {
// If it is non flat then it has to be owned. (Unwired parameters should have been allocated a private copy, handled in else)
// Zero out all traces of the non flat value passed in
snippetBuilder.StartInstruction(&zeroOutTopOpName);
snippetBuilder.InternalAddArg(null, paramType);
snippetBuilder.InternalAddArg(paramType, pParamData + offset);
snippetBuilder.EmitInstruction();
} else {
// Wild card argument was passed, so it was locally allocated in param block. We should clear the data.
snippetBuilder.StartInstruction(&clearOpName);
snippetBuilder.InternalAddArg(null, paramType);
snippetBuilder.InternalAddArg(paramType, pParamData + offset);
snippetBuilder.EmitInstruction();
}
}
}
EndEmitSubSnippet(&snippetBuilder);
Expand Down

0 comments on commit 1b2d590

Please sign in to comment.