Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

dump

  • Loading branch information...
commit 1567b2abbdc38f25c9b82d85540601aea73779b3 1 parent 95aac6f
@oleganza authored
Showing with 21 additions and 6 deletions.
  1. +21 −4 ecma-engine/IonVM.js
  2. +0 −2  primitives.io
View
25 ecma-engine/IonVM.js
@@ -5,7 +5,7 @@ load("Util.js")
var VM = (function(){
var Coro = O.create(function(){
-
+ this.stack = null
})
var State = O.create(function(){
@@ -13,7 +13,6 @@ var VM = (function(){
this.chainTarget = null // target for a chain of messages (equals to target in the beginning of the chain or after ";")
this.target = null // current target for a message
this.locals = null // "call context" - object who sent a message to the "target"
- this.coroutine = null // current coroutine (stack)
this.value = null // current slot value (set by lookupSlot)
})
@@ -22,24 +21,42 @@ var VM = (function(){
})
var VM = O.create(function(){
+ this.coro = null
+ this.setCoro = function(coro){
+ this.coro = coro
+ }
this.run = function(){
-
+ while (true) {
+ // main loop till coroutine returns
+ }
}
})
+ VM.Coro = Coro
VM.State = State
VM.Message = Message
return VM
})()
+
//
// Test
//
-
var vm = VM.create()
+var state = vm.State.create(function(){
+ this.message = msg
+
+})
+
+var coro = vm.Coro.create(function(){
+ this.stack = []
+ this.state = state
+})
+
+vm.setCoro(coro)
vm.run()
//var Message = IoVM.Message
View
2  primitives.io
@@ -32,7 +32,6 @@ Macros := Object clone do(
readSlot
)
)
-
activate := message(
ifMessageIsBuiltin(
activateBuiltin,
@@ -43,7 +42,6 @@ Macros := Object clone do(
copyValueToTarget;
nextMessage
)
-
pushState := message(
pushMessage
pushChainTarget
Please sign in to comment.
Something went wrong with that request. Please try again.