diff --git a/src/toolsrc/codegen.pla b/src/toolsrc/codegen.pla index 16c8b53..75a9e53 100644 --- a/src/toolsrc/codegen.pla +++ b/src/toolsrc/codegen.pla @@ -494,14 +494,19 @@ def init_idglobal#0 word op byte i + puts("Mem free: "); puth(heapavail); putln tag_addr = heapalloc(TAGNUM*2) tag_type = heapalloc(TAGNUM) + puts("Mem free after tag allocate: "); puth(heapavail); putln fixup_tag = heapalloc(FIXUPNUM*2) fixup_addr = heapalloc(FIXUPNUM*2) + puts("Mem free after fixup allocate: "); puth(heapavail); putln idglobal_tbl = heapalloc(IDGLOBALSZ) idlocal_tbl = heapalloc(IDLOCALSZ) + puts("Mem free after global allocate: "); puth(heapavail); putln codebufsz = heapavail - 4096 codebuff = heapalloc(codebufsz) + puts("Mem free after data+code allocate: "); puth(heapavail); putln codeptr = codebuff lastglobal = idglobal_tbl puts("Data+Code buffer size = "); puti(codebufsz); putln diff --git a/src/toolsrc/plasm.pla b/src/toolsrc/plasm.pla index 2389199..08e8d46 100644 --- a/src/toolsrc/plasm.pla +++ b/src/toolsrc/plasm.pla @@ -231,11 +231,11 @@ end // // Generated code buffers // -const OPSEQNUM = 300 -const TAGNUM = 1024 +const OPSEQNUM = 256 +const TAGNUM = 2048 const FIXUPNUM = 2048 const IDGLOBALSZ = 2048 -const IDLOCALSZ = 256 +const IDLOCALSZ = 512 word fixup_cnt, tag_cnt = -1 word fixup_tag, fixup_addr word tag_addr, tag_type diff --git a/src/vmsrc/a1cmd.pla b/src/vmsrc/a1cmd.pla index 91ea541..d67f735 100755 --- a/src/vmsrc/a1cmd.pla +++ b/src/vmsrc/a1cmd.pla @@ -948,6 +948,10 @@ def loadmod(mod)#1 return -perr fin // + // Free up the end-of-module in main memory. + // + releaseheap(modend) + // // Call init routine if it exists. // fixup = 0 @@ -957,13 +961,9 @@ def loadmod(mod)#1 perr = -fixup fin if !(systemflags & modinitkeep) - modend = init - defofst + bytecode + releaseheap(init - defofst + bytecode) fin fin - // - // Free up the end-of-module in main memory. - // - releaseheap(modend) return fixup | (systemflags & modkeep) end // diff --git a/src/vmsrc/cmd.pla b/src/vmsrc/cmd.pla index 2d0dbac..a930b67 100755 --- a/src/vmsrc/cmd.pla +++ b/src/vmsrc/cmd.pla @@ -1113,6 +1113,10 @@ def loadmod(mod)#1 return -perr fin // + // Free up rld+esd (and bytecode on 128K) in main memory. + // + releaseheap(modend) + // // Call init routine if it exists. // fixup = 0 // This is repurposed for the return code @@ -1125,7 +1129,10 @@ def loadmod(mod)#1 if defbank xheap = init - defofst + defaddr else - modend = init - defofst + defaddr + // + // Free up init code in main memory. + // + releaseheap(init - defofst + defaddr) fin if fixup < 0 perr = -fixup @@ -1134,10 +1141,6 @@ def loadmod(mod)#1 fixup = fixup & ~modinitkeep fin fin - // - // Free up the end-of-module in main memory. - // - releaseheap(modend) return fixup end // @@ -1378,7 +1381,11 @@ while 1 is '+' saveX execmod(striptrail(@cmdln)) + // + // Clean up + // restoreX + resetmemfiles break otherwise cout('?')