Efficient coroutines by rewriting bytecode