From 665ecd4b714771b2e69384991a1043bcfcde3f72 Mon Sep 17 00:00:00 2001 From: Drahflow Date: Sun, 29 Dec 2013 16:43:40 +0100 Subject: Memory footprint reduced to ~10% --- compiler/elymasAsmLib.ey | 4 ++-- elymas/lib/sys/opt.ey | 20 ++++++++++---------- elymas/lib/sys/so.ey | 7 +++++-- elymas/memdump.ey | 33 +++++++++++++++++++++++++++++++-- 4 files changed, 48 insertions(+), 16 deletions(-) diff --git a/compiler/elymasAsmLib.ey b/compiler/elymasAsmLib.ey index 879efe5..b1d87c3 100644 --- a/compiler/elymasAsmLib.ey +++ b/compiler/elymasAsmLib.ey @@ -80,8 +80,8 @@ { %00 %00 %00 %00 %00 %60 %00 %00 } /HEAPBASE deff { %00 %00 %00 %00 %00 %50 %00 %00 } /BLOCKBASE deff { %00 %00 %00 %00 %00 %40 %00 %00 } /MARKBASE deff - # 4096 16 mul 8 mul ==ALLOCCHUNKSIZE # minimum ALLOCCHUNKSIZE - 4096 16 mul 8 mul 64 mul ==ALLOCCHUNKSIZE # FIXME: there is still some wonkyness with freezing + 4096 16 mul 8 mul ==ALLOCCHUNKSIZE # minimum ALLOCCHUNKSIZE + # 4096 16 mul 8 mul 64 mul ==ALLOCCHUNKSIZE # FIXME: there is still some wonkyness with freezing < # current end of heap memory (grows upwards) diff --git a/elymas/lib/sys/opt.ey b/elymas/lib/sys/opt.ey index 8f54e1e..9da4424 100644 --- a/elymas/lib/sys/opt.ey +++ b/elymas/lib/sys/opt.ey @@ -139,6 +139,16 @@ t { f } { 0 } ? * } /andif deffd + { ==e + [ + 0 e * STATICTYPED streq { 4 e * sys .typed .type 0 eq }' andif + 0 e * PUSH streq { 1 e * sys .typed .type 0 eq }' andif + 0 e * STRINGSTAR streq + ] any + } /holdsInt deffd + + { -1010 lt -012 ? } /max deffd + { ==o ==executingScope 0 ==containsScopeModifications # TODO: replace <, > by macros ( {, scope } * respectively) then remove this @@ -264,14 +274,6 @@ i 2 sub logic * ==secondLast i 3 sub logic * ==thirdLast - { ==e - [ - 0 e * STATICTYPED streq { 4 e * sys .typed .type 0 eq }' andif - 0 e * PUSH streq { 1 e * sys .typed .type 0 eq }' andif - 0 e * STRINGSTAR streq - ] any - } /holdsInt deffd - action CALL streq { 1 entry * "*" | ::rawCodeAddress eq }' andif { 0 last * PUSH streq }' andif @@ -507,8 +509,6 @@ { action CALL streq { 1 entry * "-" | ::rawCodeAddress eq }' andif { 0 last * PUSH streq }' andif }' { 1 last * ::rawObject ==constant - { -1010 lt -012 ? } /max deffd - 0 ==largestNumber 0 ==starUsed diff --git a/elymas/lib/sys/so.ey b/elymas/lib/sys/so.ey index 0b68250..d474d4c 100644 --- a/elymas/lib/sys/so.ey +++ b/elymas/lib/sys/so.ey @@ -555,7 +555,7 @@ 0 ==?dataSize # to be filled later { _ =data len =dataSize } /setData deff > _ ==?relocationTable - ] ==metaSections + ] ==?metaSections [ 0 frozenAllocationCount range { ==i @@ -832,13 +832,16 @@ # Elf64_Xword sh_entsize; /* Size of entries, if section has table */ s .entsize uint64 } each } each - ] ==fileHeaders + ] ==?fileHeaders 0 ==fileOffset [ fileHeaders metaSections { .data } each ] { ==data fileOffset data len add =fileOffset data str .fromArray out .writeall } each + + [ ] _ =fileHeaders + =metaSections 1 ==:WRITE diff --git a/elymas/memdump.ey b/elymas/memdump.ey index e0f8a48..8643078 100644 --- a/elymas/memdump.ey +++ b/elymas/memdump.ey @@ -122,10 +122,39 @@ sys .asm .|programStart sys .asm .rawCodeAddress { add peekElf64 }_ =*peekProgra addr 16 add peekElf64 "len:" -01 out addr 24 add peekElf64 256 math .base str .fromArray 0 out } + # more physical scope dumping, but harder to follow output + # { :scope + # addr peekElf64 %00000000FFFFFFFF band _ "len:" -01 out 8 div 1 -01 range { + # 8 mul addr add peekElf64 dumpElf + # } each + # } { :scope - addr peekElf64 %00000000FFFFFFFF band _ "len:" -01 out 8 div 1 -01 range { - 8 mul addr add peekElf64 dumpElf + addr 8 add peekElf64 ==nameTable + nameTable { nameTable 8 add peekElf64 %00000000FFFFFFFF band 16 div 1 sub } { 0 } ? * ==nameTableFill + + { ==i + i nameTableFill lt { + i 1 add 16 mul nameTable add peekElf64 ==name + name 24 add peekElf64 256 math .base str .fromArray 0 out + } rep + } /dumpLocalName deffst + + addr peekElf64 %00000000FFFFFFFF band 8 div _ ==scopeLen 4 -01 range { + _ 4 sub dumpLocalName + 8 mul addr add peekElf64 dumpElf } each + + addr 24 add peekElf64 ==extensionArea + extensionArea { + "" 0 out + extensionArea peekElf64 %00000000FFFFFFFF band 8 div 1 -01 range { + _ 1 sub scopeLen add 4 sub dumpLocalName + 8 mul extensionArea add peekElf64 dumpElf + } each + } { } ? * + + "" 0 out + addr 16 add peekElf64 dumpElf } { :name_table addr 8 add peekElf64 _ "fill:" -01 out 16 div 1 -01 range { -- cgit v1.2.3