* representation (tags) of bignums/flonums changed successfully.

This commit is contained in:
Abdulaziz Ghuloum 2007-01-21 20:36:22 -05:00
parent 1c37a4ee54
commit d6c2d5dd66
6 changed files with 15 additions and 11 deletions

Binary file not shown.

View File

@ -1044,6 +1044,14 @@ add_object_proc(gc_t* gc, ikp x)
ref(x, wordsize-vector_tag) = y;
return y;
}
else if(fst == flonum_tag){
ikp new = gc_alloc_new_data(flonum_size, gen, gc) + vector_tag;
ref(new, -vector_tag) = flonum_tag;
flonum_data(new) = flonum_data(x);
ref(x, -vector_tag) = forward_ptr;
ref(x, wordsize-vector_tag) = new;
return new;
}
else if((((int)fst) & bignum_mask) == bignum_tag){
int len = ((unsigned int)fst) >> bignum_length_shift;
int memreq = align(disp_bignum_data + len*wordsize);
@ -1053,14 +1061,6 @@ add_object_proc(gc_t* gc, ikp x)
ref(x, wordsize-vector_tag) = new;
return new;
}
else if(fst == flonum_tag){
ikp new = gc_alloc_new_data(flonum_size, gen, gc) + vector_tag;
ref(new, -vector_tag) = flonum_tag;
flonum_data(new) = flonum_data(x);
ref(x, -vector_tag) = forward_ptr;
ref(x, wordsize-vector_tag) = new;
return new;
}
else {
fprintf(stderr, "unhandled vector with fst=0x%08x\n", (int)fst);
exit(-1);

View File

@ -189,14 +189,14 @@
#define bignum_mask 0x7
#define bignum_tag 0x2
#define bignum_tag 0x3
#define bignum_sign_mask 0x8
#define bignum_sign_shift 3
#define bignum_length_shift 4
#define disp_bignum_data wordsize
#define off_bignum_data (disp_bignum_data - vector_tag)
#define flonum_tag ((ikp)0x6F)
#define flonum_tag ((ikp)0x17)
#define flonum_size 16
#define disp_flonum_data 8
#define off_flonum_data (disp_flonum_data - vector_tag)

View File

@ -11,6 +11,9 @@
#define max_digits_per_limb 10
#ifdef NDEBUG
#define verify_bignum(x,caller) (x)
#else
static ikp
verify_bignum(ikp x, char* caller){
if(tagof(x) != vector_tag){
@ -58,6 +61,7 @@ verify_bignum(ikp x, char* caller){
/* ok */
return x;
}
#endif
#define BN(x) verify_bignum(x,"BN")

Binary file not shown.

View File

@ -40,7 +40,7 @@
(define binary+
(lambda (x y)
(cond
[(fixnum? x)
[(fixnum? x)
(cond
[(fixnum? y)
(foreign-call "ikrt_fxfxplus" x y)]