diff options
author | Andy Wingo <wingo@pobox.com> | 2008-09-02 10:23:05 -0700 |
---|---|---|
committer | Andy Wingo <wingo@pobox.com> | 2008-09-02 10:30:39 -0700 |
commit | 5c4926209fb851c84f55b519c4968dd5b466b707 (patch) | |
tree | d16d3cad148b196b71710b7b392727cc9def2931 | |
parent | 7950b4cffb638cb34ecb79b0696d409d3034f467 (diff) | |
download | guile-5c4926209fb851c84f55b519c4968dd5b466b707.tar.gz |
ditch the 8-bit compiled form of program parameters
* libguile/vm-i-loader.c (load-program):
* module/system/vm/assemble.scm (dump-object!): There are cases in which
we use the 16-bit representation for program params (nargs, nexts,
etc), but the actual 16-bit number actually fits into 8 bits -- which
is then misinterpreted by the loader as the 8-bit form. So ditch the
8-bit form entirely (it was never much of an optimization), and just
use the 16-bit form. Make sure to clear out all your .go files before
recompiling this one!
-rw-r--r-- | libguile/vm-i-loader.c | 25 | ||||
-rw-r--r-- | module/system/vm/assemble.scm | 4 |
2 files changed, 6 insertions, 23 deletions
diff --git a/libguile/vm-i-loader.c b/libguile/vm-i-loader.c index 3b232cbc3..de6f77b08 100644 --- a/libguile/vm-i-loader.c +++ b/libguile/vm-i-loader.c @@ -141,25 +141,12 @@ VM_DEFINE_LOADER (load_program, "load-program") /* NOTE: format defined in system/vm/assemble.scm */ if (SCM_I_INUMP (x)) { - int i = SCM_I_INUM (x); - if (-128 <= i && i <= 127) - { - scm_t_uint8 c = (scm_t_uint8)i; - /* 8-bit representation */ - p->nargs = (c >> 6) & 0x03; /* 7-6 bits */ - p->nrest = (c >> 5) & 0x01; /* 5 bit */ - p->nlocs = (c >> 2) & 0x07; /* 4-2 bits */ - p->nexts = c & 0x03; /* 1-0 bits */ - } - else - { - scm_t_uint16 s = (scm_t_uint16)i; - /* 16-bit representation */ - p->nargs = (s >> 12) & 0x0f; /* 15-12 bits */ - p->nrest = (s >> 11) & 0x01; /* 11 bit */ - p->nlocs = (s >> 4) & 0x7f; /* 10-04 bits */ - p->nexts = s & 0x0f; /* 03-00 bits */ - } + scm_t_uint16 s = (scm_t_uint16)SCM_I_INUM (x); + /* 16-bit representation */ + p->nargs = (s >> 12) & 0x0f; /* 15-12 bits */ + p->nrest = (s >> 11) & 0x01; /* 11 bit */ + p->nlocs = (s >> 4) & 0x7f; /* 10-04 bits */ + p->nexts = s & 0x0f; /* 03-00 bits */ } else { diff --git a/module/system/vm/assemble.scm b/module/system/vm/assemble.scm index aa5f97657..6827de606 100644 --- a/module/system/vm/assemble.scm +++ b/module/system/vm/assemble.scm @@ -250,10 +250,6 @@ (let ((nargs (glil-vars-nargs vars)) (nrest (glil-vars-nrest vars)) (nlocs (glil-vars-nlocs vars)) (nexts (glil-vars-nexts vars))) (cond - ((and (< nargs 4) (< nlocs 8) (< nexts 4)) - ;; 8-bit representation - (let ((x (+ (* nargs 64) (* nrest 32) (* nlocs 4) nexts))) - (push-code! `(make-int8 ,x)))) ((and (< nargs 16) (< nlocs 128) (< nexts 16)) ;; 16-bit representation (let ((x (+ (* nargs 4096) (* nrest 2048) (* nlocs 16) nexts))) |