← Back to context

Comment by sillycross

4 years ago

Not sure what you mean by 'emulator', but I will assume you meant ISA for a different hardware architecture.

> The emulator would identify hot code blocks, generate C like constructs (or ideally the AST)

The idea behind copy-and-patch should be able to handle your use case of quickly translating code blocks in another ISA to native instructions.

However, I think Pochi's metaprogramming capabilities might not be too relevant here. After all, you are translating from a block of CPU instructions (in another ISA). It's probably not necessary or helpful to translate them back to C-like control flow only to compile them again.

> The ability to call back to host methods, handle exception semantics and all the while being totally oblivious to the platform

I'm not sure what you mean here. Yes Pochi supports intuitive inter-operation with the host program (call methods, handle exception etc). This is important for metaprogramming use case (e.g., generating a program that executes a SQL query), but I don't see what it has to do with emulating a program in another architecture.