summaryrefslogtreecommitdiffstats
path: root/src/3rdparty/angle/src/compiler/InitializeParseContext.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/3rdparty/angle/src/compiler/InitializeParseContext.cpp')
-rw-r--r--src/3rdparty/angle/src/compiler/InitializeParseContext.cpp78
1 files changed, 11 insertions, 67 deletions
diff --git a/src/3rdparty/angle/src/compiler/InitializeParseContext.cpp b/src/3rdparty/angle/src/compiler/InitializeParseContext.cpp
index 1f40cf5800..dfab027330 100644
--- a/src/3rdparty/angle/src/compiler/InitializeParseContext.cpp
+++ b/src/3rdparty/angle/src/compiler/InitializeParseContext.cpp
@@ -12,85 +12,29 @@ OS_TLSIndex GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
bool InitializeParseContextIndex()
{
- if (GlobalParseContextIndex != OS_INVALID_TLS_INDEX) {
- assert(0 && "InitializeParseContextIndex(): Parse Context already initalized");
- return false;
- }
+ assert(GlobalParseContextIndex == OS_INVALID_TLS_INDEX);
- //
- // Allocate a TLS index.
- //
GlobalParseContextIndex = OS_AllocTLSIndex();
-
- if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "InitializeParseContextIndex(): Parse Context already initalized");
- return false;
- }
-
- return true;
+ return GlobalParseContextIndex != OS_INVALID_TLS_INDEX;
}
-bool FreeParseContextIndex()
+void FreeParseContextIndex()
{
- OS_TLSIndex tlsiIndex = GlobalParseContextIndex;
-
- if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "FreeParseContextIndex(): Parse Context index not initalized");
- return false;
- }
+ assert(GlobalParseContextIndex != OS_INVALID_TLS_INDEX);
+ OS_FreeTLSIndex(GlobalParseContextIndex);
GlobalParseContextIndex = OS_INVALID_TLS_INDEX;
-
- return OS_FreeTLSIndex(tlsiIndex);
-}
-
-bool InitializeGlobalParseContext()
-{
- if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "InitializeGlobalParseContext(): Parse Context index not initalized");
- return false;
- }
-
- TThreadParseContext *lpParseContext = static_cast<TThreadParseContext *>(OS_GetTLSValue(GlobalParseContextIndex));
- if (lpParseContext != 0) {
- assert(0 && "InitializeParseContextIndex(): Parse Context already initalized");
- return false;
- }
-
- TThreadParseContext *lpThreadData = new TThreadParseContext();
- if (lpThreadData == 0) {
- assert(0 && "InitializeGlobalParseContext(): Unable to create thread parse context");
- return false;
- }
-
- lpThreadData->lpGlobalParseContext = 0;
- OS_SetTLSValue(GlobalParseContextIndex, lpThreadData);
-
- return true;
}
-bool FreeParseContext()
+void SetGlobalParseContext(TParseContext* context)
{
- if (GlobalParseContextIndex == OS_INVALID_TLS_INDEX) {
- assert(0 && "FreeParseContext(): Parse Context index not initalized");
- return false;
- }
-
- TThreadParseContext *lpParseContext = static_cast<TThreadParseContext *>(OS_GetTLSValue(GlobalParseContextIndex));
- if (lpParseContext)
- delete lpParseContext;
-
- return true;
+ assert(GlobalParseContextIndex != OS_INVALID_TLS_INDEX);
+ OS_SetTLSValue(GlobalParseContextIndex, context);
}
-TParseContextPointer& GetGlobalParseContext()
+TParseContext* GetGlobalParseContext()
{
- //
- // Minimal error checking for speed
- //
-
- TThreadParseContext *lpParseContext = static_cast<TThreadParseContext *>(OS_GetTLSValue(GlobalParseContextIndex));
-
- return lpParseContext->lpGlobalParseContext;
+ assert(GlobalParseContextIndex != OS_INVALID_TLS_INDEX);
+ return static_cast<TParseContext*>(OS_GetTLSValue(GlobalParseContextIndex));
}