Assign numbers to the bytecodes. Place all unary codes into one group.
This commit is contained in:
parent
d80e0c1fd3
commit
0005ef2f86
207
doc/bytecode.txt
207
doc/bytecode.txt
|
|
@ -4,119 +4,120 @@ top:
|
||||||
1xxxxxxx out in in: conditional
|
1xxxxxxx out in in: conditional
|
||||||
expression: up to 64, 1 out, 2 in
|
expression: up to 64, 1 out, 2 in
|
||||||
00000000 out sub in: unary-expr
|
00000000 out sub in: unary-expr
|
||||||
00000001 out sub in: unary-float-expr
|
|
||||||
00xxxxxx out in in: binary-expr, x > 1
|
00xxxxxx out in in: binary-expr, x > 1
|
||||||
unary-expr: up to 255, 1 out, 1 in
|
unary-expr: up to 255, 1 out, 1 in
|
||||||
(set! out in)
|
00 invalid / permanently reserved
|
||||||
(set! out (car in))
|
01 (set! out in)
|
||||||
(set! out (cdr in))
|
02 (set! out (car in))
|
||||||
(set! out (unbox in))
|
03 (set! out (cdr in))
|
||||||
(set! out (not in)) ; if in == #f then #t else #f
|
04 (set! out (unbox in))
|
||||||
(set! out (nil? in)) ; value => bool
|
05 (set! out (not in)) ; if in == #f then #t else #f
|
||||||
(set! out (pair? in)) ; value => bool
|
06 (set! out (nil? in)) ; value => bool
|
||||||
(set! out (box? in)) ; value => bool
|
07 (set! out (pair? in)) ; value => bool
|
||||||
(set! out (vector? in)) ; value => bool
|
08 (set! out (box? in)) ; value => bool
|
||||||
(set! out (byte-string? in)) ; value => bool
|
09 (set! out (vector? in)) ; value => bool
|
||||||
(set! out (struct? in)) ; value => bool
|
0a (set! out (byte-string? in)) ; value => bool
|
||||||
(set! out (fixnum? in)) ; value => bool
|
0b (set! out (struct? in)) ; value => bool
|
||||||
(set! out (float? in)) ; value => bool
|
0c (set! out (fixnum? in)) ; value => bool
|
||||||
(set! out (make-box in)) ; value => box
|
0d (set! out (float? in)) ; value => bool
|
||||||
(set! out (make-struct in)) ; metastruct => struct
|
0e (set! out (make-box in)) ; value => box
|
||||||
(set! out (make-float in)) ; fixnum => float
|
0f (set! out (make-struct in)) ; metastruct => struct
|
||||||
(set! out (lambda in)) ; template-or-lambda => lambda
|
10 (set! out (make-float in)) ; fixnum => float
|
||||||
(set! out (fix- in)) ; two's complement / arithmetic negation
|
11 (set! out (lambda in)) ; template-or-lambda => lambda
|
||||||
(set! out (bit-not in)) ; one's complement / bitwise negation
|
12 (set! out (bit-not in)) ; one's complement / bitwise negation
|
||||||
unary-float-expr: up to 255, 1 out, 1 in
|
13 (set! out (fix- in)) ; two's complement / arithmetic negation
|
||||||
(set! out (float- in))
|
14 (set! out (float- in)) ; floating-point negation
|
||||||
|
|
||||||
; ISO C
|
; ISO C floating-point
|
||||||
(set! out (acos in))
|
20 (set! out (acos in))
|
||||||
(set! out (asin in))
|
21 (set! out (asin in))
|
||||||
(set! out (atan in))
|
22 (set! out (atan in))
|
||||||
(set! out (cos in))
|
23 (set! out (cos in))
|
||||||
(set! out (sin in))
|
24 (set! out (sin in))
|
||||||
(set! out (tan in))
|
25 (set! out (tan in))
|
||||||
(set! out (cosh in))
|
26 (set! out (cosh in))
|
||||||
(set! out (sinh in))
|
27 (set! out (sinh in))
|
||||||
(set! out (tanh in))
|
28 (set! out (tanh in))
|
||||||
(set! out (exp in))
|
29 (set! out (exp in))
|
||||||
(set! out (frexp in)) ; float => (float . fixnum)
|
2a (set! out (frexp in)) ; float => (float . fixnum)
|
||||||
(set! out (log in)) ; base e
|
2b (set! out (log in)) ; base e
|
||||||
(set! out (log10 in))
|
2c (set! out (log10 in))
|
||||||
(set! out (modf in)) ; float => (float . float)
|
2d (set! out (modf in)) ; float => (float . float)
|
||||||
(set! out (sqrt in))
|
2e (set! out (sqrt in))
|
||||||
(set! out (ceil in))
|
2f (set! out (ceil in))
|
||||||
(set! out (fabs in))
|
30 (set! out (fabs in))
|
||||||
(set! out (floor in))
|
31 (set! out (floor in))
|
||||||
|
|
||||||
; SVID & X/Open
|
; SVID & X/Open
|
||||||
(set! out (erf in))
|
40 (set! out (erf in))
|
||||||
(set! out (erfc in))
|
41 (set! out (erfc in))
|
||||||
;(set! out (gamma in)) ; obsolete
|
; (set! out (gamma in)) ; obsolete
|
||||||
(set! out (j0 in))
|
42 (set! out (j0 in))
|
||||||
(set! out (j1 in))
|
43 (set! out (j1 in))
|
||||||
(set! out (lgamma in)) ; float => (float . fixnum), actually lgamma_r
|
44 (set! out (lgamma in)) ; float => (float . fixnum), actually lgamma_r
|
||||||
(set! out (y0 in))
|
45 (set! out (y0 in))
|
||||||
(set! out (y1 in))
|
46 (set! out (y1 in))
|
||||||
|
|
||||||
; SVID & XPG 4.2/5
|
; SVID & XPG 4.2/5
|
||||||
(set! out (asinh in))
|
47 (set! out (asinh in))
|
||||||
(set! out (acosh in))
|
48 (set! out (acosh in))
|
||||||
(set! out (atanh in))
|
49 (set! out (atanh in))
|
||||||
(set! out (cbrt in))
|
4a (set! out (cbrt in))
|
||||||
(set! out (logb in))
|
4b (set! out (logb in))
|
||||||
|
|
||||||
; XPG 4.2/5
|
; XPG 4.2/5
|
||||||
(set! out (expm1 in))
|
4c (set! out (expm1 in))
|
||||||
(set! out (ilogb in))
|
4d (set! out (ilogb in))
|
||||||
(set! out (log1p in))
|
4e (set! out (log1p in))
|
||||||
;(set! out (rint in)) ; implies changing rounding mode; use floor or ceil
|
; (set! out (rint in)) ; implies changing rounding mode; use floor or ceil
|
||||||
binary-expr: up to 64, 1 out, 2 in
|
binary-expr: up to 63 (01..3f), 1 out, 2 in
|
||||||
(set! out (cons in1 in2)) ; car cdr
|
00 unary-expr
|
||||||
(set! out (make-vector in1 in2)) ; nelem iv, nelem >= 0
|
01 (set! out (cons in1 in2)) ; car cdr
|
||||||
(set! out (make-byte-string in1 in2)) ; nbytes iv, nbytes >= 0
|
02 (set! out (make-vector in1 in2)) ; nelem iv, nelem >= 0
|
||||||
(set! out (vector-ref in1 in2)) ; vector n, 0 <= n < nelem
|
03 (set! out (make-byte-string in1 in2)) ; nbytes iv, nbytes >= 0
|
||||||
(set! out (byte-string-ref in1 in2)) ; string n, 0 <= n < nbytes
|
04 (set! out (vector-ref in1 in2)) ; vector n, 0 <= n < nelem
|
||||||
(set! out (struct-ref in1 in2)) ; struct n, 0 <= n < nslots
|
05 (set! out (byte-string-ref in1 in2)) ; string n, 0 <= n < nbytes
|
||||||
(set! out (eq? in1 in2)) ; any values; superset of (fix= in2 in1)
|
06 (set! out (struct-ref in1 in2)) ; struct n, 0 <= n < nslots
|
||||||
(set! out (fix+ in1 in2))
|
07 (set! out (eq? in1 in2)) ; any values; superset of (fix= in2 in1)
|
||||||
(set! out (fix- in1 in2))
|
08 (set! out (fix+ in1 in2))
|
||||||
(set! out (fix* in1 in2))
|
09 (set! out (fix- in1 in2))
|
||||||
(set! out (fix/ in1 in2))
|
0a (set! out (fix* in1 in2))
|
||||||
(set! out (fix% in1 in2))
|
0b (set! out (fix/ in1 in2))
|
||||||
(set! out (fix< in1 in2)) ; == (fix> in2 in1)
|
0c (set! out (fix% in1 in2))
|
||||||
(set! out (fix>= in1 in2)) ; == (fix<= in2 in1)
|
0d (set! out (fix< in1 in2)) ; == (fix> in2 in1)
|
||||||
(set! out (bit-and in1 in2))
|
0e (set! out (fix>= in1 in2)) ; == (fix<= in2 in1)
|
||||||
(set! out (bit-or in1 in2))
|
0f (set! out (bit-and in1 in2))
|
||||||
(set! out (bit-xor in1 in2))
|
10 (set! out (bit-or in1 in2))
|
||||||
(set! out (fix<< in1 in2)) ; arithmetic left-shift (2*x) w/ overflow into sign
|
11 (set! out (bit-xor in1 in2))
|
||||||
(set! out (fix>> in1 in2)) ; arithmetic right-shift (x/2)
|
12 (set! out (fix<< in1 in2)) ; arithmetic left-shift (2*x) w/ overflow into sign
|
||||||
(set! out (fix>>> in1 in2)) ; logical right-shift; sign becomes zero (+)
|
13 (set! out (fix>> in1 in2)) ; arithmetic right-shift (x/2)
|
||||||
(set! out (float+ in1 in2))
|
14 (set! out (fix>>> in1 in2)) ; logical right-shift; sign becomes zero (+)
|
||||||
(set! out (float- in1 in2))
|
15 (set! out (float+ in1 in2))
|
||||||
(set! out (float* in1 in2))
|
16 (set! out (float- in1 in2))
|
||||||
(set! out (float/ in1 in2))
|
17 (set! out (float* in1 in2))
|
||||||
(set! out (float< in1 in2)) ; == (float> in2 in1)
|
18 (set! out (float/ in1 in2))
|
||||||
(set! out (float>= in1 in2)) ; == (float<= in2 in1)
|
19 (set! out (float< in1 in2)) ; == (float> in2 in1)
|
||||||
(set! out (atan2 in1 in2)) ; float float
|
1a (set! out (float>= in1 in2)) ; == (float<= in2 in1)
|
||||||
(set! out (pow in1 in2)) ; float float
|
1b (set! out (atan2 in1 in2)) ; float float
|
||||||
(set! out (ldexp in1 in2)) ; float fixnum
|
1c (set! out (pow in1 in2)) ; float float
|
||||||
(set! out (fmod in1 in2)) ; float float
|
1d (set! out (ldexp in1 in2)) ; float fixnum
|
||||||
(set! out (hypot in1 in2)) ; float float
|
1e (set! out (fmod in1 in2)) ; float float
|
||||||
(set! out (jn in1 in2)) ; fixnum float
|
1f (set! out (hypot in1 in2)) ; float float
|
||||||
(set! out (yn in1 in2)) ; fixnum float
|
20 (set! out (jn in1 in2)) ; fixnum float
|
||||||
(set! out (nextafter in1 in2)) ; float float
|
21 (set! out (yn in1 in2)) ; fixnum float
|
||||||
(set! out (remainder in1 in2)) ; float float
|
22 (set! out (nextafter in1 in2)) ; float float
|
||||||
(set! out (scalb in1 in2)) ; float float
|
23 (set! out (remainder in1 in2)) ; float float
|
||||||
|
24 (set! out (scalb in1 in2)) ; float float
|
||||||
conditional: 1AAAAAAA; 1 out, 2 in + fA
|
conditional: 1AAAAAAA; 1 out, 2 in + fA
|
||||||
(set! out (if fA in1 in2)) ; in2 if fA == #f, in1 otherwise
|
AA (set! out (if fA in1 in2)) ; in2 if fA == #f, in1 otherwise
|
||||||
statement: up to 64, 3 in
|
statement: up to 64 (40..7f), 3 in
|
||||||
(set-box! in in) ; box value
|
40 (set-box! in in) ; box value
|
||||||
(set-car! in in) ; pair value
|
41 (set-car! in in) ; pair value
|
||||||
(set-cdr! in in) ; pair value
|
42 (set-cdr! in in) ; pair value
|
||||||
(vector-set! in in in) ; vector n value, 0 <= n < nelem
|
|
||||||
(byte-string-set! in in in) ; string n value, 0 <= n < nbytes
|
60 (vector-set! in in in) ; vector n value, 0 <= n < nelem
|
||||||
(struct-set! in in in) ; struct n value, 1 <= n < nslots
|
61 (byte-string-set! in in in) ; string n value, 0 <= n < nbytes
|
||||||
|
62 (struct-set! in in in) ; struct n value, 0 <= n < nslots
|
||||||
|
|
||||||
in:
|
in:
|
||||||
nil (00000000) [g0, always NIL]
|
nil (00000000) [g0, always NIL]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue