aboutsummaryrefslogtreecommitdiff
path: root/elymas
diff options
context:
space:
mode:
authorDrahflow <drahflow@gmx.de>2013-12-29 16:43:40 +0100
committerDrahflow <drahflow@gmx.de>2013-12-29 16:43:40 +0100
commit665ecd4b714771b2e69384991a1043bcfcde3f72 (patch)
tree6e81d329d222e50f56d62bacbb61cf14ee55394d /elymas
parentd245b90de88b762f65a5007c1776206dc7cd72dc (diff)
Memory footprint reduced to ~10%
Diffstat (limited to 'elymas')
-rw-r--r--elymas/lib/sys/opt.ey20
-rw-r--r--elymas/lib/sys/so.ey7
-rw-r--r--elymas/memdump.ey33
3 files changed, 46 insertions, 14 deletions
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 {
+ "<in extension area>" 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
+ } { } ? *
+
+ "<parent>" 0 out
+ addr 16 add peekElf64 dumpElf
}
{ :name_table
addr 8 add peekElf64 _ "fill:" -01 out 16 div 1 -01 range {