diff options
author | Adrian Thurston <thurston@complang.org> | 2013-12-21 12:29:35 -0500 |
---|---|---|
committer | Adrian Thurston <thurston@complang.org> | 2013-12-21 12:29:35 -0500 |
commit | 95077e51c2c2a8ff9f5a81abf4dbbf75058d9970 (patch) | |
tree | a6a7b1a20936c7058c553744b6c6a6ac2cf3225a /src/pdacodegen.cc | |
parent | 8355ffbdd7c85fd3a3254485851209c58ec8eab2 (diff) | |
download | colm-95077e51c2c2a8ff9f5a81abf4dbbf75058d9970.tar.gz |
find local iterators and add them to frame info
The iterators are orderd by scope depth. This will allow a stack unwind.
Diffstat (limited to 'src/pdacodegen.cc')
-rw-r--r-- | src/pdacodegen.cc | 30 |
1 files changed, 28 insertions, 2 deletions
diff --git a/src/pdacodegen.cc b/src/pdacodegen.cc index 469f95c0..8ce95216 100644 --- a/src/pdacodegen.cc +++ b/src/pdacodegen.cc @@ -124,6 +124,22 @@ void PdaCodeGen::writeRuntimeData( RuntimeData *runtimeData, PdaTables *pdaTable } 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"; + } } /* @@ -233,13 +249,23 @@ 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 << ", " << + out << runtimeData->frameInfo[i].treesLen << ", "; + + /* iters. */ + if ( runtimeData->frameInfo[i].itersLen > 0 ) + out << "iters_" << i << ", "; + else + out << "0, "; + + out << runtimeData->frameInfo[i].itersLen << ", "; + + out << runtimeData->frameInfo[i].argSize << ", " << runtimeData->frameInfo[i].frameSize; |