From 37cf4e0581b586f0b28ab96876f43794323d4b60 Mon Sep 17 00:00:00 2001 From: Kartik Agaram Date: Mon, 22 Jul 2019 01:25:33 -0700 Subject: 5443 - standard library is now self-hosted Translates 5k lines of input in 26 seconds. I'm not sure why I need to grow the label table. It was already 512 entries long, and I'm only using 373 so far. --- subx/apps/assort | Bin 34326 -> 34330 bytes subx/apps/dquotes | Bin 40882 -> 40886 bytes subx/apps/hex | Bin 36881 -> 36885 bytes subx/apps/pack | Bin 46978 -> 46982 bytes subx/apps/subx-common.subx | 8 ++++++-- subx/apps/survey | Bin 42976 -> 42981 bytes subx/apps/survey.subx | 14 +++++++++++--- subx/apps/tests | Bin 33138 -> 33142 bytes 8 files changed, 17 insertions(+), 5 deletions(-) (limited to 'subx') diff --git a/subx/apps/assort b/subx/apps/assort index 01813914..5fd51058 100755 Binary files a/subx/apps/assort and b/subx/apps/assort differ diff --git a/subx/apps/dquotes b/subx/apps/dquotes index be36b0c4..5c7ee1c0 100755 Binary files a/subx/apps/dquotes and b/subx/apps/dquotes differ diff --git a/subx/apps/hex b/subx/apps/hex index 8b903e5d..4bd5acce 100755 Binary files a/subx/apps/hex and b/subx/apps/hex differ diff --git a/subx/apps/pack b/subx/apps/pack index 792c30ba..370ced9b 100755 Binary files a/subx/apps/pack and b/subx/apps/pack differ diff --git a/subx/apps/subx-common.subx b/subx/apps/subx-common.subx index 413edc9a..27f488c9 100644 --- a/subx/apps/subx-common.subx +++ b/subx/apps/subx-common.subx @@ -1,6 +1,6 @@ -# some common helpers shared by phases of the SubX converter +# common helpers shared by phases of the SubX translator -# - buffer sizes shared by all phases +# - some limits on the programs we can translate == data # maximum memory available for allocation @@ -15,6 +15,10 @@ Segment-size: Input-size: 0x80000/imm32/512KB +# maximum size of the 'labels' table in survey.subx +Max-labels: + 0x4000/imm32/1K-labels/16KB + == code # instruction effective address register displacement immediate # . op subop mod rm32 base index scale r32 diff --git a/subx/apps/survey b/subx/apps/survey index 308c6ee8..54ed0c41 100755 Binary files a/subx/apps/survey and b/subx/apps/survey differ diff --git a/subx/apps/survey.subx b/subx/apps/survey.subx index 9bee7e16..8af8204c 100644 --- a/subx/apps/survey.subx +++ b/subx/apps/survey.subx @@ -136,16 +136,24 @@ convert: # infile : (address buffered-file), out : (address buffered-file) -> < 68/push 0/imm32/read 68/push 0/imm32/write 89/copy 3/mod/direct 1/rm32/ECX . . . 4/r32/ESP . . # copy ESP to ECX - # var labels/EDX = stream(512 * 16) - 81 5/subop/subtract 3/mod/direct 4/rm32/ESP . . . . . 0x2000/imm32 # subtract from ESP - 68/push 0x2000/imm32/length + # var labels/EDX = stream(1024 * 16) + # . data + 2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/ESP Max-labels/disp32 # subtract *Max-labels from ESP + # . length + ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Max-labels/disp32 # push *Max-labels + # . read 68/push 0/imm32/read + # . write 68/push 0/imm32/write 89/copy 3/mod/direct 2/rm32/EDX . . . 4/r32/ESP . . # copy ESP to EDX # var in/ESI = stream(Input-size * 1) + # . data 2b/subtract 0/mod/indirect 5/rm32/.disp32 . . 4/r32/ESP Input-size/disp32 # subtract *Input-size from ESP + # . length ff 6/subop/push 0/mod/indirect 5/rm32/.disp32 . . . Input-size/disp32 # push *Input-size + # . read 68/push 0/imm32/read + # . write 68/push 0/imm32/write 89/copy 3/mod/direct 6/rm32/ESI . . . 4/r32/ESP . . # copy ESP to ESI #? # dump labels->write {{{ diff --git a/subx/apps/tests b/subx/apps/tests index 20375e67..edaf4709 100755 Binary files a/subx/apps/tests and b/subx/apps/tests differ -- cgit 1.4.1-2-gfad0 -0400 test config init using sync.Once' href='/gbmor/getwtxt/commit/svc/init_test.go?h=v0.4.0&id=5e92b610a5f8832e6a389b1acb01fd0cc866780e'>5e92b61 ^
6753171 ^

6753171 ^
a6c8162 ^

e10fc64 ^




5e92b61 ^
a6c8162 ^
5e92b61 ^
c050730 ^
e10fc64 ^
6753171 ^
c050730 ^

e10fc64 ^

7f76158 ^
e10fc64 ^
5e92b61 ^
a6c8162 ^

e10fc64 ^





a6c8162 ^






6753171 ^
6753171 ^





6753171 ^
6753171 ^


6753171 ^

6753171 ^






7f76158 ^
6753171 ^

e10fc64 ^
6753171 ^

6753171 ^


6753171 ^

6753171 ^












6753171 ^
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91