forked from smarr/SOMpp
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move ErrorExit and Quit out of the Universe and mark noinline
Signed-off-by: Stefan Marr <[email protected]>
- Loading branch information
Showing
24 changed files
with
102 additions
and
77 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,50 @@ | ||
#include "Print.h" | ||
|
||
#include <cstdlib> | ||
#include <iostream> | ||
#include <mutex> | ||
#include <string> | ||
|
||
#include "../misc/defs.h" | ||
#include "LogAllocation.h" | ||
#include "Universe.h" | ||
|
||
using namespace std; | ||
|
||
static mutex output_mutex; | ||
|
||
void Print(StdString str) { | ||
void Print(std::string str) { | ||
lock_guard<mutex> lock(output_mutex); | ||
cout << str << flush; | ||
} | ||
|
||
void ErrorPrint(StdString str) { | ||
void ErrorPrint(std::string str) { | ||
lock_guard<mutex> lock(output_mutex); | ||
cerr << str << flush; | ||
} | ||
|
||
void Print(const char* str) { | ||
lock_guard<mutex> lock(output_mutex); | ||
cout << str << flush; | ||
} | ||
|
||
void ErrorPrint(const char* str) { | ||
lock_guard<mutex> lock(output_mutex); | ||
cerr << str << flush; | ||
} | ||
|
||
__attribute__((noreturn)) __attribute__((noinline)) void ErrorExit( | ||
const char* err) { | ||
ErrorPrint("Runtime error: " + StdString(err) + "\n"); | ||
Quit(ERR_FAIL); | ||
} | ||
|
||
__attribute__((noreturn)) __attribute__((noinline)) void Quit(long err) { | ||
ErrorPrint("Time spent in GC: [" + | ||
to_string(Timer::GCTimer->GetTotalTime()) + "] msec\n"); | ||
|
||
Universe::Shutdown(); | ||
|
||
OutputAllocationLogFile(); | ||
exit((int)err); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,11 @@ | ||
#pragma once | ||
|
||
#include "../misc/defs.h" | ||
#include <string> | ||
|
||
void Print(StdString str); | ||
void ErrorPrint(StdString str); | ||
void Print(std::string str); | ||
void Print(const char* str); | ||
void ErrorPrint(std::string str); | ||
void ErrorPrint(const char* str); | ||
|
||
__attribute__((noreturn)) __attribute__((noinline)) void Quit(long); | ||
__attribute__((noreturn)) __attribute__((noinline)) void ErrorExit(const char*); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.