From a2e22732f195dc075a733c79f15156752f522a43 Mon Sep 17 00:00:00 2001 From: Richard Linden Date: Tue, 30 Jul 2013 19:13:45 -0700 Subject: Summer cleaning - removed a lot of llcommon dependencies to speed up build times consolidated most indra-specific constants in llcommon under indra_constants.h fixed issues with operations on mixed unit types (implicit and explicit) made LL_INFOS() style macros variadic in order to subsume other logging methods such as ll_infos added optional tag output to error recorders --- indra/lscript/lscript_compile/indra.l | 1 - indra/lscript/lscript_compile/lscript_bytecode.cpp | 17 +++----- indra/lscript/lscript_compile/lscript_bytecode.h | 5 ++- indra/lscript/lscript_compile/lscript_scope.h | 51 ++++++++++------------ indra/lscript/lscript_compile/lscript_tree.h | 9 ++-- 5 files changed, 37 insertions(+), 46 deletions(-) (limited to 'indra/lscript/lscript_compile') diff --git a/indra/lscript/lscript_compile/indra.l b/indra/lscript/lscript_compile/indra.l index 1bb38bbf65..019d227842 100755 --- a/indra/lscript/lscript_compile/indra.l +++ b/indra/lscript/lscript_compile/indra.l @@ -25,7 +25,6 @@ FS (f|F) #include "indra.y.hpp" #include "lltimer.h" #include "indra_constants.h" -#include "llagentconstants.h" #include "lllslconstants.h" #include "lluuid.h" #include "llassetstorage.h" diff --git a/indra/lscript/lscript_compile/lscript_bytecode.cpp b/indra/lscript/lscript_compile/lscript_bytecode.cpp index 95b2f35a94..b6c3dd3a86 100755 --- a/indra/lscript/lscript_compile/lscript_bytecode.cpp +++ b/indra/lscript/lscript_compile/lscript_bytecode.cpp @@ -40,8 +40,8 @@ LLScriptJumpTable::LLScriptJumpTable() LLScriptJumpTable::~LLScriptJumpTable() { - mLabelMap.deleteAllData(); - mJumpMap.deleteAllData(); + delete_and_clear(mLabelMap); + delete_and_clear(mJumpMap); } void LLScriptJumpTable::addLabel(char *name, S32 offset) @@ -203,17 +203,14 @@ void LLScriptByteCodeChunk::addJump(char *name) void LLScriptByteCodeChunk::connectJumps() { - char *jump; - S32 offset, jumppos; - if (mJumpTable) { - for (jump = mJumpTable->mJumpMap.getFirstKey(); - jump; - jump = mJumpTable->mJumpMap.getNextKey()) + for(std::map::iterator it = mJumpTable->mJumpMap.begin(), end_it = mJumpTable->mJumpMap.end(); + it != end_it; + ++it) { - jumppos = *mJumpTable->mJumpMap[jump]; - offset = *mJumpTable->mLabelMap[jump] - jumppos; + S32 jumppos = *it->second; + S32 offset = *mJumpTable->mLabelMap[it->first] - jumppos; jumppos = jumppos - 4; integer2bytestream(mCodeChunk, jumppos, offset); } diff --git a/indra/lscript/lscript_compile/lscript_bytecode.h b/indra/lscript/lscript_compile/lscript_bytecode.h index 0933c78b6f..1908bebcb9 100755 --- a/indra/lscript/lscript_compile/lscript_bytecode.h +++ b/indra/lscript/lscript_compile/lscript_bytecode.h @@ -29,6 +29,7 @@ #include "lscript_byteconvert.h" #include "lscript_scope.h" +#include class LLScriptJumpTable { @@ -39,8 +40,8 @@ public: void addLabel(char *name, S32 offset); void addJump(char *name, S32 offset); - LLMap mLabelMap; - LLMap mJumpMap; + std::map mLabelMap; + std::map mJumpMap; }; class LLScriptByteCodeChunk diff --git a/indra/lscript/lscript_compile/lscript_scope.h b/indra/lscript/lscript_compile/lscript_scope.h index 5b2a73ad92..ffff91c81b 100755 --- a/indra/lscript/lscript_compile/lscript_scope.h +++ b/indra/lscript/lscript_compile/lscript_scope.h @@ -27,8 +27,8 @@ #ifndef LL_LSCRIPT_SCOPE_H #define LL_LSCRIPT_SCOPE_H -#include "string_table.h" -#include "llmap.h" +#include +#include "llstringtable.h" #include "lscript_byteformat.h" typedef enum e_lscript_identifier_type @@ -301,13 +301,13 @@ public: ~LLScriptScope() { - mEntryMap.deleteAllData(); + delete_and_clear(mEntryMap); } LLScriptScopeEntry *addEntry(const char *identifier, LSCRIPTIdentifierType idtype, LSCRIPTType type) { const char *name = mSTable->addString(identifier); - if (!mEntryMap.checkData(name)) + if (mEntryMap.find(name) == mEntryMap.end()) { if (idtype == LIT_FUNCTION) mEntryMap[name] = new LLScriptScopeEntry(name, idtype, type, mFunctionCount++); @@ -324,18 +324,10 @@ public: } } - BOOL checkEntry(const char *identifier) + bool checkEntry(const char *identifier) { const char *name = mSTable->addString(identifier); - if (mEntryMap.checkData(name)) - { - return TRUE; - } - else - { - // identifier already exists at this scope - return FALSE; - } + return mEntryMap.find(name) != mEntryMap.end(); } LLScriptScopeEntry *findEntry(const char *identifier) @@ -345,10 +337,11 @@ public: while (scope) { - if (scope->mEntryMap.checkData(name)) + entry_map_t::iterator found_it = mEntryMap.find(name); + if (found_it != mEntryMap.end()) { // cool, we found it at this scope - return scope->mEntryMap[name]; + return found_it->second; } scope = scope->mParentScope; } @@ -362,24 +355,25 @@ public: while (scope) { - if (scope->mEntryMap.checkData(name)) + entry_map_t::iterator found_it = scope->mEntryMap.find(name); + if (found_it != scope->mEntryMap.end()) { // need to check type, and if type is function we need to check both types if (idtype == LIT_FUNCTION) { - if (scope->mEntryMap[name]->mIDType == LIT_FUNCTION) + if (found_it->second->mIDType == LIT_FUNCTION) { - return scope->mEntryMap[name]; + return (found_it->second); } - else if (scope->mEntryMap[name]->mIDType == LIT_LIBRARY_FUNCTION) + else if (found_it->second->mIDType == LIT_LIBRARY_FUNCTION) { - return scope->mEntryMap[name]; + return (found_it->second); } } - else if (scope->mEntryMap[name]->mIDType == idtype) + else if (found_it->second->mIDType == idtype) { // cool, we found it at this scope - return scope->mEntryMap[name]; + return (found_it->second); } } scope = scope->mParentScope; @@ -392,11 +386,12 @@ public: mParentScope = scope; } - LLMap mEntryMap; - LLScriptScope *mParentScope; - LLStringTable *mSTable; - S32 mFunctionCount; - S32 mStateCount; + typedef std::map entry_map_t; + entry_map_t mEntryMap; + LLScriptScope* mParentScope; + LLStringTable* mSTable; + S32 mFunctionCount; + S32 mStateCount; }; extern LLStringTable *gScopeStringTable; diff --git a/indra/lscript/lscript_compile/lscript_tree.h b/indra/lscript/lscript_compile/lscript_tree.h index bf29f44518..047c220b17 100755 --- a/indra/lscript/lscript_compile/lscript_tree.h +++ b/indra/lscript/lscript_compile/lscript_tree.h @@ -29,7 +29,6 @@ #include "v3math.h" #include "llquaternion.h" -#include "linked_lists.h" #include "lscript_error.h" #include "lscript_typecheck.h" #include "lscript_byteformat.h" @@ -2304,20 +2303,20 @@ public: LLScriptAllocationManager() {} ~LLScriptAllocationManager() { - mAllocationList.deleteAllData(); + deleteAllocations(); } void addAllocation(LLScriptFilePosition *ptr) { - mAllocationList.addData(ptr); + mAllocationList.push_front(ptr); } void deleteAllocations() { - mAllocationList.deleteAllData(); + delete_and_clear(mAllocationList); } - LLLinkedList mAllocationList; + std::list mAllocationList; }; extern LLScriptAllocationManager *gAllocationManager; -- cgit v1.2.3