renny.koshy at rubixinfotech.com
2006-Mar-08 04:51 UTC
[LLVMdev] Researching alternative for home-grown VM
I'm researching an alternative to our home-grown VM that is used for a telecomm system. LLVM sounds like it fits the bill... however, one of the primary reasons for developing our home-grown VM was the concept of continuation. Basically, the code that folks write can call certain built-in functions of our "language". These functions cause the VM to stop execution and save a "context". Later on an event arriving at the VM and pick up the context, and continue execution of the code. => Is there a way to do this LLVM (i.e has anyone done this or something similar)? => If not, can I implement it as a new op-code? We basically have implemented a "WAIT" opcode in our VM, which tells it to stop execution of this code, and wait for external events. Let met give a more concrete example: The code may say: status = sql_exec("Server1", Timeout, "select subscriberid from tblSubscriber where ANI='"+ani+"';", subscriberid); In this case, the sql_exec() is a built-in function of our language which sends a DB query, and then issues a "WAIT". This allows the VM to then process another event which may execute some completely un-related code. Then when a db-response event arrives, since there is a mapping for that event, it will then startup processing of the sql_exect() at the point where it had issued the WAIT. Thanks & Regards, Renny Koshy President & CEO -------------------------------------------- RUBIX Information Technologies, Inc. www.rubixinfotech.com
On Tue, 7 Mar 2006 renny.koshy at rubixinfotech.com wrote:> I'm researching an alternative to our home-grown VM that is used for a > telecomm system. LLVM sounds like it fits the bill... however, one of the > primary reasons for developing our home-grown VM was the concept of > continuation.ok> Basically, the code that folks write can call certain built-in functions of > our "language". These functions cause the VM to stop execution and save a > "context". Later on an event arriving at the VM and pick up the context, > and continue execution of the code.ok.> => Is there a way to do this LLVM (i.e has anyone done this or something > similar)?Nope, not that I know of.> => If not, can I implement it as a new op-code? We basically have > implemented a "WAIT" opcode in our VM, which tells it to stop execution of > this code, and wait for external events.How would this be implemented? Could you just insert a call to wait() and have the implementation do the right thing?> Let met give a more concrete example: > > The code may say: > > status = sql_exec("Server1", Timeout, "select subscriberid from > tblSubscriber where ANI='"+ani+"';", subscriberid); > > In this case, the sql_exec() is a built-in function of our language which > sends a DB query, and then issues a "WAIT". This allows the VM to then > process another event which may execute some completely un-related code. > Then when a db-response event arrives, since there is a mapping for that > event, it will then startup processing of the sql_exect() at the point > where it had issued the WAIT.Sure, this seems straight-forward. I would suggest just using an external function call to do this. -Chris -- http://nondot.org/sabre/ http://llvm.org/