bootstrap.image: better to use the special-object-count constant from kernel.private
parent
8c70f04d41
commit
dbb045e2cd
|
@ -1,5 +1,5 @@
|
||||||
USING: bootstrap.image bootstrap.image.private tools.test
|
USING: arrays assocs bootstrap.image.private kernel math namespaces
|
||||||
kernel math ;
|
sequences tools.test vectors ;
|
||||||
IN: bootstrap.image.tests
|
IN: bootstrap.image.tests
|
||||||
|
|
||||||
{ f } [ { 1 2 3 } [ 1 2 3 ] eql? ] unit-test
|
{ f } [ { 1 2 3 } [ 1 2 3 ] eql? ] unit-test
|
||||||
|
@ -17,3 +17,20 @@ IN: bootstrap.image.tests
|
||||||
{ f } [ 3 3.0 eql? ] unit-test
|
{ f } [ 3 3.0 eql? ] unit-test
|
||||||
|
|
||||||
{ t } [ 4.0 4.0 eql? ] unit-test
|
{ t } [ 4.0 4.0 eql? ] unit-test
|
||||||
|
|
||||||
|
: foo ( -- )
|
||||||
|
;
|
||||||
|
|
||||||
|
{ foo } [
|
||||||
|
100 0 <array> [
|
||||||
|
bootstrapping-image set \ foo 1 emit-special-object
|
||||||
|
] keep 11 swap nth
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
{ 20 } [
|
||||||
|
H{ } [ special-objects set emit-jit-data ] keep assoc-size
|
||||||
|
] unit-test
|
||||||
|
|
||||||
|
{ 90 } [
|
||||||
|
50 <vector> [ bootstrapping-image set emit-image-header ] keep length
|
||||||
|
] unit-test
|
||||||
|
|
|
@ -93,8 +93,6 @@ CONSTANT: image-version 4
|
||||||
|
|
||||||
CONSTANT: data-base 1024
|
CONSTANT: data-base 1024
|
||||||
|
|
||||||
CONSTANT: special-objects-size 80
|
|
||||||
|
|
||||||
CONSTANT: header-size 10
|
CONSTANT: header-size 10
|
||||||
|
|
||||||
CONSTANT: data-heap-size-offset 3
|
CONSTANT: data-heap-size-offset 3
|
||||||
|
@ -167,7 +165,7 @@ H{ } clone special-objects set-global
|
||||||
: fixup ( value offset -- ) bootstrapping-image get set-nth ;
|
: fixup ( value offset -- ) bootstrapping-image get set-nth ;
|
||||||
|
|
||||||
: heap-size ( -- size )
|
: heap-size ( -- size )
|
||||||
bootstrapping-image get length header-size - special-objects-size -
|
bootstrapping-image get length header-size - special-object-count -
|
||||||
bootstrap-cells ;
|
bootstrap-cells ;
|
||||||
|
|
||||||
: here ( -- size ) heap-size data-base + ;
|
: here ( -- size ) heap-size data-base + ;
|
||||||
|
@ -205,7 +203,7 @@ GENERIC: ' ( obj -- ptr )
|
||||||
0 emit ! pointer to bignum 0
|
0 emit ! pointer to bignum 0
|
||||||
0 emit ! pointer to bignum 1
|
0 emit ! pointer to bignum 1
|
||||||
0 emit ! pointer to bignum -1
|
0 emit ! pointer to bignum -1
|
||||||
special-objects-size [ f ' emit ] times ;
|
special-object-count [ f ' emit ] times ;
|
||||||
|
|
||||||
! Bignums
|
! Bignums
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue