Skip to content

Commit

Permalink
start maintaining the current frame in the thread
Browse files Browse the repository at this point in the history
  • Loading branch information
andreasgal committed Jul 15, 2014
1 parent b339dc6 commit 9a3760b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
8 changes: 3 additions & 5 deletions jvm.js
Original file line number Diff line number Diff line change
Expand Up @@ -47,14 +47,12 @@ JVM.prototype.loadJarFile = function(fileName) {
}

JVM.prototype.start = function() {
var self = this;

var entryPoint = CLASSES.getEntryPoint(this.entryPoint.className, this.entryPoint.methodName);
if (!entryPoint) {
throw new Error("Entry point method is not found.");
}

var toplevel = new Frame();
toplevel.stack.push(null); // args
toplevel.invoke(OPCODES.invokestatic, entryPoint);
var frame = THREADS.current.frame;
frame.stack.push(null); // args
frame.invoke(OPCODES.invokestatic, entryPoint);
}
1 change: 1 addition & 0 deletions thread.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ var Thread = function(name) {
if (this instanceof Thread) {
this.name = name || "noname";
this.priority = (Thread.MAX_PRIORITY + Thread.MIN_PRIORITY) >> 1;
this.frame = new Frame();
} else {
return new Thread(name);
}
Expand Down

0 comments on commit 9a3760b

Please sign in to comment.