bootstrap.image: better to use the special-object-count constant from kernel.private

db4
Björn Lindqvist 2015-08-12 02:39:02 +02:00 committed by John Benediktsson
parent 8c70f04d41
commit dbb045e2cd
2 changed files with 21 additions and 6 deletions

View File

@ -1,5 +1,5 @@
USING: bootstrap.image bootstrap.image.private tools.test
kernel math ;
USING: arrays assocs bootstrap.image.private kernel math namespaces
sequences tools.test vectors ;
IN: bootstrap.image.tests
{ 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
{ 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

View File

@ -93,8 +93,6 @@ CONSTANT: image-version 4
CONSTANT: data-base 1024
CONSTANT: special-objects-size 80
CONSTANT: header-size 10
CONSTANT: data-heap-size-offset 3
@ -167,7 +165,7 @@ H{ } clone special-objects set-global
: fixup ( value offset -- ) bootstrapping-image get set-nth ;
: heap-size ( -- size )
bootstrapping-image get length header-size - special-objects-size -
bootstrapping-image get length header-size - special-object-count -
bootstrap-cells ;
: here ( -- size ) heap-size data-base + ;
@ -205,7 +203,7 @@ GENERIC: ' ( obj -- ptr )
0 emit ! pointer to bignum 0
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