I implemented continuations (required for Python generators) differently in my Python (AST) to Java (bytecode) translator. The switch dispatch to restore variables and jump to next location is the same, but instead of throwing an exception, I treated each function as its own class and stored the stack, variables, etc. on the class (relevant code: https://github.com/cdis-vm/cdis2java/blob/main/src/main/java...). When you "call" the generator, what you actually get is a new instance of that class, so multiple threads can call the function with different arguments.

Note: the code itself is far from production ready, do not use this!