From 7cd9f9fad06a33b1811339c2d3e88ea4fb533053 Mon Sep 17 00:00:00 2001 From: David Schmenk Date: Thu, 31 Aug 2017 11:21:00 -0700 Subject: [PATCH] Fix test pointer function calls and add eval stack pointer check in portable VM --- src/samplesrc/test.pla | 6 +++--- src/vmsrc/plvm.c | 6 +++++- 2 files changed, 8 insertions(+), 4 deletions(-) diff --git a/src/samplesrc/test.pla b/src/samplesrc/test.pla index f07cab7..be96122 100755 --- a/src/samplesrc/test.pla +++ b/src/samplesrc/test.pla @@ -42,9 +42,9 @@ def tens(start)#0 pptr = @print repeat print:hex(i)#0 - print:str(" ") + print:str(" ")#0 pptr=>dec(i)#0 - print:newln() + print:newln()#0 i = i / 10 until i == 0 end @@ -138,7 +138,7 @@ puti((@array)=>4);putc(' ') puti((@array)=>6);putc(' ') puti((@array)=>8);putln ptr = @main -ptr(@array:6) +ptr(@array:6)#0 ptr = @array puti((ptr):6) putln diff --git a/src/vmsrc/plvm.c b/src/vmsrc/plvm.c index d009266..642e33f 100755 --- a/src/vmsrc/plvm.c +++ b/src/vmsrc/plvm.c @@ -507,7 +507,7 @@ OPTBL: DW ZERO,ADD,SUB,MUL,DIV,MOD,INCR,DECR ; 00 02 04 06 08 0A 0C 0E DW NOT,LOR,LAND,LA,LLA,CB,CW,CS ; 20 22 24 26 28 2A 2C 2E DW DROP,DUP,PUSH,PULL,BRGT,BRLT,BREQ,BRNE ; 30 32 34 36 38 3A 3C 3E DW ISEQ,ISNE,ISGT,ISLT,ISGE,ISLE,BRFLS,BRTRU ; 40 42 44 46 48 4A 4C 4E - DW BRNCH,IBRNCH,CALL,ICAL,ENTER,LEAVE,RET,??? ; 50 52 54 56 58 5A 5C 5E + DW BRNCH,IBRNCH,CALL,ICAL,ENTER,LEAVE,RET,CFFB ; 50 52 54 56 58 5A 5C 5E DW LB,LW,LLB,LLW,LAB,LAW,DLB,DLW ; 60 62 64 66 68 6A 6C 6E DW SB,SW,SLB,SLW,SAB,SAW,DAB,DAW ; 70 72 74 76 78 7A 7C 7E */ @@ -919,6 +919,10 @@ int main(int argc, char **argv) stodci(*argv, dci); call(lookup_sym(dci)); } + if (esp != &eval_stack[EVAL_STACKSZ]) + { + printf("Eval stack pointer mismatch at end of execution = %d.\n", EVAL_STACKSZ - (esp - eval_stack)); + } } return 0; }