-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathNOTES
More file actions
148 lines (123 loc) · 5.39 KB
/
NOTES
File metadata and controls
148 lines (123 loc) · 5.39 KB
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
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
BONES
=====
* TODO Convert makefile.scm to normal makefile
* TODO "string->number": return NaN if integer result doesn't fit
* TODO Properly integrate use as Xen microkernel
- or any OS-less platform.
- code used for test:
#+BEGIN_SRC scheme
(program
(provide ieee754 nolibc embedded)
(code
(define-syntax define-syntax-rule
(syntax-rules
___ ()
((_ (name args ___) rule)
(define-syntax name
(syntax-rules ()
((_ args ___) rule))))))
(define-syntax-rule (%exit code)
(%terminate code))
(define-syntax %_exit %exit))
(files "x86_64/intrinsics.scm"
"r5rs.scm"
"nonstd.scm")
(code
(define-syntax-rule (printk str)
($inline "CALL copy_to_buffer; LIBCALL1 printk1, buffer; INT2FIX rax" str))
(printk "BONES!\n")
(printk (number->string (* 7 4)))))
#+END_SRC
* TODO loading "megalet" and "match" into si hangs when using match
- strangely, this doesn't happen in grass.
- may be caused by different handling of =letrec*= (CPS-transform)
* TODO document bones-autocompile
* TODO work around nasm-limitation in =__float64__= literals
- nasm doesn't accept an integer, but we could output the raw ieee
data by extracting the values as two words.
- would be bones-specific, via =cond-expand=.
* TODO test file:copy.scm
* TODO add checks for copying of slots and bytes (bounds, types)
* TODO add exact development system versions (xcode, mingw64, msvc)
* TODO we need floating-point num/str conversion
* TODO figure out more simplifications
* TODO port embedded test with shared library to Windows
- and add to file:scripts/check.bat
* add f64vectors
- FLOATVECTOR_TYPE (#x12)
- would need proper alignment on 32-bit systems.
- put API into file:fastmath.scm
- adapt printer + reader and pp.
* configuration form "(export VAR ...)"
- makes global externally visible (+ PREFIX)
* potential optimizations
** we could coalesce allocations inside a lambda
- but will probably gain very little.
** implement basic known procedure optimizations
- beta-contraction (needs knowledge about FVs).
** directly invoke case-lambda bodies
- known case-lambda target at call-site could jump to matching case
** handle redundant moves
- keep list of equivalence-sets for registers, and avoid move if
dest is known to be equal to src.
** unboxing
- "($the TYPE EXP)" annotates with type.
- "let" can check for "$the" and assign FP-register.
- accessing variables in FP-registers needs to move them to normal registers.
- requires special intrinsics for FP arguments.
- implement primitives as "($typed-case-lambda (((VAR TYPE) ...) BODY ...) ...)"
- specially handled in operator position during canonicalization.
- have local FA pass ("lfa") that expands $typed-case-lambda according to inferred
types and convert "let"-bound flonum vars using a custom binding form
- e.g. "($let-float ...)" or something like this.
* issues
** "inexact->exact" uses "fisttp", so needs SSE3
** i don't fully trust that "integer?" handles all cases correctly
- is the exponent overflow-test correct?
** align flonums so that block-data is at 16-byte boundary
- this is supposed to be faster.
- but needs to be handled in GC (skip padding bytes.)
- also needed for 32-bit variant with flonum support
- when allocating flonums, align ALLOC first.
- GC: when copying, insert marker word before flonum; during scan,
check for marker word and skip.
** there is no way to access =locals= from other modules or host programs
** something is wrong with musl's "sprintf" (or varargs) implementation
- "(number->string (expt 2.1 3))" returns "nan".
- ok with glibc.
** precision of 16 in num2str produces sometimes garbage digits
- see file:r5rs_pitfalls.scm, where test 8.1 is printed as "8.1..."
- but precision 15 does not match result of =integer?=, which
might be inaccurate or needs to be less accurate. This shows
up when num->str generates a string with ".", but the =integer?=
test returns true (thus appending another ".0")
** gcc/clang prints warning on Mac when linking compiled code ("PIE disabled")
- executable still runs, warning currently disabled with "-Wl,-no_pie".
** do popping of the FPU stack in =flonum_expt= in file:x86_64/boneslib.s right
- currently uses =fstp=, but probably should do a combination of
=ffree= and =fincstp=.
** SIGINT-handling not working on Windows
- according to msdn this is just normal.
** embedded check doesn't work on Mac OS
- linker complains when linking embedded2.o with "-bundle".
- needs probably some terrible magic specific to shared libraries.
* referencess
- X86_64:
- x87: http://www.website.masmforum.com/tutorials/fptute/index.html
- x86 reference: http://www.fermimn.gov.it/linux/quarta/x86/index.htm
- SSE: http://softpixel.com/~cwright/programming/simd/sse.php
- General information: file:/archive/optimizing_assembly.pdf
- x86-64 ABI: file:/archive/x86-64-abi.pdf
- Syscalls: http://blog.rchapman.org/post/36801038863/linux-system-call-table-for-x86-64
- "long mode", bootloader: http://wiki.osdev.org/Entering_Long_Mode_Directly
* release steps:
1. update NEWS
2. update version in version.scm and MANUAL.org
3. merge /develop/ into /master/
4. "make check"
5. "make dist"
6. tag
7. push, push tags
8. "make upload"
(ev. index.html)
9. (announce)