Interpreter Destructor

I have come across the issue where repeatedly creating and deleting an interpreter can cause incorrect external functions to be called. The issue had to do with the ManagedStatic map Functions in ExecutionEngine/Interpreter/ExternalFunctions.cpp. I was able to fix this by calling llvm_shutdown() when I delete the interpreter.

Is it necessary to delete all ManagedStatic objects to delete and recreate an Interpreter? Would it not be better to clear the Functions map in the Interpreter desctructor since it data in it may no longer be valid?

-David Bertouille

Probably. Patches welcome!


Here is a proposed patch to clear the function cache on destruction of an interpreter.


Owen Anderson wrote:

Interpreter.diff (1.08 KB)