Skip to content

Commit

Permalink
[tidy] Extract a bool function in extract module ;-)
Browse files Browse the repository at this point in the history
  • Loading branch information
thoni56 committed Sep 12, 2023
1 parent dca1090 commit 302e9a2
Showing 1 changed file with 9 additions and 4 deletions.
13 changes: 9 additions & 4 deletions src/extract.c
Original file line number Diff line number Diff line change
Expand Up @@ -1239,17 +1239,22 @@ static bool isNewClassNecessary(ProgramGraphNode *program) {
return true;
}

static bool programStructureMismatch() {
return parsedClassInfo.cxMemoryIndexAtFunctionBegin > parsedInfo.cxMemoryIndexAtBlockBegin
|| parsedInfo.cxMemoryIndexAtBlockBegin > parsedInfo.cxMemoryIndexAtBlockEnd
|| parsedInfo.cxMemoryIndexAtBlockEnd > parsedClassInfo.cxMemoryIndexAtFunctionEnd
|| parsedInfo.workMemoryIndexAtBlockBegin != parsedInfo.workMemoryIndexAtBlockEnd;
}

static void makeExtraction(void) {
ProgramGraphNode *program;
bool needToExtractNewClass = false;

if (parsedClassInfo.cxMemoryIndexAtFunctionBegin > parsedInfo.cxMemoryIndexAtBlockBegin
|| parsedInfo.cxMemoryIndexAtBlockBegin > parsedInfo.cxMemoryIndexAtBlockEnd
|| parsedInfo.cxMemoryIndexAtBlockEnd > parsedClassInfo.cxMemoryIndexAtFunctionEnd
|| parsedInfo.workMemoryIndexAtBlockBegin != parsedInfo.workMemoryIndexAtBlockEnd) {
if (programStructureMismatch()) {
errorMessage(ERR_ST, "Region / program structure mismatch");
return;
}

log_trace("!cxMemories: funBegin, blockBegin, blockEnd, funEnd: %x, %x, %x, %x", parsedClassInfo.cxMemoryIndexAtFunctionBegin, parsedInfo.cxMemoryIndexAtBlockBegin, parsedInfo.cxMemoryIndexAtBlockEnd, parsedClassInfo.cxMemoryIndexAtFunctionEnd);
assert(parsedClassInfo.cxMemoryIndexAtFunctionBegin);
assert(parsedInfo.cxMemoryIndexAtBlockBegin);
Expand Down

0 comments on commit 302e9a2

Please sign in to comment.