diff options
author | Adrian Thurston <thurston@complang.org> | 2014-01-08 18:50:58 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2014-01-08 18:50:58 -0500 |
commit | dce0feb8d1ff51bb586a13dd505ef41a403a3554 (patch) | |
tree | 6a458b57a96ad98ab88483e67e3060bf29b495f0 | |
parent | 71bc493f72d72383314872f60e1b2caff413acf9 (diff) | |
download | colm-dce0feb8d1ff51bb586a13dd505ef41a403a3554.tar.gz |
removed trees and iters from frame info,
Using unified locals array now.
-rw-r--r-- | src/parsedata.h | 2 | ||||
-rw-r--r-- | src/parsetree.h | 29 | ||||
-rw-r--r-- | src/pdabuild.cc | 30 | ||||
-rw-r--r-- | src/pdacodegen.cc | 48 | ||||
-rw-r--r-- | src/pdarun.h | 4 | ||||
-rw-r--r-- | src/synthesis.cc | 36 |
6 files changed, 0 insertions, 149 deletions
diff --git a/src/parsedata.h b/src/parsedata.h index ca416ceb..85b70b8c 100644 --- a/src/parsedata.h +++ b/src/parsedata.h @@ -799,8 +799,6 @@ struct Compiler void compilePreEof( TokenRegion *region ); void compileRootBlock(); void compileTranslateBlock( LangEl *langEl ); - void findLocalTrees( ObjectDef *localFrame, CharSet &trees ); - void findLocalIters( ObjectDef *localFrame, Iters &iters ); void findLocals( ObjectDef *localFrame, CodeBlock *block ); void makeProdCopies( Production *prod ); void compileReductionCode( Production *prod ); diff --git a/src/parsetree.h b/src/parsetree.h index 56e3fa90..4a80e8d4 100644 --- a/src/parsetree.h +++ b/src/parsetree.h @@ -182,33 +182,6 @@ struct Locals } }; -struct IterLoc -{ - IterLoc( int scope, int loc ) - : scope(scope), loc(loc) {} - - int scope; - int loc; -}; - -struct Iters -{ - Vector<IterLoc> ordered; - Vector<char> locs; - - void append( const IterLoc &il ) - { - int pos = 0; - while ( pos < ordered.length() && il.scope >= ordered[pos].scope ) - pos += 1; - ordered.insert( pos, il ); - locs.insert( pos, il.loc ); - } - - char *data() { return locs.data; } - int length() { return locs.length(); } -}; - typedef BstSet<char> CharSet; typedef Vector<unsigned char> UnsignedCharVect; @@ -3161,8 +3134,6 @@ struct CodeBlock long frameId; StmtList *stmtList; ObjectDef *localFrame; - CharSet trees; - Iters iters; Locals locals; Context *context; diff --git a/src/pdabuild.cc b/src/pdabuild.cc index a1d22aa3..fcbbcfb4 100644 --- a/src/pdabuild.cc +++ b/src/pdabuild.cc @@ -1321,12 +1321,6 @@ void Compiler::makeRuntimeData() runtimeData->frameInfo[rootCodeBlock->frameId].codeWV = 0; runtimeData->frameInfo[rootCodeBlock->frameId].codeLenWV = 0; - runtimeData->frameInfo[rootCodeBlock->frameId].trees = rootCodeBlock->trees.data; - runtimeData->frameInfo[rootCodeBlock->frameId].treesLen = rootCodeBlock->trees.length(); - - runtimeData->frameInfo[rootCodeBlock->frameId].iters = rootCodeBlock->iters.data(); - runtimeData->frameInfo[rootCodeBlock->frameId].itersLen = rootCodeBlock->iters.length(); - runtimeData->frameInfo[rootCodeBlock->frameId].locals = makeLocalInfo( rootCodeBlock->locals ); runtimeData->frameInfo[rootCodeBlock->frameId].localsLen = rootCodeBlock->locals.locals.length(); @@ -1354,12 +1348,6 @@ void Compiler::makeRuntimeData() runtimeData->frameInfo[block->frameId].codeWV = block->codeWV.data; runtimeData->frameInfo[block->frameId].codeLenWV = block->codeWV.length(); - runtimeData->frameInfo[block->frameId].trees = block->trees.data; - runtimeData->frameInfo[block->frameId].treesLen = block->trees.length(); - - runtimeData->frameInfo[block->frameId].iters = block->iters.data(); - runtimeData->frameInfo[block->frameId].itersLen = block->iters.length(); - runtimeData->frameInfo[block->frameId].locals = makeLocalInfo( block->locals ); runtimeData->frameInfo[block->frameId].localsLen = block->locals.locals.length(); @@ -1399,12 +1387,6 @@ void Compiler::makeRuntimeData() runtimeData->frameInfo[block->frameId].codeWV = block->codeWV.data; runtimeData->frameInfo[block->frameId].codeLenWV = block->codeWV.length(); - runtimeData->frameInfo[block->frameId].trees = block->trees.data; - runtimeData->frameInfo[block->frameId].treesLen = block->trees.length(); - - runtimeData->frameInfo[block->frameId].iters = block->iters.data(); - runtimeData->frameInfo[block->frameId].itersLen = block->iters.length(); - runtimeData->frameInfo[block->frameId].locals = makeLocalInfo( block->locals ); runtimeData->frameInfo[block->frameId].localsLen = block->locals.locals.length(); @@ -1439,12 +1421,6 @@ void Compiler::makeRuntimeData() runtimeData->frameInfo[block->frameId].codeWV = block->codeWV.data; runtimeData->frameInfo[block->frameId].codeLenWV = block->codeWV.length(); - runtimeData->frameInfo[block->frameId].trees = block->trees.data; - runtimeData->frameInfo[block->frameId].treesLen = block->trees.length(); - - runtimeData->frameInfo[block->frameId].iters = block->iters.data(); - runtimeData->frameInfo[block->frameId].itersLen = block->iters.length(); - runtimeData->frameInfo[block->frameId].locals = makeLocalInfo( block->locals ); runtimeData->frameInfo[block->frameId].localsLen = block->locals.locals.length(); @@ -1508,12 +1484,6 @@ void Compiler::makeRuntimeData() runtimeData->frameInfo[block->frameId].codeWC = block->codeWC.data; runtimeData->frameInfo[block->frameId].codeLenWC = block->codeWC.length(); - runtimeData->frameInfo[block->frameId].trees = block->trees.data; - runtimeData->frameInfo[block->frameId].treesLen = block->trees.length(); - - runtimeData->frameInfo[block->frameId].iters = block->iters.data(); - runtimeData->frameInfo[block->frameId].itersLen = block->iters.length(); - runtimeData->frameInfo[block->frameId].locals = makeLocalInfo( block->locals ); runtimeData->frameInfo[block->frameId].localsLen = block->locals.locals.length(); diff --git a/src/pdacodegen.cc b/src/pdacodegen.cc index bd8fa0a1..904cd423 100644 --- a/src/pdacodegen.cc +++ b/src/pdacodegen.cc @@ -109,38 +109,6 @@ void PdaCodeGen::writeRuntimeData( RuntimeData *runtimeData, PdaTables *pdaTable out << "\n};\n\n"; } - if ( runtimeData->frameInfo[i].treesLen > 0 ) { - out << "static char trees_" << i << "[] = {\n\t"; - - char *block = runtimeData->frameInfo[i].trees; - for ( int j = 0; j < runtimeData->frameInfo[i].treesLen; j++ ) { - out << (long) block[j]; - - if ( j < runtimeData->frameInfo[i].treesLen-1 ) { - out << ", "; - if ( (j+1) % 8 == 0 ) - out << "\n\t"; - } - } - out << "\n};\n\n"; - } - - if ( runtimeData->frameInfo[i].itersLen > 0 ) { - out << "static char iters_" << i << "[] = {\n\t"; - - char *block = runtimeData->frameInfo[i].iters; - for ( int j = 0; j < runtimeData->frameInfo[i].itersLen; j++ ) { - out << (long) block[j]; - - if ( j < runtimeData->frameInfo[i].itersLen-1 ) { - out << ", "; - if ( (j+1) % 8 == 0 ) - out << "\n\t"; - } - } - out << "\n};\n\n"; - } - if ( runtimeData->frameInfo[i].localsLen > 0 ) { out << "static LocalInfo locals_" << i << "[] = {\n\t"; @@ -265,22 +233,6 @@ void PdaCodeGen::writeRuntimeData( RuntimeData *runtimeData, PdaTables *pdaTable out << "0, "; out << runtimeData->frameInfo[i].codeLenWC << ", "; - /* trees */ - if ( runtimeData->frameInfo[i].treesLen > 0 ) - out << "trees_" << i << ", "; - else - out << "0, "; - - out << runtimeData->frameInfo[i].treesLen << ", "; - - /* iters. */ - if ( runtimeData->frameInfo[i].itersLen > 0 ) - out << "iters_" << i << ", "; - else - out << "0, "; - - out << runtimeData->frameInfo[i].itersLen << ", "; - /* locals. */ if ( runtimeData->frameInfo[i].localsLen > 0 ) out << "locals_" << i << ", "; diff --git a/src/pdarun.h b/src/pdarun.h index ae3e4775..5feb683b 100644 --- a/src/pdarun.h +++ b/src/pdarun.h @@ -217,10 +217,6 @@ typedef struct _FrameInfo long codeLenWV; Code *codeWC; long codeLenWC; - char *trees; - long treesLen; - char *iters; - long itersLen; LocalInfo *locals; long localsLen; long argSize; diff --git a/src/synthesis.cc b/src/synthesis.cc index a855c07a..a5dd531b 100644 --- a/src/synthesis.cc +++ b/src/synthesis.cc @@ -2209,44 +2209,8 @@ void CodeBlock::compile( Compiler *pd, CodeVect &code ) const stmt->compile( pd, code ); } - -void Compiler::findLocalTrees( ObjectDef *localFrame, CharSet &trees ) -{ - /* We exlcude "lhs" from being downrefed because we need to use if after - * the frame is is cleaned and so it must survive. */ - for ( ObjFieldList::Iter ol = *localFrame->objFieldList; ol.lte(); ol++ ) { - ObjectField *el = ol->value; - /* FIXME: This test needs to be improved. Match_text was getting - * through before useOffset was tested. What will? */ - if ( el->useOffset && !el->isLhsEl && ( el->beenReferenced || el->isParam ) ) { - UniqueType *ut = el->typeRef->uniqueType; - if ( ut->typeId == TYPE_TREE || ut->typeId == TYPE_PTR ) - trees.insert( el->offset ); - } - } -} - -void Compiler::findLocalIters( ObjectDef *localFrame, Iters &iters ) -{ - /* We exclude "lhs" from being downrefed because we need to use if after - * the frame is is cleaned and so it must survive. */ - for ( ObjFieldList::Iter ol = *localFrame->objFieldList; ol.lte(); ol++ ) { - ObjectField *el = ol->value; - if ( el->useOffset ) { - UniqueType *ut = el->typeRef->uniqueType; - if ( ut->typeId == TYPE_ITER ) { - int depth = el->scope->depth(); - iters.append( IterLoc( depth, (int)el->offset ) ); - } - } - } -} - void Compiler::findLocals( ObjectDef *localFrame, CodeBlock *block ) { - findLocalTrees( localFrame, block->trees ); - findLocalIters( localFrame, block->iters ); - Locals &locals = block->locals; for ( ObjFieldList::Iter ol = *localFrame->objFieldList; ol.lte(); ol++ ) { |