|
From: | brad |
Subject: | [Tinycc-devel] Question about in-memory compilation target |
Date: | Sun, 14 Jan 2024 23:51:22 +0000 |
Hi, I'm using tcc as a back-end code generator for a custom scripting language and have some questions about in-memory compilation. I was compiling to a memory block that I was allocating and keeping after deleting the compiler but was later getting crashes. Debugging it I came to realize this was because the read/write/execute protection on the code segments was left intact, causing exceptions later when that memory was re-used by someone else. Also, on Windows it seems the function table needs to be deleted (RtlDeleteFunctionTable). My fix for the moment at least is to not call tcc_delete until I'm finished with the in-memory code. Questions: 1. Is it possible to keep, use and then release the compiled code after the initial compiler instance has been deleted (ie: after tcc_delete). I couldn't see anything in the header file for this. 2. Assuming that I need to not tcc_delete until after the in-memory code has been released how much of the original compilation state is being held in memory? eg: symbol tables, #defines, AST etc... ie: would it be worth providing a way to disconnect the in-memory code from the compiler state in a way that all that cleanup can be done without the original compiler instance? (sorry if my terminology is off-base, I'm very new to tcc) Any help much appreciated. Brad |
[Prev in Thread] | Current Thread | [Next in Thread] |