Skip to content

Commit

Permalink
args were put in wrong order into locals
Browse files Browse the repository at this point in the history
  • Loading branch information
parrt committed Apr 7, 2017
1 parent d6fcefc commit 82a6f47
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion simple-virtual-machine.ipr
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@
<module fileurl="file://$PROJECT_DIR$/simple-virtual-machine.iml" filepath="$PROJECT_DIR$/simple-virtual-machine.iml" />
</modules>
</component>
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" project-jdk-name="1.7" project-jdk-type="JavaSDK">
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_6" default="false" project-jdk-name="1.8" project-jdk-type="JavaSDK">
<output url="file://$PROJECT_DIR$/out" />
</component>
<component name="VcsDirectoryMappings">
Expand Down
3 changes: 2 additions & 1 deletion src/vm/VM.java
Original file line number Diff line number Diff line change
Expand Up @@ -139,8 +139,9 @@ protected void cpu() {
int nargs = metadata[findex].nargs; // how many args got pushed
ctx = new Context(ctx,ip,metadata[findex]);
// copy args into new context
int firstarg = sp-nargs+1;
for (int i=0; i<nargs; i++) {
ctx.locals[i] = stack[sp-i];
ctx.locals[i] = stack[firstarg+i];
}
sp -= nargs;
ip = metadata[findex].address; // jump to function
Expand Down

0 comments on commit 82a6f47

Please sign in to comment.