diff --git a/i.c b/i.c index 81834db..937448f 100644 --- a/i.c +++ b/i.c @@ -93,19 +93,31 @@ static obj *init_modules(obj *r, obj *sp, obj *hp); #define VM_STACK_RSZ 64 /* red zone for overflow checks */ #define VM_STACK_GSZ (VM_STACK_LEN-VM_STACK_RSZ) +/* box representation extras */ +#define boxbsz() hbsz(1+1) +#define hend_box() (*--hp = obj_from_size(BOX_BTAG), hendblk(1+1)) + +/* pair representation extras */ +#define pairbsz() hbsz(2+1) +#define hend_pair() (*--hp = obj_from_size(PAIR_BTAG), hendblk(2+1)) + +/* vector representation extras */ +#define vecbsz(n) hbsz((n)+1) +#define hend_vec(n) (*--hp = obj_from_size(VECTOR_BTAG), hendblk((n)+1)) + /* vm closure representation */ #ifdef NDEBUG /* quick */ #define isvmclo(x) (isobjptr(x) && isobjptr(hblkref(x, 0))) #define vmcloref(x,i) hblkref(x, i) #define vmclolen(x) hblklen(x) #define vmclobsz(c) hbsz(c) -#define hpushvmclo(c) hendblk(c) +#define hend_vmclo(c) hendblk(c) #else /* slow but thorough */ #define isvmclo isprocedure #define vmcloref *procedureref #define vmclolen procedurelen #define vmclobsz(c) hbsz(c) -#define hpushvmclo(c) hendblk(c) +#define hend_vmclo(c) hendblk(c) #endif /* vm tuple representation (c != 1) */ @@ -113,7 +125,7 @@ static obj *init_modules(obj *r, obj *sp, obj *hp); #define tupleref recordref #define tuplelen recordlen #define tuplebsz(c) hbsz((c)+2) -#define hpushtuple(c) (*--hp = 0, *--hp = obj_from_size(RECORD_BTAG), hendblk((c)+2)) +#define hend_tuple(c) (*--hp = 0, *--hp = obj_from_size(RECORD_BTAG), hendblk((c)+2)) /* in/re-loading gc-save shadow registers */ #define unload_ip() (rx = obj_from_fixnum(ip - &vectorref(vmcloref(rd, 0), 0))) @@ -142,12 +154,31 @@ static void _sck(obj *s) { #define sgrow(n) (sp += (n)) #endif +/* reserving heap memory inside instructions */ #define hp_reserve(n) do { \ if (unlikely(hp < cxg_heap + (n))) { \ unload_ac(); unload_ip(); \ hp = cxm_hgc(r, sp, hp, n); \ reload_ac(); reload_ip(); \ } } while (0) +#define hp_reserve_inline(n) \ + ((hp < cxg_heap + (n)) \ + ? (unload_ac(), unload_ip(), hp = cxm_hgc(r, sp, hp, (n)), reload_ac(), reload_ip(), hp) \ + : hp) +#define hp_pushptr(p, pt) \ + (hp_reserve_inline(2), *--hp = (obj)(p), *--hp = (obj)(pt), (obj)(hp+1)) + +/* small object representation extras */ +#define bool_obj(b) obj_from_bool(b) +#define char_obj(b) obj_from_char(b) +#define eof_obj() mkeof() +#define fixnum_obj(x) obj_from_fixnum(x) +#define flonum_obj(x) hp_pushptr(dupflonum(x), FLONUM_NTAG) +#define string_obj(s) hp_pushptr((s), STRING_NTAG) +#define iport_file_obj(fp) hp_pushptr((fp), IPORT_FILE_NTAG) +#define oport_file_obj(fp) hp_pushptr((fp), OPORT_FILE_NTAG) +#define iport_string_obj(fp) hp_pushptr((fp), IPORT_STRING_NTAG) +#define oport_string_obj(fp) hp_pushptr((fp), OPORT_STRING_NTAG) /* cxi instructions protocol; retval is new hp: */ typedef obj* regcall (*ins_t)(IPARAMS); @@ -233,7 +264,7 @@ jump: /* r[0] = k; r[1] = code */ hreserve(vmclobsz(1), 2); /* 2 live regs */ *--hp = r[1]; - r[2] = hpushvmclo(1); + r[2] = hend_vmclo(1); r[1] = obj_from_ktrap(); pc = objptr_from_obj(r[0])[0]; rc = 3; @@ -388,7 +419,7 @@ define_instrhelper(cxi_fail) { define_instrhelper(cxi_failactype) { char *msg = (char*)spop(); obj p; fprintf(stderr, "run-time failure: argument is not a %s:\n", msg); - p = mkoport_file(sp-r, stderr); spush(p); + p = oport_file_obj(stderr); spush(p); oportputcircular(ac, p, 0); fputc('\n', stderr); spop(); @@ -473,17 +504,16 @@ define_instruction(dclose) { hp_reserve(vmclobsz(c)); for (i = n-1; i >= 0; --i) *--hp = sref(i); /* display */ *--hp = *ip++; /* code */ - ac = hpushvmclo(c); /* closure */ + ac = hend_vmclo(c); /* closure */ sdrop(n); gonexti(); } define_instruction(sbox) { int i = fixnum_from_obj(*ip++); - hp_reserve(hbsz(1+1)); + hp_reserve(boxbsz()); *--hp = sref(i); - *--hp = obj_from_size(BOX_BTAG); - sref(i) = hendblk(1+1); + sref(i) = hend_box(); gonexti(); } @@ -542,8 +572,8 @@ define_instruction(appl) { int n, i; obj l = spop(), t = l; for (n = 0; ispair(t); t = cdr(t)) ++n; sgrow(n); for (i = 0; i < n; ++i, l = cdr(l)) sref(i) = car(l); - ckx(ac); rd = ac; rx = obj_from_fixnum(0); - ac = obj_from_fixnum(n); /* argc */ + ckx(ac); rd = ac; rx = fixnum_obj(0); + ac = fixnum_obj(n); /* argc */ callsubi(); } @@ -557,16 +587,16 @@ define_instruction(cwmv) { sp = r + VM_REGC; /* stack is empty */ memcpy(sp, &vmcloref(x, 1), n*sizeof(obj)); sp += n; /* contains n elements now */ - rd = t; rx = obj_from_fixnum(0); - ac = obj_from_fixnum(0); + rd = t; rx = fixnum_obj(0); + ac = fixnum_obj(0); callsubi(); } else { /* arrange return to cwmv code w/x */ spush(x); spush(cx_callmv_2Dadapter_2Dclosure); - spush(obj_from_fixnum(0)); + spush(fixnum_obj(0)); /* call the producer */ - rd = t; rx = obj_from_fixnum(0); ac = obj_from_fixnum(0); + rd = t; rx = fixnum_obj(0); ac = fixnum_obj(0); callsubi(); } } @@ -575,14 +605,14 @@ define_instruction(rcmv) { /* single-value producer call returns here with result in ac, cns on stack */ obj val = ac, x = spop(); /* tail-call the consumer with the returned value */ - spush(val); ac = obj_from_fixnum(1); - rd = x; rx = obj_from_fixnum(0); + spush(val); ac = fixnum_obj(1); + rd = x; rx = fixnum_obj(0); callsubi(); } define_instruction(sdmv) { /* sending values on stack, ac contains argc */ - if (ac == obj_from_fixnum(1)) { + if (ac == fixnum_obj(1)) { /* can return anywhere, including rcmv */ ac = spop(); rx = spop(); @@ -591,16 +621,16 @@ define_instruction(sdmv) { } else { /* can only pseudo-return to rcmv */ int n = fixnum_from_obj(ac), m = 3, i; - if (sref(n) == obj_from_fixnum(0) && sref(n+1) == cx_callmv_2Dadapter_2Dclosure) { + if (sref(n) == fixnum_obj(0) && sref(n+1) == cx_callmv_2Dadapter_2Dclosure) { /* tail-call the consumer with the produced values */ - rd = sref(n+2); rx = obj_from_fixnum(0); /* cns */ + rd = sref(n+2); rx = fixnum_obj(0); /* cns */ /* NB: can be sped up for popular cases: n == 0, n == 2 */ memmove((void*)(sp-n-m), (void*)(sp-n), (size_t)n*sizeof(obj)); sdrop(m); callsubi(); } else { /* return args as a tuple (n != 1) */ hp_reserve(tuplebsz(n)); for (i = n-1; i >= 0; --i) *--hp = sref(i); - ac = hpushtuple(n); + ac = hend_tuple(n); sdrop(n); rx = spop(); rd = spop(); @@ -616,7 +646,7 @@ define_instruction(lck) { hp_reserve(vmclobsz(n+1)); hp -= n; memcpy(hp, sp-n-m, n*sizeof(obj)); *--hp = cx_continuation_2Dadapter_2Dcode; - ac = hpushvmclo(n+1); + ac = hend_vmclo(n+1); gonexti(); } @@ -626,7 +656,7 @@ define_instruction(lck0) { hp_reserve(vmclobsz(n+1)); hp -= n; memcpy(hp, sp-n, n*sizeof(obj)); *--hp = cx_continuation_2Dadapter_2Dcode; - ac = hendblk(n+1); + ac = hend_vmclo(n+1); gonexti(); } @@ -639,8 +669,8 @@ define_instruction(wck) { sp = r + VM_REGC; /* stack is empty */ memcpy(sp, &vmcloref(x, 1), n*sizeof(obj)); sp += n; /* contains n elements now */ - rd = t; rx = obj_from_fixnum(0); - ac = obj_from_fixnum(0); + rd = t; rx = fixnum_obj(0); + ac = fixnum_obj(0); callsubi(); } @@ -661,15 +691,15 @@ define_instruction(wckr) { define_instruction(rck) { /* in: ac:argc, args on stack, rd display is saved stack */ - if (ac == obj_from_fixnum(1)) { /* easy, popular case */ + if (ac == fixnum_obj(1)) { /* easy, popular case */ ac = rd; goi(wckr); } else { /* multiple results case */ int c = fixnum_from_obj(ac), n = vmclolen(rd) - 1, i; obj *ks = &vmcloref(rd, 1), *ke = ks + n; - if (ke-ks > 3 && *--ke == obj_from_fixnum(0) && *--ke == cx_callmv_2Dadapter_2Dclosure) { + if (ke-ks > 3 && *--ke == fixnum_obj(0) && *--ke == cx_callmv_2Dadapter_2Dclosure) { obj *sb = r + VM_REGC; - rd = *--ke; rx = obj_from_fixnum(0); n = ke - ks; /* cns */ + rd = *--ke; rx = fixnum_obj(0); n = ke - ks; /* cns */ /* arrange stack as follows: [ks..ke] [arg ...] */ assert((cxg_rend - cxg_regs - VM_REGC) > n + c); if (c) memmove(sb+n, sp-c, c*sizeof(obj)); @@ -678,7 +708,7 @@ define_instruction(rck) { } else { /* return args as a tuple (c != 1) */ hp_reserve(tuplebsz(c)); for (i = c-1; i >= 0; --i) *--hp = sref(i); - ac = hpushtuple(c); + ac = hend_tuple(c); sdrop(c); spush(ac); ac = rd; @@ -690,7 +720,7 @@ define_instruction(rck) { define_instruction(save) { int dx = fixnum_from_obj(*ip++); spush(rd); - spush(obj_from_fixnum(ip + dx - &vectorref(vmcloref(rd, 0), 0))); + spush(fixnum_obj(ip + dx - &vectorref(vmcloref(rd, 0), 0))); gonexti(); } @@ -700,7 +730,7 @@ define_instruction(jdceq) { obj v = *ip++, i = *ip++; if (ac == v) { rd = dref(fixnum_from_obj(i)); - rx = obj_from_fixnum(0); + rx = fixnum_obj(0); callsubi(); } gonexti(); @@ -710,7 +740,7 @@ define_instruction(jdcge) { obj v = *ip++, i = *ip++; if (ac >= v) { /* unsigned tagged fixnums can be compared as-is */ rd = dref(fixnum_from_obj(i)); - rx = obj_from_fixnum(0); + rx = fixnum_obj(0); callsubi(); } gonexti(); @@ -719,21 +749,21 @@ define_instruction(jdcge) { define_instruction(jdref) { int i = fixnum_from_obj(*ip++); rd = dref(i); - rx = obj_from_fixnum(0); + rx = fixnum_obj(0); callsubi(); } define_instruction(call) { int n = fixnum_from_obj(*ip++); - ckx(ac); rd = ac; rx = obj_from_fixnum(0); - ac = obj_from_fixnum(n); /* argc */ + ckx(ac); rd = ac; rx = fixnum_obj(0); + ac = fixnum_obj(n); /* argc */ callsubi(); } define_instruction(scall) { int m = fixnum_from_obj(*ip++), n = fixnum_from_obj(*ip++); - ckx(ac); rd = ac; rx = obj_from_fixnum(0); - ac = obj_from_fixnum(n); /* argc */ + ckx(ac); rd = ac; rx = fixnum_obj(0); + ac = fixnum_obj(n); /* argc */ memmove((void*)(sp-n-m), (void*)(sp-n), (size_t)n*sizeof(obj)); sdrop(m); callsubi(); @@ -779,18 +809,17 @@ define_instruction(shrarg) { spush(mknull()); } else { obj l = mknull(); - hp_reserve(hbsz(2+1)*m); + hp_reserve(pairbsz()*m); while (m > 0) { *--hp = l; *--hp = sref(n + m - 1); - *--hp = obj_from_size(PAIR_BTAG); - l = hendblk(2+1); + l = hend_pair(); --m; } memmove((void*)(sp-c), (void*)(sp-n), (size_t)n*sizeof(obj)); sdrop(c-n); spush(l); } - ac = obj_from_fixnum(n+1); + ac = fixnum_obj(n+1); gonexti(); } @@ -807,7 +836,7 @@ define_instruction(shlit) { define_instruction(shi0) { spush(ac); - ac = obj_from_fixnum(0); + ac = fixnum_obj(0); gonexti(); } @@ -834,19 +863,19 @@ define_instruction(ckz) { ckz(ac); gonexti(); } define_instruction(isq) { obj x = ac, y = spop(); - ac = obj_from_bool(x == y); + ac = bool_obj(x == y); gonexti(); } define_instruction(isv) { obj x = ac, y = spop(); - ac = obj_from_bool(iseqv(x,y)); + ac = bool_obj(iseqv(x,y)); gonexti(); } define_instruction(ise) { obj x = ac, y = spop(); - ac = obj_from_bool(isequal(x,y)); + ac = bool_obj(isequal(x,y)); gonexti(); } @@ -854,10 +883,9 @@ define_instruction(unbox) { ckz(ac); ac = boxref(ac); gonexti(); } define_instruction(setbox) { ckz(ac); boxref(ac) = spop(); gonexti(); } define_instruction(box) { - hp_reserve(hbsz(1+1)); + hp_reserve(boxbsz()); *--hp = ac; - *--hp = obj_from_size(BOX_BTAG); - ac = hendblk(1+1); + ac = hend_box(); gonexti(); } @@ -873,37 +901,35 @@ define_instruction(cddr) { ckp(ac); ac = cdr(ac); ckp(ac); ac = cdr(ac); gonexti define_instruction(nullp) { - ac = obj_from_bool(isnull(ac)); + ac = bool_obj(isnull(ac)); gonexti(); } define_instruction(pairp) { - ac = obj_from_bool(ispair(ac)); + ac = bool_obj(ispair(ac)); gonexti(); } define_instruction(cons) { - hp_reserve(hbsz(2+1)); + hp_reserve(pairbsz()); *--hp = spop(); /* cdr */ *--hp = ac; /* car */ - *--hp = obj_from_size(PAIR_BTAG); - ac = hendblk(2+1); + ac = hend_pair(); gonexti(); } define_instruction(listp) { - ac = obj_from_bool(islist(ac)); + ac = bool_obj(islist(ac)); gonexti(); } define_instruction(list) { int i, n = fixnum_from_obj(*ip++); - hp_reserve(hbsz(2+1)*n); + hp_reserve(pairbsz()*n); for (ac = mknull(), i = n-1; i >= 0; --i) { *--hp = ac; /* cdr */ *--hp = sref(i); /* car */ - *--hp = obj_from_size(PAIR_BTAG); - ac = hendblk(2+1); + ac = hend_pair(); } sdrop(n); gonexti(); @@ -912,13 +938,12 @@ define_instruction(list) { define_instruction(lmk) { int i, n; obj v; ckk(ac); n = fixnum_from_obj(ac); - hp_reserve(hbsz(2+1)*n); v = sref(0); + hp_reserve(pairbsz()*n); v = sref(0); ac = mknull(); for (i = 0; i < n; ++i) { *--hp = ac; /* cdr */ *--hp = v; /* car */ - *--hp = obj_from_size(PAIR_BTAG); - ac = hendblk(2+1); + ac = hend_pair(); } sdrop(1); gonexti(); @@ -927,7 +952,7 @@ define_instruction(lmk) { define_instruction(llen) { int n = 0; while (ispair(ac)) { ac = cdr(ac); ++n; } - ac = obj_from_fixnum(n); + ac = fixnum_obj(n); gonexti(); } @@ -953,7 +978,7 @@ define_instruction(memq) { for (; ispair(l); l = cdr(l)) { if (car(l) == ac) { ac = l; gonexti(); } } - ac = obj_from_bool(0); + ac = bool_obj(0); gonexti(); } @@ -972,7 +997,7 @@ define_instruction(assq) { for (; ispair(l); l = cdr(l)) { obj p = car(l); if (ispair(p) && car(p) == ac) { ac = p; gonexti(); } } - ac = obj_from_bool(0); + ac = bool_obj(0); gonexti(); } @@ -994,7 +1019,7 @@ define_instruction(ltail) { } define_instruction(lpair) { - obj l = obj_from_bool(0); + obj l = bool_obj(0); while (ispair(ac)) { l = ac; ac = cdr(ac); } ac = l; gonexti(); @@ -1003,10 +1028,10 @@ define_instruction(lpair) { define_instruction(lrev) { obj l = ac, o = mknull(); int n = 0; while (ispair(ac)) { ac = cdr(ac); ++n; } - hp_reserve(hbsz(2+1)*n); + hp_reserve(pairbsz()*n); for (ac = l; ac != mknull(); ac = cdr(ac)) { *--hp = o; *--hp = car(ac); - *--hp = obj_from_size(PAIR_BTAG); o = hendblk(2+1); + o = hend_pair(); } ac = o; gonexti(); @@ -1020,18 +1045,18 @@ define_instruction(lrevi) { } define_instruction(charp) { - ac = obj_from_bool(ischar(ac)); + ac = bool_obj(ischar(ac)); gonexti(); } define_instruction(strp) { - ac = obj_from_bool(isstring(ac)); + ac = bool_obj(isstring(ac)); gonexti(); } define_instruction(str) { int i, n = fixnum_from_obj(*ip++); - obj o = hpushstr(sp-r, allocstring(n, ' ')); + obj o = string_obj(allocstring(n, ' ')); unsigned char *s = (unsigned char *)stringchars(o); for (i = 0; i < n; ++i) { obj x = sref(i); ckc(x); s[i] = char_from_obj(x); @@ -1044,13 +1069,13 @@ define_instruction(smk) { int n, c; obj x = spop(); ckk(ac); ckc(x); n = fixnum_from_obj(ac), c = char_from_obj(x); - ac = hpushstr(sp-r, allocstring(n, c)); + ac = string_obj(allocstring(n, c)); gonexti(); } define_instruction(slen) { cks(ac); - ac = obj_from_fixnum(stringlen(ac)); + ac = fixnum_obj(stringlen(ac)); gonexti(); } @@ -1059,7 +1084,7 @@ define_instruction(sget) { cks(ac); ckk(x); i = fixnum_from_obj(x); if (i >= stringlen(ac)) failtype(x, "valid string index"); - ac = obj_from_char(*stringref(ac, i)); + ac = char_obj(*stringref(ac, i)); gonexti(); } @@ -1076,7 +1101,7 @@ define_instruction(scat) { obj x = ac, y = spop(); int *d; cks(x); cks(y); d = stringcat(stringdata(x), stringdata(y)); - ac = hpushstr(sp-r, d); + ac = string_obj(d); gonexti(); } @@ -1087,21 +1112,20 @@ define_instruction(ssub) { if (is > ie) failtype(x, "valid start string index"); if (ie > stringlen(ac)) failtype(y, "valid end string index"); d = substring(stringdata(ac), is, ie); - ac = hpushstr(sp-r, d); + ac = string_obj(d); gonexti(); } define_instruction(vecp) { - ac = obj_from_bool(isvector(ac)); + ac = bool_obj(isvector(ac)); gonexti(); } define_instruction(vec) { int i, n = fixnum_from_obj(*ip++); - hp_reserve(hbsz(n+1)); + hp_reserve(vecbsz(n)); for (i = n-1; i >= 0; --i) *--hp = sref(i); - *--hp = obj_from_size(VECTOR_BTAG); - ac = hendblk(n+1); + ac = hend_vec(n); sdrop(n); gonexti(); } @@ -1109,17 +1133,16 @@ define_instruction(vec) { define_instruction(vmk) { int i, n; obj v; ckk(ac); n = fixnum_from_obj(ac); - hp_reserve(hbsz(n+1)); v = sref(0); + hp_reserve(vecbsz(n)); v = sref(0); for (i = 0; i < n; ++i) *--hp = v; - *--hp = obj_from_size(VECTOR_BTAG); - ac = hendblk(n+1); + ac = hend_vec(n); sdrop(1); gonexti(); } define_instruction(vlen) { ckv(ac); - ac = obj_from_fixnum(vectorlen(ac)); + ac = fixnum_obj(vectorlen(ac)); gonexti(); } @@ -1145,12 +1168,11 @@ define_instruction(vcat) { obj x = ac, y = sref(0); int n1, n2, n; ckv(x); ckv(y); n1 = vectorlen(x), n2 = vectorlen(y), n = n1 + n2; - hp_reserve(hbsz(n+1)); + hp_reserve(vecbsz(n)); /* NB: vectorref fails to return pointer to empty vector's start */ hp -= n2; if (n2) memcpy(hp, &vectorref(y, 0), n2*sizeof(obj)); hp -= n1; if (n1) memcpy(hp, &vectorref(x, 0), n1*sizeof(obj)); - *--hp = obj_from_size(VECTOR_BTAG); - ac = hendblk(n+1); + ac = hend_vec(n); sdrop(1); gonexti(); } @@ -1158,11 +1180,10 @@ define_instruction(vcat) { define_instruction(vtol) { obj l = mknull(); int n; ckv(ac); n = vectorlen(ac); - hp_reserve(hbsz(2+1)*n); + hp_reserve(pairbsz()*n); while (n > 0) { *--hp = l; *--hp = vectorref(ac, n-1); - *--hp = obj_from_size(PAIR_BTAG); - l = hendblk(2+1); + l = hend_pair(); --n; } ac = l; @@ -1172,21 +1193,19 @@ define_instruction(vtol) { define_instruction(ltov) { obj l = ac; int n = 0, i; while (ispair(l)) { l = cdr(l); ++n; } - hp_reserve(hbsz(n+1)); + hp_reserve(vecbsz(n)); for (l = ac, i = 0, hp -= n; i < n; ++i, l = cdr(l)) hp[i] = car(l); - *--hp = obj_from_size(VECTOR_BTAG); - ac = hendblk(n+1); + ac = hend_vec(n); gonexti(); } define_instruction(stol) { obj l = mknull(); int n; cks(ac); n = stringlen(ac); - hp_reserve(hbsz(2+1)*n); + hp_reserve(pairbsz()*n); while (n > 0) { - *--hp = l; *--hp = obj_from_char(*stringref(ac, n-1)); - *--hp = obj_from_size(PAIR_BTAG); - l = hendblk(2+1); + *--hp = l; *--hp = char_obj(*stringref(ac, n-1)); + l = hend_pair(); --n; } ac = l; @@ -1199,13 +1218,13 @@ define_instruction(ltos) { d = allocstring(n, ' '); for (i = 0; i < n; ac = cdr(ac), ++i) sdatachars(d)[i] = char_from_obj(car(ac)); - ac = hpushstr(sp-r, d); + ac = string_obj(d); gonexti(); } define_instruction(ytos) { cky(ac); - ac = hpushstr(sp-r, newstring(symbolname(getsymbol(ac)))); + ac = string_obj(newstring(symbolname(getsymbol(ac)))); gonexti(); } @@ -1226,7 +1245,7 @@ define_instruction(itos) { do { int d = num % radix; *--s = d < 10 ? d + '0' : d - 10 + 'a'; } while (num /= radix); if (neg) *--s = '-'; - ac = hpushstr(sp-r, newstring(s)); + ac = string_obj(newstring(s)); gonexti(); } @@ -1240,20 +1259,20 @@ define_instruction(stoi) { else if (s[0] == '#' && (s[1] == 'd' || s[1] == 'D')) s += 2, radix = 10; else if (s[0] == '#' && (s[1] == 'x' || s[1] == 'X')) s += 2, radix = 16; l = (errno = 0, strtol(s, &e, radix)); - if (errno || l < FIXNUM_MIN || l > FIXNUM_MAX || e == s || *e) ac = obj_from_bool(0); - else ac = obj_from_fixnum(l); + if (errno || l < FIXNUM_MIN || l > FIXNUM_MAX || e == s || *e) ac = bool_obj(0); + else ac = fixnum_obj(l); gonexti(); } define_instruction(ctoi) { ckc(ac); - ac = obj_from_fixnum(char_from_obj(ac)); + ac = fixnum_obj(char_from_obj(ac)); gonexti(); } define_instruction(itoc) { cki(ac); /* TODO: range check? */ - ac = obj_from_char(fixnum_from_obj(ac)); + ac = char_obj(fixnum_from_obj(ac)); gonexti(); } @@ -1264,7 +1283,7 @@ define_instruction(jtos) { if (d != d) strcpy(buf, "+nan.0"); else if (d <= -HUGE_VAL) strcpy(buf, "-inf.0"); else if (d >= HUGE_VAL) strcpy(buf, "+inf.0"); else if (*s == 'E') *s = 'e'; else if (*s == 0) { *s++ = '.'; *s++ = '0'; *s = 0; } - ac = hpushstr(sp-r, newstring(buf)); + ac = string_obj(newstring(buf)); gonexti(); } @@ -1275,14 +1294,14 @@ define_instruction(stoj) { else if (strcmp_ci(s+1, "inf.0") == 0) d = (*s == '-' ? -HUGE_VAL : HUGE_VAL); else if (strcmp_ci(s+1, "nan.0") == 0) d = HUGE_VAL - HUGE_VAL; else d = strtod(s, &e); - if (errno || e == s || *e) ac = obj_from_bool(0); - else ac = obj_from_flonum(sp-r, d); + if (errno || e == s || *e) ac = bool_obj(0); + else ac = flonum_obj(d); gonexti(); } define_instruction(ntos) { if (is_fixnum_obj(ac)) goi(itos); - if (unlikely(spop() != obj_from_fixnum(10))) fail("non-10 radix in flonum conversion"); + if (unlikely(spop() != fixnum_obj(10))) fail("non-10 radix in flonum conversion"); goi(jtos); } @@ -1292,77 +1311,77 @@ define_instruction(ston) { s = stringchars(x); radix = fixnum_from_obj(y); if (radix < 2 || radix > 10 + 'z' - 'a') failtype(y, "valid radix"); switch (strtofxfl(s, radix, &l, &d)) { - case 'e': ac = obj_from_fixnum(l); break; - case 'i': ac = obj_from_flonum(sp-r, d); break; - default : ac = obj_from_bool(0); break; + case 'e': ac = fixnum_obj(l); break; + case 'i': ac = flonum_obj(d); break; + default : ac = bool_obj(0); break; } gonexti(); } define_instruction(not) { - ac = obj_from_bool(ac == 0); + ac = bool_obj(ac == 0); gonexti(); } define_instruction(izerop) { cki(ac); - ac = obj_from_bool(ac == obj_from_fixnum(0)); + ac = bool_obj(ac == fixnum_obj(0)); gonexti(); } define_instruction(iposp) { cki(ac); - ac = obj_from_bool(fixnum_from_obj(ac) > 0); + ac = bool_obj(fixnum_from_obj(ac) > 0); gonexti(); } define_instruction(inegp) { cki(ac); - ac = obj_from_bool(fixnum_from_obj(ac) < 0); + ac = bool_obj(fixnum_from_obj(ac) < 0); gonexti(); } define_instruction(ievnp) { cki(ac); - ac = obj_from_bool((fixnum_from_obj(ac) & 1) == 0); + ac = bool_obj((fixnum_from_obj(ac) & 1) == 0); gonexti(); } define_instruction(ioddp) { cki(ac); - ac = obj_from_bool((fixnum_from_obj(ac) & 1) != 0); + ac = bool_obj((fixnum_from_obj(ac) & 1) != 0); gonexti(); } define_instruction(iadd) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_fixnum(fxadd(fixnum_from_obj(x), fixnum_from_obj(y))); + ac = fixnum_obj(fxadd(fixnum_from_obj(x), fixnum_from_obj(y))); gonexti(); } define_instruction(isub) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_fixnum(fxsub(fixnum_from_obj(x), fixnum_from_obj(y))); + ac = fixnum_obj(fxsub(fixnum_from_obj(x), fixnum_from_obj(y))); gonexti(); } define_instruction(imul) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_fixnum(fxmul(fixnum_from_obj(x), fixnum_from_obj(y))); + ac = fixnum_obj(fxmul(fixnum_from_obj(x), fixnum_from_obj(y))); gonexti(); } define_instruction(iquo) { obj x = ac, y = spop(); cki(x); cki(y); - if (y == obj_from_fixnum(0)) fail("division by zero"); - ac = obj_from_fixnum(fxquo(fixnum_from_obj(x), fixnum_from_obj(y))); + if (y == fixnum_obj(0)) fail("division by zero"); + ac = fixnum_obj(fxquo(fixnum_from_obj(x), fixnum_from_obj(y))); gonexti(); } define_instruction(irem) { obj x = ac, y = spop(); cki(x); cki(y); - if (y == obj_from_fixnum(0)) fail("division by zero"); - ac = obj_from_fixnum(fxrem(fixnum_from_obj(x), fixnum_from_obj(y))); + if (y == fixnum_obj(0)) fail("division by zero"); + ac = fixnum_obj(fxrem(fixnum_from_obj(x), fixnum_from_obj(y))); gonexti(); } @@ -1380,271 +1399,271 @@ define_instruction(imax) { define_instruction(ineg) { cki(ac); - ac = obj_from_fixnum(fxneg(fixnum_from_obj(ac))); + ac = fixnum_obj(fxneg(fixnum_from_obj(ac))); gonexti(); } define_instruction(iabs) { cki(ac); - ac = obj_from_fixnum(fxabs(fixnum_from_obj(ac))); + ac = fixnum_obj(fxabs(fixnum_from_obj(ac))); gonexti(); } define_instruction(itoj) { cki(ac); - ac = obj_from_flonum(sp-r, (double)fixnum_from_obj(ac)); + ac = flonum_obj((double)fixnum_from_obj(ac)); gonexti(); } define_instruction(idiv) { obj x = ac, y = spop(); cki(x); cki(y); - if (y == obj_from_fixnum(0)) fail("division by zero"); - ac = obj_from_fixnum(fxdiv(fixnum_from_obj(x), fixnum_from_obj(y))); + if (y == fixnum_obj(0)) fail("division by zero"); + ac = fixnum_obj(fxdiv(fixnum_from_obj(x), fixnum_from_obj(y))); gonexti(); } define_instruction(imqu) { obj x = ac, y = spop(); cki(x); cki(y); - if (y == obj_from_fixnum(0)) fail("division by zero"); - ac = obj_from_fixnum(fxmqu(fixnum_from_obj(x), fixnum_from_obj(y))); + if (y == fixnum_obj(0)) fail("division by zero"); + ac = fixnum_obj(fxmqu(fixnum_from_obj(x), fixnum_from_obj(y))); gonexti(); } define_instruction(imlo) { obj x = ac, y = spop(); cki(x); cki(y); - if (y == obj_from_fixnum(0)) fail("division by zero"); - ac = obj_from_fixnum(fxmlo(fixnum_from_obj(x), fixnum_from_obj(y))); + if (y == fixnum_obj(0)) fail("division by zero"); + ac = fixnum_obj(fxmlo(fixnum_from_obj(x), fixnum_from_obj(y))); gonexti(); } define_instruction(ieuq) { obj x = ac, y = spop(); cki(x); cki(y); - if (y == obj_from_fixnum(0)) fail("division by zero"); - ac = obj_from_fixnum(fxeuq(fixnum_from_obj(x), fixnum_from_obj(y))); + if (y == fixnum_obj(0)) fail("division by zero"); + ac = fixnum_obj(fxeuq(fixnum_from_obj(x), fixnum_from_obj(y))); gonexti(); } define_instruction(ieur) { obj x = ac, y = spop(); cki(x); cki(y); - if (y == obj_from_fixnum(0)) fail("division by zero"); - ac = obj_from_fixnum(fxeur(fixnum_from_obj(x), fixnum_from_obj(y))); + if (y == fixnum_obj(0)) fail("division by zero"); + ac = fixnum_obj(fxeur(fixnum_from_obj(x), fixnum_from_obj(y))); gonexti(); } define_instruction(igcd) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_fixnum(fxgcd(fixnum_from_obj(x), fixnum_from_obj(y))); + ac = fixnum_obj(fxgcd(fixnum_from_obj(x), fixnum_from_obj(y))); gonexti(); } define_instruction(ipow) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_fixnum(fxpow(fixnum_from_obj(x), fixnum_from_obj(y))); + ac = fixnum_obj(fxpow(fixnum_from_obj(x), fixnum_from_obj(y))); gonexti(); } define_instruction(isqrt) { cki(ac); /* TODO: check for negative */ - ac = obj_from_fixnum(fxsqrt(fixnum_from_obj(ac))); + ac = fixnum_obj(fxsqrt(fixnum_from_obj(ac))); gonexti(); } define_instruction(inot) { cki(ac); - ac = obj_from_fixnum(~fixnum_from_obj(ac)); + ac = fixnum_obj(~fixnum_from_obj(ac)); gonexti(); } define_instruction(iand) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_fixnum(fixnum_from_obj(x) & fixnum_from_obj(y)); + ac = fixnum_obj(fixnum_from_obj(x) & fixnum_from_obj(y)); gonexti(); } define_instruction(iior) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_fixnum(fixnum_from_obj(x) | fixnum_from_obj(y)); + ac = fixnum_obj(fixnum_from_obj(x) | fixnum_from_obj(y)); gonexti(); } define_instruction(ixor) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_fixnum(fixnum_from_obj(x) ^ fixnum_from_obj(y)); + ac = fixnum_obj(fixnum_from_obj(x) ^ fixnum_from_obj(y)); gonexti(); } define_instruction(iasl) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_fixnum(fxasl(fixnum_from_obj(x), fixnum_from_obj(y))); + ac = fixnum_obj(fxasl(fixnum_from_obj(x), fixnum_from_obj(y))); gonexti(); } define_instruction(iasr) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_fixnum(fxasr(fixnum_from_obj(x), fixnum_from_obj(y))); + ac = fixnum_obj(fxasr(fixnum_from_obj(x), fixnum_from_obj(y))); gonexti(); } define_instruction(ilt) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_bool(fixnum_from_obj(x) < fixnum_from_obj(y)); + ac = bool_obj(fixnum_from_obj(x) < fixnum_from_obj(y)); gonexti(); } define_instruction(igt) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_bool(fixnum_from_obj(x) > fixnum_from_obj(y)); + ac = bool_obj(fixnum_from_obj(x) > fixnum_from_obj(y)); gonexti(); } define_instruction(ile) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_bool(fixnum_from_obj(x) <= fixnum_from_obj(y)); + ac = bool_obj(fixnum_from_obj(x) <= fixnum_from_obj(y)); gonexti(); } define_instruction(ige) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_bool(fixnum_from_obj(x) >= fixnum_from_obj(y)); + ac = bool_obj(fixnum_from_obj(x) >= fixnum_from_obj(y)); gonexti(); } define_instruction(ieq) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_bool(x == y); + ac = bool_obj(x == y); gonexti(); } define_instruction(ine) { obj x = ac, y = spop(); cki(x); cki(y); - ac = obj_from_bool(x != y); + ac = bool_obj(x != y); gonexti(); } define_instruction(jzerop) { ckj(ac); - ac = obj_from_bool(flonum_from_obj(ac) == 0.0); + ac = bool_obj(flonum_from_obj(ac) == 0.0); gonexti(); } define_instruction(jposp) { ckj(ac); - ac = obj_from_bool(flonum_from_obj(ac) > 0.0); + ac = bool_obj(flonum_from_obj(ac) > 0.0); gonexti(); } define_instruction(jnegp) { ckj(ac); - ac = obj_from_bool(flonum_from_obj(ac) < 0.0); + ac = bool_obj(flonum_from_obj(ac) < 0.0); gonexti(); } define_instruction(jevnp) { double f; ckj(ac); f = flonum_from_obj(ac); - ac = obj_from_bool(flisint(f / 2.0)); + ac = bool_obj(flisint(f / 2.0)); gonexti(); } define_instruction(joddp) { double f; ckj(ac); f = flonum_from_obj(ac); - ac = obj_from_bool(flisint((f + 1.0) / 2.0)); + ac = bool_obj(flisint((f + 1.0) / 2.0)); gonexti(); } define_instruction(jintp) { double f; ckj(ac); f = flonum_from_obj(ac); - ac = obj_from_bool(f > -HUGE_VAL && f < HUGE_VAL && f == floor(f)); + ac = bool_obj(f > -HUGE_VAL && f < HUGE_VAL && f == floor(f)); gonexti(); } define_instruction(jnanp) { double f; ckj(ac); f = flonum_from_obj(ac); - ac = obj_from_bool(f != f); + ac = bool_obj(f != f); gonexti(); } define_instruction(jfinp) { double f; ckj(ac); f = flonum_from_obj(ac); - ac = obj_from_bool(f > -HUGE_VAL && f < HUGE_VAL); + ac = bool_obj(f > -HUGE_VAL && f < HUGE_VAL); gonexti(); } define_instruction(jinfp) { double f; ckj(ac); f = flonum_from_obj(ac); - ac = obj_from_bool(f <= -HUGE_VAL || f >= HUGE_VAL); + ac = bool_obj(f <= -HUGE_VAL || f >= HUGE_VAL); gonexti(); } define_instruction(jadd) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_flonum(sp-r, flonum_from_obj(x) + flonum_from_obj(y)); + ac = flonum_obj(flonum_from_obj(x) + flonum_from_obj(y)); gonexti(); } define_instruction(jsub) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_flonum(sp-r, flonum_from_obj(x) - flonum_from_obj(y)); + ac = flonum_obj(flonum_from_obj(x) - flonum_from_obj(y)); gonexti(); } define_instruction(jmul) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_flonum(sp-r, flonum_from_obj(x) * flonum_from_obj(y)); + ac = flonum_obj(flonum_from_obj(x) * flonum_from_obj(y)); gonexti(); } define_instruction(jdiv) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_flonum(sp-r, flonum_from_obj(x) / flonum_from_obj(y)); + ac = flonum_obj(flonum_from_obj(x) / flonum_from_obj(y)); gonexti(); } define_instruction(jrem) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_flonum(sp-r, flrem(flonum_from_obj(x), flonum_from_obj(y))); + ac = flonum_obj(flrem(flonum_from_obj(x), flonum_from_obj(y))); gonexti(); } define_instruction(jlt) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_bool(flonum_from_obj(x) < flonum_from_obj(y)); + ac = bool_obj(flonum_from_obj(x) < flonum_from_obj(y)); gonexti(); } define_instruction(jgt) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_bool(flonum_from_obj(x) > flonum_from_obj(y)); + ac = bool_obj(flonum_from_obj(x) > flonum_from_obj(y)); gonexti(); } define_instruction(jle) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_bool(flonum_from_obj(x) <= flonum_from_obj(y)); + ac = bool_obj(flonum_from_obj(x) <= flonum_from_obj(y)); gonexti(); } define_instruction(jge) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_bool(flonum_from_obj(x) >= flonum_from_obj(y)); + ac = bool_obj(flonum_from_obj(x) >= flonum_from_obj(y)); gonexti(); } define_instruction(jeq) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_bool(flonum_from_obj(x) == flonum_from_obj(y)); + ac = bool_obj(flonum_from_obj(x) == flonum_from_obj(y)); gonexti(); } define_instruction(jne) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_bool(flonum_from_obj(x) != flonum_from_obj(y)); + ac = bool_obj(flonum_from_obj(x) != flonum_from_obj(y)); gonexti(); } @@ -1662,67 +1681,67 @@ define_instruction(jmax) { define_instruction(jneg) { ckj(ac); - ac = obj_from_flonum(sp-r, -flonum_from_obj(ac)); + ac = flonum_obj(-flonum_from_obj(ac)); gonexti(); } define_instruction(jabs) { ckj(ac); - ac = obj_from_flonum(sp-r, fabs(flonum_from_obj(ac))); + ac = flonum_obj(fabs(flonum_from_obj(ac))); gonexti(); } define_instruction(jgcd) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_flonum(sp-r, flgcd(flonum_from_obj(x), flonum_from_obj(y))); + ac = flonum_obj(flgcd(flonum_from_obj(x), flonum_from_obj(y))); gonexti(); } define_instruction(jpow) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_flonum(sp-r, pow(flonum_from_obj(x), flonum_from_obj(y))); + ac = flonum_obj(pow(flonum_from_obj(x), flonum_from_obj(y))); gonexti(); } define_instruction(jsqrt) { ckj(ac); - ac = obj_from_flonum(sp-r, sqrt(flonum_from_obj(ac))); + ac = flonum_obj(sqrt(flonum_from_obj(ac))); gonexti(); } define_instruction(jtoi) { ckj(ac); - ac = obj_from_fixnum(fxflo(flonum_from_obj(ac))); + ac = fixnum_obj(fxflo(flonum_from_obj(ac))); gonexti(); } define_instruction(jquo) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_flonum(sp-r, flquo(flonum_from_obj(x), flonum_from_obj(y))); + ac = flonum_obj(flquo(flonum_from_obj(x), flonum_from_obj(y))); gonexti(); } define_instruction(jmqu) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_flonum(sp-r, flmqu(flonum_from_obj(x), flonum_from_obj(y))); + ac = flonum_obj(flmqu(flonum_from_obj(x), flonum_from_obj(y))); gonexti(); } define_instruction(jmlo) { obj x = ac, y = spop(); ckj(x); ckj(y); - ac = obj_from_flonum(sp-r, flmlo(flonum_from_obj(x), flonum_from_obj(y))); + ac = flonum_obj(flmlo(flonum_from_obj(x), flonum_from_obj(y))); gonexti(); } define_instruction(jfloor) { ckj(ac); - ac = obj_from_flonum(sp-r, floor(flonum_from_obj(ac))); + ac = flonum_obj(floor(flonum_from_obj(ac))); gonexti(); } define_instruction(jceil) { ckj(ac); - ac = obj_from_flonum(sp-r, ceil(flonum_from_obj(ac))); + ac = flonum_obj(ceil(flonum_from_obj(ac))); gonexti(); } @@ -1730,71 +1749,71 @@ define_instruction(jtrunc) { double f, i; ckj(ac); f = flonum_from_obj(ac); modf(f, &i); - ac = obj_from_flonum(sp-r, i); + ac = flonum_obj(i); gonexti(); } define_instruction(jround) { ckj(ac); - ac = obj_from_flonum(sp-r, flround(flonum_from_obj(ac))); + ac = flonum_obj(flround(flonum_from_obj(ac))); gonexti(); } define_instruction(jexp) { ckj(ac); - ac = obj_from_flonum(sp-r, exp(flonum_from_obj(ac))); + ac = flonum_obj(exp(flonum_from_obj(ac))); gonexti(); } define_instruction(jlog) { obj x = ac, y = spop(); ckj(ac); if (likely(!y)) { - ac = obj_from_flonum(sp-r, log(flonum_from_obj(ac))); + ac = flonum_obj(log(flonum_from_obj(ac))); } else { double b; ckj(y); b = flonum_from_obj(y); - if (likely(b == 10.0)) ac = obj_from_flonum(sp-r, log10(flonum_from_obj(ac))); - else ac = obj_from_flonum(sp-r, log(flonum_from_obj(ac))/log(b)); + if (likely(b == 10.0)) ac = flonum_obj(log10(flonum_from_obj(ac))); + else ac = flonum_obj(log(flonum_from_obj(ac))/log(b)); } gonexti(); } define_instruction(jsin) { ckj(ac); - ac = obj_from_flonum(sp-r, sin(flonum_from_obj(ac))); + ac = flonum_obj(sin(flonum_from_obj(ac))); gonexti(); } define_instruction(jcos) { ckj(ac); - ac = obj_from_flonum(sp-r, cos(flonum_from_obj(ac))); + ac = flonum_obj(cos(flonum_from_obj(ac))); gonexti(); } define_instruction(jtan) { ckj(ac); - ac = obj_from_flonum(sp-r, tan(flonum_from_obj(ac))); + ac = flonum_obj(tan(flonum_from_obj(ac))); gonexti(); } define_instruction(jasin) { ckj(ac); - ac = obj_from_flonum(sp-r, asin(flonum_from_obj(ac))); + ac = flonum_obj(asin(flonum_from_obj(ac))); gonexti(); } define_instruction(jacos) { ckj(ac); - ac = obj_from_flonum(sp-r, acos(flonum_from_obj(ac))); + ac = flonum_obj(acos(flonum_from_obj(ac))); gonexti(); } define_instruction(jatan) { obj x = ac, y = spop(); ckj(ac); if (likely(!y)) { - ac = obj_from_flonum(sp-r, atan(flonum_from_obj(x))); + ac = flonum_obj(atan(flonum_from_obj(x))); } else { ckj(y); - ac = obj_from_flonum(sp-r, atan2(flonum_from_obj(x), flonum_from_obj(y))); + ac = flonum_obj(atan2(flonum_from_obj(x), flonum_from_obj(y))); } gonexti(); } @@ -1803,23 +1822,23 @@ define_instruction(jatan) { define_instruction(zerop) { obj x = ac; if (likely(is_fixnum_obj(x))) { - ac = obj_from_bool(x == obj_from_fixnum(0)); + ac = bool_obj(x == fixnum_obj(0)); } else if (likely(is_flonum_obj(x))) { - ac = obj_from_bool(flonum_from_obj(x) == 0.0); + ac = bool_obj(flonum_from_obj(x) == 0.0); } else failactype("number"); gonexti(); } define_instruction(posp) { - if (likely(is_fixnum_obj(ac))) ac = obj_from_bool(get_fixnum_unchecked(ac) > 0); - else if (likely(is_flonum_obj(ac))) ac = obj_from_bool(flonum_from_obj(ac) > 0.0); + if (likely(is_fixnum_obj(ac))) ac = bool_obj(get_fixnum_unchecked(ac) > 0); + else if (likely(is_flonum_obj(ac))) ac = bool_obj(flonum_from_obj(ac) > 0.0); else failactype("number"); gonexti(); } define_instruction(negp) { - if (likely(is_fixnum_obj(ac))) ac = obj_from_bool(get_fixnum_unchecked(ac) < 0); - else if (likely(is_flonum_obj(ac))) ac = obj_from_bool(flonum_from_obj(ac) < 0.0); + if (likely(is_fixnum_obj(ac))) ac = bool_obj(get_fixnum_unchecked(ac) < 0); + else if (likely(is_flonum_obj(ac))) ac = bool_obj(flonum_from_obj(ac) < 0.0); else failactype("number"); gonexti(); } @@ -1827,7 +1846,7 @@ define_instruction(negp) { define_instruction(add) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { - ac = obj_from_fixnum(fxadd(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); + ac = fixnum_obj(fxadd(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); } else { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -1836,7 +1855,7 @@ define_instruction(add) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_flonum(sp-r, dx + dy); + ac = flonum_obj(dx + dy); } gonexti(); } @@ -1844,7 +1863,7 @@ define_instruction(add) { define_instruction(sub) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { - ac = obj_from_fixnum(fxsub(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); + ac = fixnum_obj(fxsub(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); } else { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -1853,7 +1872,7 @@ define_instruction(sub) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_flonum(sp-r, dx - dy); + ac = flonum_obj(dx - dy); } gonexti(); } @@ -1861,7 +1880,7 @@ define_instruction(sub) { define_instruction(mul) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { - ac = obj_from_fixnum(fxmul(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); + ac = fixnum_obj(fxmul(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); } else { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -1870,7 +1889,7 @@ define_instruction(mul) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_flonum(sp-r, dx * dy); + ac = flonum_obj(dx * dy); } gonexti(); } @@ -1879,9 +1898,9 @@ define_instruction(div) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { long i; double d; - if (unlikely(y == obj_from_fixnum(0))) fail("division by zero"); - if (fxifdv(get_fixnum_unchecked(x), get_fixnum_unchecked(y), &i, &d)) ac = obj_from_fixnum(i); - else obj_from_flonum(sp-r, d); + if (unlikely(y == fixnum_obj(0))) fail("division by zero"); + if (fxifdv(get_fixnum_unchecked(x), get_fixnum_unchecked(y), &i, &d)) ac = fixnum_obj(i); + else flonum_obj(d); } else { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -1890,7 +1909,7 @@ define_instruction(div) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_flonum(sp-r, dx / dy); + ac = flonum_obj(dx / dy); } gonexti(); } @@ -1898,8 +1917,8 @@ define_instruction(div) { define_instruction(quo) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { - if (unlikely(y == obj_from_fixnum(0))) fail("division by zero"); - ac = obj_from_fixnum(fxquo(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); + if (unlikely(y == fixnum_obj(0))) fail("division by zero"); + ac = fixnum_obj(fxquo(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); } else { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -1908,7 +1927,7 @@ define_instruction(quo) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_flonum(sp-r, flquo(dx, dy)); + ac = flonum_obj(flquo(dx, dy)); } gonexti(); } @@ -1916,8 +1935,8 @@ define_instruction(quo) { define_instruction(rem) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { - if (unlikely(y == obj_from_fixnum(0))) fail("division by zero"); - ac = obj_from_fixnum(fxrem(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); + if (unlikely(y == fixnum_obj(0))) fail("division by zero"); + ac = fixnum_obj(fxrem(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); } else { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -1926,7 +1945,7 @@ define_instruction(rem) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_flonum(sp-r, flrem(dx, dy)); + ac = flonum_obj(flrem(dx, dy)); } gonexti(); } @@ -1934,8 +1953,8 @@ define_instruction(rem) { define_instruction(mqu) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { - if (unlikely(y == obj_from_fixnum(0))) fail("division by zero"); - ac = obj_from_fixnum(fxmqu(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); + if (unlikely(y == fixnum_obj(0))) fail("division by zero"); + ac = fixnum_obj(fxmqu(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); } else { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -1944,7 +1963,7 @@ define_instruction(mqu) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_flonum(sp-r, flmqu(dx, dy)); + ac = flonum_obj(flmqu(dx, dy)); } gonexti(); } @@ -1952,8 +1971,8 @@ define_instruction(mqu) { define_instruction(mlo) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { - if (unlikely(y == obj_from_fixnum(0))) fail("division by zero"); - ac = obj_from_fixnum(fxmlo(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); + if (unlikely(y == fixnum_obj(0))) fail("division by zero"); + ac = fixnum_obj(fxmlo(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); } else { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -1962,7 +1981,7 @@ define_instruction(mlo) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_flonum(sp-r, flmlo(dx, dy)); + ac = flonum_obj(flmlo(dx, dy)); } gonexti(); } @@ -1971,7 +1990,7 @@ define_instruction(mlo) { define_instruction(lt) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { - ac = obj_from_bool(get_fixnum_unchecked(x) < get_fixnum_unchecked(y)); + ac = bool_obj(get_fixnum_unchecked(x) < get_fixnum_unchecked(y)); } else { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -1980,7 +1999,7 @@ define_instruction(lt) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_bool(dx < dy); + ac = bool_obj(dx < dy); } gonexti(); } @@ -1988,7 +2007,7 @@ define_instruction(lt) { define_instruction(gt) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { - ac = obj_from_bool(get_fixnum_unchecked(x) > get_fixnum_unchecked(y)); + ac = bool_obj(get_fixnum_unchecked(x) > get_fixnum_unchecked(y)); } else { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -1997,7 +2016,7 @@ define_instruction(gt) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_bool(dx > dy); + ac = bool_obj(dx > dy); } gonexti(); } @@ -2005,7 +2024,7 @@ define_instruction(gt) { define_instruction(le) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { - ac = obj_from_bool(get_fixnum_unchecked(x) <= get_fixnum_unchecked(y)); + ac = bool_obj(get_fixnum_unchecked(x) <= get_fixnum_unchecked(y)); } else { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -2014,7 +2033,7 @@ define_instruction(le) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_bool(dx <= dy); + ac = bool_obj(dx <= dy); } gonexti(); } @@ -2022,7 +2041,7 @@ define_instruction(le) { define_instruction(ge) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { - ac = obj_from_bool(get_fixnum_unchecked(x) >= get_fixnum_unchecked(y)); + ac = bool_obj(get_fixnum_unchecked(x) >= get_fixnum_unchecked(y)); } else { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -2031,14 +2050,14 @@ define_instruction(ge) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_bool(dx >= dy); + ac = bool_obj(dx >= dy); } gonexti(); } define_instruction(eq) { obj x = ac, y = spop(); - if (x == y) ac = obj_from_bool(1); + if (x == y) ac = bool_obj(1); else if (is_flonum_obj(x) || is_flonum_obj(y)) { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -2047,14 +2066,14 @@ define_instruction(eq) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_bool(dx == dy); - } else ac = obj_from_bool(0); + ac = bool_obj(dx == dy); + } else ac = bool_obj(0); gonexti(); } define_instruction(ne) { obj x = ac, y = spop(); - if (x == y) ac = obj_from_bool(0); + if (x == y) ac = bool_obj(0); else if (is_flonum_obj(x) || is_flonum_obj(y)) { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -2063,8 +2082,8 @@ define_instruction(ne) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_bool(dx != dy); - } else ac = obj_from_bool(1); + ac = bool_obj(dx != dy); + } else ac = bool_obj(1); gonexti(); } @@ -2080,7 +2099,7 @@ define_instruction(min) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = dx < dy ? obj_from_flonum(sp-r, dx) : obj_from_flonum(sp-r, dy); + ac = dx < dy ? flonum_obj(dx) : flonum_obj(dy); } gonexti(); } @@ -2097,7 +2116,7 @@ define_instruction(max) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = dx > dy ? obj_from_flonum(sp-r, dx) : obj_from_flonum(sp-r, dy); + ac = dx > dy ? flonum_obj(dx) : flonum_obj(dy); } gonexti(); } @@ -2105,7 +2124,7 @@ define_instruction(max) { define_instruction(gcd) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { - ac = obj_from_fixnum(fxgcd(fixnum_from_obj(x), fixnum_from_obj(y))); + ac = fixnum_obj(fxgcd(fixnum_from_obj(x), fixnum_from_obj(y))); } else { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -2114,7 +2133,7 @@ define_instruction(gcd) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_flonum(sp-r, flgcd(dx, dy)); + ac = flonum_obj(flgcd(dx, dy)); } gonexti(); } @@ -2123,7 +2142,7 @@ define_instruction(pow) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { /* fixme: this will either overflow, or fail on negative y */ - ac = obj_from_fixnum(fxpow(fixnum_from_obj(x), fixnum_from_obj(y))); + ac = fixnum_obj(fxpow(fixnum_from_obj(x), fixnum_from_obj(y))); } else { double dx, dy; if (likely(is_flonum_obj(x))) dx = flonum_from_obj(x); @@ -2132,19 +2151,19 @@ define_instruction(pow) { if (likely(is_flonum_obj(y))) dy = flonum_from_obj(y); else if (likely(is_fixnum_obj(y))) dy = (double)fixnum_from_obj(y); else failtype(y, "number"); - ac = obj_from_flonum(sp-r, pow(dx, dy)); + ac = flonum_obj(pow(dx, dy)); } gonexti(); } define_instruction(sqrt) { if (likely(is_flonum_obj(ac))) { - ac = obj_from_flonum(sp-r, sqrt(flonum_from_obj(ac))); + ac = flonum_obj(sqrt(flonum_from_obj(ac))); } else if (likely(is_fixnum_obj(ac))) { long x = fixnum_from_obj(ac), y; - if (x < 0) ac = obj_from_flonum(sp-r, (HUGE_VAL - HUGE_VAL)); - else if (y = fxsqrt(x), y*y == x) ac = obj_from_fixnum(y); - else ac = obj_from_flonum(sp-r, sqrt((double)x)); + if (x < 0) ac = flonum_obj((HUGE_VAL - HUGE_VAL)); + else if (y = fxsqrt(x), y*y == x) ac = fixnum_obj(y); + else ac = flonum_obj(sqrt((double)x)); } else failactype("number"); gonexti(); } @@ -2154,7 +2173,7 @@ define_instruction(exp) { if (unlikely(is_fixnum_obj(ac))) x = (double)fixnum_from_obj(ac); else if (likely(is_flonum_obj(ac))) x = flonum_from_obj(ac); else failactype("number"); - ac = obj_from_flonum(sp-r, exp(x)); + ac = flonum_obj(exp(x)); gonexti(); } @@ -2164,16 +2183,16 @@ define_instruction(log) { else if (likely(is_flonum_obj(ac))) x = flonum_from_obj(ac); else failactype("number"); if (likely(!y)) { - ac = obj_from_flonum(sp-r, log(x)); - } else if (likely(y == obj_from_fixnum(10))) { - ac = obj_from_flonum(sp-r, log10(x)); + ac = flonum_obj(log(x)); + } else if (likely(y == fixnum_obj(10))) { + ac = flonum_obj(log10(x)); } else { double b; if (unlikely(is_fixnum_obj(y))) b = (double)fixnum_from_obj(y); else if (likely(is_flonum_obj(y))) b = flonum_from_obj(y); else failtype(y, "number"); - if (likely(b == 10.0)) ac = obj_from_flonum(sp-r, log10(x)); - else ac = obj_from_flonum(sp-r, log(x)/log(b)); + if (likely(b == 10.0)) ac = flonum_obj(log10(x)); + else ac = flonum_obj(log(x)/log(b)); } gonexti(); } @@ -2185,7 +2204,7 @@ define_instruction(sin) { } else if (likely(is_flonum_obj(ac))) { x = flonum_from_obj(ac); } else failactype("number"); - ac = obj_from_flonum(sp-r, sin(x)); + ac = flonum_obj(sin(x)); gonexti(); } @@ -2196,7 +2215,7 @@ define_instruction(cos) { } else if (likely(is_flonum_obj(ac))) { x = flonum_from_obj(ac); } else failactype("number"); - ac = obj_from_flonum(sp-r, cos(x)); + ac = flonum_obj(cos(x)); gonexti(); } @@ -2207,7 +2226,7 @@ define_instruction(tan) { } else if (likely(is_flonum_obj(ac))) { x = flonum_from_obj(ac); } else failactype("number"); - ac = obj_from_flonum(sp-r, tan(x)); + ac = flonum_obj(tan(x)); gonexti(); } @@ -2218,7 +2237,7 @@ define_instruction(asin) { } else if (likely(is_flonum_obj(ac))) { x = flonum_from_obj(ac); } else failactype("number"); - ac = obj_from_flonum(sp-r, asin(x)); + ac = flonum_obj(asin(x)); gonexti(); } @@ -2229,7 +2248,7 @@ define_instruction(acos) { } else if (likely(is_flonum_obj(ac))) { x = flonum_from_obj(ac); } else failactype("number"); - ac = obj_from_flonum(sp-r, acos(x)); + ac = flonum_obj(acos(x)); gonexti(); } @@ -2239,38 +2258,38 @@ define_instruction(atan) { else if (likely(is_flonum_obj(ac))) x = flonum_from_obj(ac); else failactype("number"); if (likely(!y)) { - ac = obj_from_flonum(sp-r, atan(x)); + ac = flonum_obj(atan(x)); } else { double b; if (unlikely(is_fixnum_obj(y))) b = (double)fixnum_from_obj(y); else if (likely(is_flonum_obj(y))) b = flonum_from_obj(y); else failtype(y, "number"); - ac = obj_from_flonum(sp-r, atan2(x, b)); + ac = flonum_obj(atan2(x, b)); } gonexti(); } define_instruction(neg) { if (likely(is_fixnum_obj(ac))) { - ac = obj_from_fixnum(-fixnum_from_obj(ac)); + ac = fixnum_obj(-fixnum_from_obj(ac)); } else if (likely(is_flonum_obj(ac))) { - ac = obj_from_flonum(sp-r, -flonum_from_obj(ac)); + ac = flonum_obj(-flonum_from_obj(ac)); } else failactype("number"); gonexti(); } define_instruction(abs) { if (likely(is_fixnum_obj(ac))) { - ac = obj_from_fixnum(fxabs(fixnum_from_obj(ac))); + ac = fixnum_obj(fxabs(fixnum_from_obj(ac))); } else if (likely(is_flonum_obj(ac))) { - ac = obj_from_flonum(sp-r, fabs(flonum_from_obj(ac))); + ac = flonum_obj(fabs(flonum_from_obj(ac))); } else failactype("number"); gonexti(); } define_instruction(floor) { if (likely(is_flonum_obj(ac))) { - ac = obj_from_flonum(sp-r, floor(flonum_from_obj(ac))); + ac = flonum_obj(floor(flonum_from_obj(ac))); } else if (unlikely(!is_fixnum_obj(ac))) { failactype("number"); } @@ -2279,7 +2298,7 @@ define_instruction(floor) { define_instruction(ceil) { if (likely(is_flonum_obj(ac))) { - ac = obj_from_flonum(sp-r, ceil(flonum_from_obj(ac))); + ac = flonum_obj(ceil(flonum_from_obj(ac))); } else if (unlikely(!is_fixnum_obj(ac))) { failactype("number"); } @@ -2290,7 +2309,7 @@ define_instruction(trunc) { if (likely(is_flonum_obj(ac))) { double x = flonum_from_obj(ac); double i; modf(x, &i); - ac = obj_from_flonum(sp-r, i); + ac = flonum_obj(i); } else if (unlikely(!is_fixnum_obj(ac))) { failactype("number"); } @@ -2299,7 +2318,7 @@ define_instruction(trunc) { define_instruction(round) { if (likely(is_flonum_obj(ac))) { - ac = obj_from_flonum(sp-r, flround(flonum_from_obj(ac))); + ac = flonum_obj(flround(flonum_from_obj(ac))); } else if (unlikely(!is_fixnum_obj(ac))) { failactype("number"); } @@ -2308,88 +2327,88 @@ define_instruction(round) { define_instruction(nump) { - ac = obj_from_bool(is_fixnum_obj(ac) || is_flonum_obj(ac)); + ac = bool_obj(is_fixnum_obj(ac) || is_flonum_obj(ac)); gonexti(); } define_instruction(fixp) { - ac = obj_from_bool(is_fixnum_obj(ac)); + ac = bool_obj(is_fixnum_obj(ac)); gonexti(); } define_instruction(flop) { - ac = obj_from_bool(is_flonum_obj(ac)); + ac = bool_obj(is_flonum_obj(ac)); gonexti(); } define_instruction(intp) { if (likely(is_fixnum_obj(ac))) { - ac = obj_from_bool(1); + ac = bool_obj(1); } else { /* accepts any object! */ - ac = obj_from_bool(is_flonum_obj(ac) && flisint(flonum_from_obj(ac))); + ac = bool_obj(is_flonum_obj(ac) && flisint(flonum_from_obj(ac))); } gonexti(); } define_instruction(nanp) { if (unlikely(is_fixnum_obj(ac))) { - ac = obj_from_bool(0); + ac = bool_obj(0); } else if (likely(is_flonum_obj(ac))) { double f = flonum_from_obj(ac); - ac = obj_from_bool(f != f); + ac = bool_obj(f != f); } else failactype("number"); gonexti(); } define_instruction(finp) { if (unlikely(is_fixnum_obj(ac))) { - ac = obj_from_bool(1); + ac = bool_obj(1); } else if (likely(is_flonum_obj(ac))) { double f = flonum_from_obj(ac); - ac = obj_from_bool(f > -HUGE_VAL && f < HUGE_VAL); + ac = bool_obj(f > -HUGE_VAL && f < HUGE_VAL); } else failactype("number"); gonexti(); } define_instruction(infp) { if (unlikely(is_fixnum_obj(ac))) { - ac = obj_from_bool(0); + ac = bool_obj(0); } else if (likely(is_flonum_obj(ac))) { double f = flonum_from_obj(ac); - ac = obj_from_bool(f <= -HUGE_VAL || f >= HUGE_VAL); + ac = bool_obj(f <= -HUGE_VAL || f >= HUGE_VAL); } else failactype("number"); gonexti(); } define_instruction(evnp) { if (likely(is_fixnum_obj(ac))) { - ac = obj_from_bool((fixnum_from_obj(ac) & 1) == 0); + ac = bool_obj((fixnum_from_obj(ac) & 1) == 0); } else if (likely(is_flonum_obj(ac))) { double f = flonum_from_obj(ac); - ac = obj_from_bool(flisint(f / 2.0)); + ac = bool_obj(flisint(f / 2.0)); } else failactype("number"); gonexti(); } define_instruction(oddp) { if (likely(is_fixnum_obj(ac))) { - ac = obj_from_bool((fixnum_from_obj(ac) & 1) != 0); + ac = bool_obj((fixnum_from_obj(ac) & 1) != 0); } else if (likely(is_flonum_obj(ac))) { double f = flonum_from_obj(ac); - ac = obj_from_bool(flisint((f + 1.0) / 2.0)); + ac = bool_obj(flisint((f + 1.0) / 2.0)); } else failactype("number"); gonexti(); } define_instruction(ntoi) { - if (likely(is_flonum_obj(ac))) ac = obj_from_fixnum(fxflo(flonum_from_obj(ac))); + if (likely(is_flonum_obj(ac))) ac = fixnum_obj(fxflo(flonum_from_obj(ac))); else if (likely(is_fixnum_obj(ac))) /* keep ac as-is */ ; else failactype("number"); gonexti(); } define_instruction(ntoj) { - if (likely(is_fixnum_obj(ac))) ac = obj_from_flonum(sp-r, (flonum_t)fixnum_from_obj(ac)); + if (likely(is_fixnum_obj(ac))) ac = flonum_obj((flonum_t)fixnum_from_obj(ac)); else if (likely(is_flonum_obj(ac))) /* keep ac as-is */ ; else failactype("number"); gonexti(); @@ -2399,12 +2418,11 @@ define_instruction(ntoj) { define_instruction(lcat) { obj t, l, *p, *d; int c; for (l = ac, c = 0; ispair(l); l = cdr(l)) ++c; - hp_reserve(hbsz(2+1)*c); + hp_reserve(pairbsz()*c); p = --sp; t = *p; /* pop & take addr */ for (l = ac; ispair(l); l = cdr(l)) { *--hp = t; d = hp; *--hp = car(l); - *--hp = obj_from_size(PAIR_BTAG); - *p = hendblk(2+1); p = d; + *p = hend_pair(); p = d; } ac = *sp; gonexti(); @@ -2413,133 +2431,133 @@ define_instruction(lcat) { define_instruction(ccmp) { obj x = ac, y = spop(); int cmp; ckc(x); ckc(y); cmp = char_from_obj(x) - char_from_obj(y); - ac = obj_from_fixnum(cmp); + ac = fixnum_obj(cmp); gonexti(); } define_instruction(ceq) { obj x = ac, y = spop(); ckc(x); ckc(y); - ac = obj_from_bool(char_from_obj(x) == char_from_obj(y)); + ac = bool_obj(char_from_obj(x) == char_from_obj(y)); gonexti(); } define_instruction(clt) { obj x = ac, y = spop(); ckc(x); ckc(y); - ac = obj_from_bool(char_from_obj(x) < char_from_obj(y)); + ac = bool_obj(char_from_obj(x) < char_from_obj(y)); gonexti(); } define_instruction(cgt) { obj x = ac, y = spop(); ckc(x); ckc(y); - ac = obj_from_bool(char_from_obj(x) > char_from_obj(y)); + ac = bool_obj(char_from_obj(x) > char_from_obj(y)); gonexti(); } define_instruction(cle) { obj x = ac, y = spop(); ckc(x); ckc(y); - ac = obj_from_bool(char_from_obj(x) <= char_from_obj(y)); + ac = bool_obj(char_from_obj(x) <= char_from_obj(y)); gonexti(); } define_instruction(cge) { obj x = ac, y = spop(); ckc(x); ckc(y); - ac = obj_from_bool(char_from_obj(x) >= char_from_obj(y)); + ac = bool_obj(char_from_obj(x) >= char_from_obj(y)); gonexti(); } define_instruction(cicmp) { obj x = ac, y = spop(); int cmp; ckc(x); ckc(y); cmp = tolower(char_from_obj(x)) - tolower(char_from_obj(y)); - ac = obj_from_fixnum(cmp); + ac = fixnum_obj(cmp); gonexti(); } define_instruction(cieq) { obj x = ac, y = spop(); ckc(x); ckc(y); - ac = obj_from_bool(tolower(char_from_obj(x)) == tolower(char_from_obj(y))); + ac = bool_obj(tolower(char_from_obj(x)) == tolower(char_from_obj(y))); gonexti(); } define_instruction(cilt) { obj x = ac, y = spop(); ckc(x); ckc(y); - ac = obj_from_bool(tolower(char_from_obj(x)) < tolower(char_from_obj(y))); + ac = bool_obj(tolower(char_from_obj(x)) < tolower(char_from_obj(y))); gonexti(); } define_instruction(cigt) { obj x = ac, y = spop(); ckc(x); ckc(y); - ac = obj_from_bool(tolower(char_from_obj(x)) > tolower(char_from_obj(y))); + ac = bool_obj(tolower(char_from_obj(x)) > tolower(char_from_obj(y))); gonexti(); } define_instruction(cile) { obj x = ac, y = spop(); ckc(x); ckc(y); - ac = obj_from_bool(tolower(char_from_obj(x)) <= tolower(char_from_obj(y))); + ac = bool_obj(tolower(char_from_obj(x)) <= tolower(char_from_obj(y))); gonexti(); } define_instruction(cige) { obj x = ac, y = spop(); ckc(x); ckc(y); - ac = obj_from_bool(tolower(char_from_obj(x)) >= tolower(char_from_obj(y))); + ac = bool_obj(tolower(char_from_obj(x)) >= tolower(char_from_obj(y))); gonexti(); } define_instruction(cwsp) { ckc(ac); - ac = obj_from_bool(isspace(char_from_obj(ac))); + ac = bool_obj(isspace(char_from_obj(ac))); gonexti(); } define_instruction(clcp) { ckc(ac); - ac = obj_from_bool(islower(char_from_obj(ac))); + ac = bool_obj(islower(char_from_obj(ac))); gonexti(); } define_instruction(cucp) { ckc(ac); - ac = obj_from_bool(isupper(char_from_obj(ac))); + ac = bool_obj(isupper(char_from_obj(ac))); gonexti(); } define_instruction(calp) { ckc(ac); - ac = obj_from_bool(isalpha(char_from_obj(ac))); + ac = bool_obj(isalpha(char_from_obj(ac))); gonexti(); } define_instruction(cnup) { ckc(ac); - ac = obj_from_bool(isdigit(char_from_obj(ac))); + ac = bool_obj(isdigit(char_from_obj(ac))); gonexti(); } define_instruction(cupc) { ckc(ac); - ac = obj_from_char(toupper(char_from_obj(ac))); + ac = char_obj(toupper(char_from_obj(ac))); gonexti(); } define_instruction(cdnc) { ckc(ac); - ac = obj_from_char(tolower(char_from_obj(ac))); + ac = char_obj(tolower(char_from_obj(ac))); gonexti(); } define_instruction(cflc) { ckc(ac); - ac = obj_from_char(tolower(char_from_obj(ac))); /* stub */ + ac = char_obj(tolower(char_from_obj(ac))); /* stub */ gonexti(); } define_instruction(cdgv) { int ch; ckc(ac); ch = char_from_obj(ac); - if (likely('0' <= ch && ch <= '9')) ac = obj_from_fixnum(ch - '0'); + if (likely('0' <= ch && ch <= '9')) ac = fixnum_obj(ch - '0'); /* R7RS won't allow hex and any larger radix digits - else if (likely('a' <= ch && ch <= 'z')) ac = obj_from_fixnum(10 + ch - 'a'); - else if (likely('A' <= ch && ch <= 'Z')) ac = obj_from_fixnum(10 + ch - 'A'); */ - else ac = obj_from_bool(0); + else if (likely('a' <= ch && ch <= 'z')) ac = fixnum_obj(10 + ch - 'a'); + else if (likely('A' <= ch && ch <= 'Z')) ac = fixnum_obj(10 + ch - 'A'); */ + else ac = bool_obj(0); gonexti(); } @@ -2547,160 +2565,160 @@ define_instruction(cdgv) { define_instruction(scmp) { obj x = ac, y = spop(); int cmp; cks(x); cks(y); cmp = strcmp(stringchars(x), stringchars(y)); - ac = obj_from_fixnum(cmp); + ac = fixnum_obj(cmp); gonexti(); } define_instruction(seq) { obj x = ac, y = spop(); cks(x); cks(y); - ac = obj_from_bool(strcmp(stringchars(x), stringchars(y)) == 0); + ac = bool_obj(strcmp(stringchars(x), stringchars(y)) == 0); gonexti(); } define_instruction(slt) { obj x = ac, y = spop(); cks(x); cks(y); - ac = obj_from_bool(strcmp(stringchars(x), stringchars(y)) < 0); + ac = bool_obj(strcmp(stringchars(x), stringchars(y)) < 0); gonexti(); } define_instruction(sgt) { obj x = ac, y = spop(); cks(x); cks(y); - ac = obj_from_bool(strcmp(stringchars(x), stringchars(y)) > 0); + ac = bool_obj(strcmp(stringchars(x), stringchars(y)) > 0); gonexti(); } define_instruction(sle) { obj x = ac, y = spop(); cks(x); cks(y); - ac = obj_from_bool(strcmp(stringchars(x), stringchars(y)) <= 0); + ac = bool_obj(strcmp(stringchars(x), stringchars(y)) <= 0); gonexti(); } define_instruction(sge) { obj x = ac, y = spop(); cks(x); cks(y); - ac = obj_from_bool(strcmp(stringchars(x), stringchars(y)) >= 0); + ac = bool_obj(strcmp(stringchars(x), stringchars(y)) >= 0); gonexti(); } define_instruction(sicmp) { obj x = ac, y = spop(); int cmp; cks(x); cks(y); cmp = strcmp_ci(stringchars(x), stringchars(y)); - ac = obj_from_fixnum(cmp); + ac = fixnum_obj(cmp); gonexti(); } define_instruction(sieq) { obj x = ac, y = spop(); cks(x); cks(y); - ac = obj_from_bool(strcmp_ci(stringchars(x), stringchars(y)) == 0); + ac = bool_obj(strcmp_ci(stringchars(x), stringchars(y)) == 0); gonexti(); } define_instruction(silt) { obj x = ac, y = spop(); cks(x); cks(y); - ac = obj_from_bool(strcmp_ci(stringchars(x), stringchars(y)) < 0); + ac = bool_obj(strcmp_ci(stringchars(x), stringchars(y)) < 0); gonexti(); } define_instruction(sigt) { obj x = ac, y = spop(); cks(x); cks(y); - ac = obj_from_bool(strcmp_ci(stringchars(x), stringchars(y)) > 0); + ac = bool_obj(strcmp_ci(stringchars(x), stringchars(y)) > 0); gonexti(); } define_instruction(sile) { obj x = ac, y = spop(); cks(x); cks(y); - ac = obj_from_bool(strcmp_ci(stringchars(x), stringchars(y)) <= 0); + ac = bool_obj(strcmp_ci(stringchars(x), stringchars(y)) <= 0); gonexti(); } define_instruction(sige) { obj x = ac, y = spop(); cks(x); cks(y); - ac = obj_from_bool(strcmp_ci(stringchars(x), stringchars(y)) >= 0); + ac = bool_obj(strcmp_ci(stringchars(x), stringchars(y)) >= 0); gonexti(); } define_instruction(symp) { - ac = obj_from_bool(issymbol(ac)); + ac = bool_obj(issymbol(ac)); gonexti(); } define_instruction(boolp) { - ac = obj_from_bool(is_bool_obj(ac)); + ac = bool_obj(is_bool_obj(ac)); gonexti(); } define_instruction(boxp) { - ac = obj_from_bool(isbox(ac)); + ac = bool_obj(isbox(ac)); gonexti(); } define_instruction(funp) { - ac = obj_from_bool(isvmclo(ac)); + ac = bool_obj(isvmclo(ac)); gonexti(); } define_instruction(ipp) { - ac = obj_from_bool(isiport(ac)); + ac = bool_obj(isiport(ac)); gonexti(); } define_instruction(opp) { - ac = obj_from_bool(isoport(ac)); + ac = bool_obj(isoport(ac)); gonexti(); } define_instruction(sip) { - ac = mkiport_file(sp-r, stdin); /* TODO: keep in global var -- in r7rs it is a parameter */ + ac = iport_file_obj(stdin); /* TODO: keep in global var -- in r7rs it is a parameter */ gonexti(); } define_instruction(sop) { - ac = mkoport_file(sp-r, stdout); /* TODO: keep in global var -- in r7rs it is a parameter */ + ac = oport_file_obj(stdout); /* TODO: keep in global var -- in r7rs it is a parameter */ gonexti(); } define_instruction(sep) { - ac = mkoport_file(sp-r, stderr); /* TODO: keep in global var -- in r7rs it is a parameter */ + ac = oport_file_obj(stderr); /* TODO: keep in global var -- in r7rs it is a parameter */ gonexti(); } define_instruction(ipop) { cxtype_iport_t *vt; ckr(ac); vt = iportvt(ac); assert(vt); - ac = obj_from_bool(vt != (cxtype_iport_t *)IPORT_CLOSED_NTAG); + ac = bool_obj(vt != (cxtype_iport_t *)IPORT_CLOSED_NTAG); gonexti(); } define_instruction(opop) { cxtype_oport_t *vt; ckw(ac); vt = oportvt(ac); assert(vt); - ac = obj_from_bool(vt != (cxtype_oport_t *)OPORT_CLOSED_NTAG); + ac = bool_obj(vt != (cxtype_oport_t *)OPORT_CLOSED_NTAG); gonexti(); } define_instruction(otip) { FILE *fp = fopen(stringchars(ac), "r"); if (fp == NULL) fail("can't open input file"); - ac = mkiport_file(sp-r, fp); + ac = iport_file_obj(fp); gonexti(); } define_instruction(otop) { FILE *fp = fopen(stringchars(ac), "w"); if (fp == NULL) fail("can't open output file"); - ac = mkoport_file(sp-r, fp); + ac = oport_file_obj(fp); gonexti(); } define_instruction(ois) { int *d; cks(ac); d = dupstring(stringdata(ac)); - ac = mkiport_string(sp-r, sialloc(sdatachars(d), d)); + ac = iport_string_obj(sialloc(sdatachars(d), d)); gonexti(); } define_instruction(oos) { - ac = mkoport_string(sp-r, newcb()); + ac = oport_string_obj(newcb()); gonexti(); } @@ -2725,10 +2743,10 @@ define_instruction(gos) { vt = ckoportvt(ac); if (vt != (cxtype_oport_t *)OPORT_STRING_NTAG && vt != (cxtype_oport_t *)OPORT_BYTEVECTOR_NTAG) { - ac = mkeof(); + ac = eof_obj(); } else { cbuf_t *pcb = oportdata(ac); - ac = hpushstr(sp-r, newstring(cbdata(pcb))); + ac = string_obj(newstring(cbdata(pcb))); } gonexti(); } @@ -2737,32 +2755,32 @@ define_instruction(gos) { define_instruction(rdc) { int c; ckr(ac); c = iportgetc(ac); - if (unlikely(c == EOF)) ac = mkeof(); - else ac = obj_from_char(c); + if (unlikely(c == EOF)) ac = eof_obj(); + else ac = char_obj(c); gonexti(); } define_instruction(rdac) { int c; ckr(ac); c = iportpeekc(ac); - if (unlikely(c == EOF)) ac = mkeof(); - else ac = obj_from_char(c); + if (unlikely(c == EOF)) ac = eof_obj(); + else ac = char_obj(c); gonexti(); } define_instruction(rdcr) { ckr(ac); - ac = obj_from_bool(1); /* no portable way to detect hanging? */ + ac = bool_obj(1); /* no portable way to detect hanging? */ gonexti(); } define_instruction(eofp) { - ac = obj_from_bool(iseof(ac)); + ac = bool_obj(iseof(ac)); gonexti(); } define_instruction(eof) { - ac = mkeof(); + ac = eof_obj(); gonexti(); } @@ -2810,28 +2828,28 @@ define_instruction(wriw) { } define_instruction(igp) { - ac = obj_from_bool(isintegrable(ac)); + ac = bool_obj(isintegrable(ac)); gonexti(); } define_instruction(iglk) { struct intgtab_entry *pe; cky(ac); pe = lookup_integrable(getsymbol(ac)); - ac = pe ? mkintegrable(pe) : obj_from_bool(0); + ac = pe ? mkintegrable(pe) : bool_obj(0); gonexti(); } define_instruction(igty) { int it; ckg(ac); it = integrable_type(integrabledata(ac)); - ac = it ? obj_from_char(it) : obj_from_bool(0); + ac = it ? char_obj(it) : bool_obj(0); gonexti(); } define_instruction(iggl) { const char *igs; ckg(ac); igs = integrable_global(integrabledata(ac)); - ac = igs ? mksymbol(internsym((char*)igs)) : obj_from_bool(0); + ac = igs ? mksymbol(internsym((char*)igs)) : bool_obj(0); gonexti(); } @@ -2839,53 +2857,59 @@ define_instruction(igco) { int n; const char *cs; ckg(ac); ckk(sref(0)); n = fixnum_from_obj(spop()); cs = integrable_code(integrabledata(ac), n); - ac = cs ? hpushstr(sp-r, newstring((char*)cs)) : obj_from_bool(0); + ac = cs ? string_obj(newstring((char*)cs)) : bool_obj(0); gonexti(); } define_instruction(rdsx) { - cks(ac); unload_ac(); /* ac->ra (string) */ + cks(ac); + unload_ac(); /* ac->ra (string) */ + unload_ip(); /* ip->rx */ hp = rds_stox(r, sp, hp); reload_ac(); /* ra->ac (sexp or eof) */ - if (ac == mkeof()) fail("failed to read serialized s-expression"); + reload_ip(); /* rx->ip */ + if (ac == eof_obj()) fail("failed to read serialized s-expression"); gonexti(); } define_instruction(rdsc) { cks(ac); unload_ac(); /* ac->ra (string) */ + unload_ac(); /* ac->ra (string) */ + unload_ip(); /* ip->rx */ hp = rds_stoc(r, sp, hp); reload_ac(); /* ra->ac (codevec or eof) */ - if (ac == mkeof()) fail("failed to read serialized code"); + reload_ip(); /* rx->ip */ + if (ac == eof_obj()) fail("failed to read serialized code"); gonexti(); } -define_instruction(litf) { ac = obj_from_bool(0); gonexti(); } -define_instruction(litt) { ac = obj_from_bool(1); gonexti(); } +define_instruction(litf) { ac = bool_obj(0); gonexti(); } +define_instruction(litt) { ac = bool_obj(1); gonexti(); } define_instruction(litn) { ac = mknull(); gonexti(); } -define_instruction(pushlitf) { ac = obj_from_bool(0); spush(ac); gonexti(); } -define_instruction(pushlitt) { ac = obj_from_bool(1); spush(ac); gonexti(); } +define_instruction(pushlitf) { ac = bool_obj(0); spush(ac); gonexti(); } +define_instruction(pushlitt) { ac = bool_obj(1); spush(ac); gonexti(); } define_instruction(pushlitn) { ac = mknull(); spush(ac); gonexti(); } -define_instruction(lit0) { ac = obj_from_fixnum(0); gonexti(); } -define_instruction(lit1) { ac = obj_from_fixnum(1); gonexti(); } -define_instruction(lit2) { ac = obj_from_fixnum(2); gonexti(); } -define_instruction(lit3) { ac = obj_from_fixnum(3); gonexti(); } -define_instruction(lit4) { ac = obj_from_fixnum(4); gonexti(); } -define_instruction(lit5) { ac = obj_from_fixnum(5); gonexti(); } -define_instruction(lit6) { ac = obj_from_fixnum(6); gonexti(); } -define_instruction(lit7) { ac = obj_from_fixnum(7); gonexti(); } -define_instruction(lit8) { ac = obj_from_fixnum(8); gonexti(); } -define_instruction(lit9) { ac = obj_from_fixnum(9); gonexti(); } -define_instruction(pushlit0) { ac = obj_from_fixnum(0); spush(ac); gonexti(); } -define_instruction(pushlit1) { ac = obj_from_fixnum(1); spush(ac); gonexti(); } -define_instruction(pushlit2) { ac = obj_from_fixnum(2); spush(ac); gonexti(); } -define_instruction(pushlit3) { ac = obj_from_fixnum(3); spush(ac); gonexti(); } -define_instruction(pushlit4) { ac = obj_from_fixnum(4); spush(ac); gonexti(); } -define_instruction(pushlit5) { ac = obj_from_fixnum(5); spush(ac); gonexti(); } -define_instruction(pushlit6) { ac = obj_from_fixnum(6); spush(ac); gonexti(); } -define_instruction(pushlit7) { ac = obj_from_fixnum(7); spush(ac); gonexti(); } -define_instruction(pushlit8) { ac = obj_from_fixnum(8); spush(ac); gonexti(); } -define_instruction(pushlit9) { ac = obj_from_fixnum(9); spush(ac); gonexti(); } +define_instruction(lit0) { ac = fixnum_obj(0); gonexti(); } +define_instruction(lit1) { ac = fixnum_obj(1); gonexti(); } +define_instruction(lit2) { ac = fixnum_obj(2); gonexti(); } +define_instruction(lit3) { ac = fixnum_obj(3); gonexti(); } +define_instruction(lit4) { ac = fixnum_obj(4); gonexti(); } +define_instruction(lit5) { ac = fixnum_obj(5); gonexti(); } +define_instruction(lit6) { ac = fixnum_obj(6); gonexti(); } +define_instruction(lit7) { ac = fixnum_obj(7); gonexti(); } +define_instruction(lit8) { ac = fixnum_obj(8); gonexti(); } +define_instruction(lit9) { ac = fixnum_obj(9); gonexti(); } +define_instruction(pushlit0) { ac = fixnum_obj(0); spush(ac); gonexti(); } +define_instruction(pushlit1) { ac = fixnum_obj(1); spush(ac); gonexti(); } +define_instruction(pushlit2) { ac = fixnum_obj(2); spush(ac); gonexti(); } +define_instruction(pushlit3) { ac = fixnum_obj(3); spush(ac); gonexti(); } +define_instruction(pushlit4) { ac = fixnum_obj(4); spush(ac); gonexti(); } +define_instruction(pushlit5) { ac = fixnum_obj(5); spush(ac); gonexti(); } +define_instruction(pushlit6) { ac = fixnum_obj(6); spush(ac); gonexti(); } +define_instruction(pushlit7) { ac = fixnum_obj(7); spush(ac); gonexti(); } +define_instruction(pushlit8) { ac = fixnum_obj(8); spush(ac); gonexti(); } +define_instruction(pushlit9) { ac = fixnum_obj(9); spush(ac); gonexti(); } define_instruction(sref0) { ac = sref(0); gonexti(); } define_instruction(sref1) { ac = sref(1); gonexti(); } @@ -2942,23 +2966,23 @@ define_instruction(pushdrefi3) { ac = boxref(dref(3)); spush(ac); gonexti(); } define_instruction(pushdrefi4) { ac = boxref(dref(4)); spush(ac); gonexti(); } define_instruction(call0) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(0); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(0); callsubi(); } define_instruction(call1) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(1); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(1); callsubi(); } define_instruction(call2) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(2); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(2); callsubi(); } define_instruction(call3) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(3); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(3); callsubi(); } define_instruction(call4) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(4); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(4); callsubi(); } @@ -2980,174 +3004,174 @@ define_instruction(sreturn4) { } define_instruction(atest0) { - if (unlikely(ac != obj_from_fixnum(0))) fail("argument count error on entry"); + if (unlikely(ac != fixnum_obj(0))) fail("argument count error on entry"); gonexti(); } define_instruction(atest1) { - if (unlikely(ac != obj_from_fixnum(1))) fail("argument count error on entry"); + if (unlikely(ac != fixnum_obj(1))) fail("argument count error on entry"); gonexti(); } define_instruction(atest2) { - if (unlikely(ac != obj_from_fixnum(2))) fail("argument count error on entry"); + if (unlikely(ac != fixnum_obj(2))) fail("argument count error on entry"); gonexti(); } define_instruction(atest3) { - if (unlikely(ac != obj_from_fixnum(3))) fail("argument count error on entry"); + if (unlikely(ac != fixnum_obj(3))) fail("argument count error on entry"); gonexti(); } define_instruction(atest4) { - if (unlikely(ac != obj_from_fixnum(4))) fail("argument count error on entry"); + if (unlikely(ac != fixnum_obj(4))) fail("argument count error on entry"); gonexti(); } define_instruction(scall1) { int m = 1, n = fixnum_from_obj(*ip++); - ckx(ac); rd = ac; rx = obj_from_fixnum(0); - ac = obj_from_fixnum(n); /* argc */ + ckx(ac); rd = ac; rx = fixnum_obj(0); + ac = fixnum_obj(n); /* argc */ memmove((void*)(sp-n-m), (void*)(sp-n), (size_t)n*sizeof(obj)); sdrop(m); callsubi(); } define_instruction(scall10) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(0); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(0); sdrop(1); callsubi(); } define_instruction(scall11) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(1); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(1); sref(1) = sref(0); sdrop(1); callsubi(); } define_instruction(scall12) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(2); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(2); sref(2) = sref(1); sref(1) = sref(0); sdrop(1); callsubi(); } define_instruction(scall13) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(3); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(3); sref(3) = sref(2); sref(2) = sref(1); sref(1) = sref(0); sdrop(1); callsubi(); } define_instruction(scall14) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(4); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(4); sref(4) = sref(3); sref(3) = sref(2); sref(2) = sref(1); sref(1) = sref(0); sdrop(1); callsubi(); } define_instruction(scall2) { int m = 2, n = fixnum_from_obj(*ip++); - ckx(ac); rd = ac; rx = obj_from_fixnum(0); - ac = obj_from_fixnum(n); + ckx(ac); rd = ac; rx = fixnum_obj(0); + ac = fixnum_obj(n); memmove((void*)(sp-n-m), (void*)(sp-n), (size_t)n*sizeof(obj)); sdrop(m); callsubi(); } define_instruction(scall20) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(0); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(0); sdrop(2); callsubi(); } define_instruction(scall21) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(1); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(1); sref(2) = sref(0); sdrop(2); callsubi(); } define_instruction(scall22) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(2); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(2); sref(3) = sref(1); sref(2) = sref(0); sdrop(2); callsubi(); } define_instruction(scall23) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(3); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(3); sref(4) = sref(2); sref(3) = sref(1); sref(2) = sref(0); sdrop(2); callsubi(); } define_instruction(scall24) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(4); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(4); sref(5) = sref(3); sref(4) = sref(2); sref(3) = sref(1); sref(2) = sref(0); sdrop(2); callsubi(); } define_instruction(scall3) { int m = 3, n = fixnum_from_obj(*ip++); - ckx(ac); rd = ac; rx = obj_from_fixnum(0); - ac = obj_from_fixnum(n); + ckx(ac); rd = ac; rx = fixnum_obj(0); + ac = fixnum_obj(n); memmove((void*)(sp-n-m), (void*)(sp-n), (size_t)n*sizeof(obj)); sdrop(m); callsubi(); } define_instruction(scall30) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(0); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(0); sdrop(3); callsubi(); } define_instruction(scall31) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(1); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(1); sref(3) = sref(0); sdrop(3); callsubi(); } define_instruction(scall32) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(2); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(2); sref(4) = sref(1); sref(3) = sref(0); sdrop(3); callsubi(); } define_instruction(scall33) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(3); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(3); sref(5) = sref(2); sref(4) = sref(1); sref(3) = sref(0); sdrop(3); callsubi(); } define_instruction(scall34) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(4); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(4); sref(6) = sref(3); sref(5) = sref(2); sref(4) = sref(1); sref(3) = sref(0); sdrop(3); callsubi(); } define_instruction(scall4) { int m = 4, n = fixnum_from_obj(*ip++); - ckx(ac); rd = ac; rx = obj_from_fixnum(0); - ac = obj_from_fixnum(n); + ckx(ac); rd = ac; rx = fixnum_obj(0); + ac = fixnum_obj(n); memmove((void*)(sp-n-m), (void*)(sp-n), (size_t)n*sizeof(obj)); sdrop(m); callsubi(); } define_instruction(scall40) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(0); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(0); sdrop(4); callsubi(); } define_instruction(scall41) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(1); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(1); sref(4) = sref(0); sdrop(4); callsubi(); } define_instruction(scall42) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(2); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(2); sref(5) = sref(1); sref(4) = sref(0); sdrop(4); callsubi(); } define_instruction(scall43) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(3); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(3); sref(6) = sref(2); sref(5) = sref(1); sref(4) = sref(0); sdrop(4); callsubi(); } define_instruction(scall44) { - ckx(ac); rd = ac; rx = obj_from_fixnum(0); ac = obj_from_fixnum(4); + ckx(ac); rd = ac; rx = fixnum_obj(0); ac = fixnum_obj(4); sref(7) = sref(3); sref(6) = sref(2); sref(5) = sref(1); sref(4) = sref(0); sdrop(4); callsubi(); } @@ -3156,7 +3180,7 @@ define_instruction(brnotlt) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { int dx = fixnum_from_obj(*ip++); - ac = obj_from_bool(get_fixnum_unchecked(x) < get_fixnum_unchecked(y)); + ac = bool_obj(get_fixnum_unchecked(x) < get_fixnum_unchecked(y)); ip = ac ? ip : ip + dx; gonexti(); } else { @@ -3166,7 +3190,7 @@ define_instruction(brnotlt) { else { cki(x); fx = (double)get_fixnum_unchecked(x); } if (likely(is_flonum_obj(y))) fy = flonum_from_obj(y); else { cki(y); fy = (double)get_fixnum_unchecked(y); } - ac = obj_from_bool(fx < fy); + ac = bool_obj(fx < fy); ip = ac ? ip : ip + dx; gonexti(); } @@ -3175,14 +3199,14 @@ define_instruction(brnotlt) { define_instruction(pushsub) { obj x = ac, y = spop(); if (likely(are_fixnum_objs(x, y))) { - ac = obj_from_fixnum(fxsub(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); + ac = fixnum_obj(fxsub(get_fixnum_unchecked(x), get_fixnum_unchecked(y))); } else { double fx, fy; if (likely(is_flonum_obj(x))) fx = flonum_from_obj(x); else { cki(x); fx = (double)get_fixnum_unchecked(x); } if (likely(is_flonum_obj(y))) fy = flonum_from_obj(y); else { cki(y); fy = (double)get_fixnum_unchecked(y); } - ac = obj_from_flonum(sp-r, fx - fy); + ac = flonum_obj(fx - fy); } spush(ac); gonexti(); @@ -3383,11 +3407,10 @@ static obj *rds_sexp(obj *r, obj *sp, obj *hp) if (iseof(ra)) { sdrop(1); return hp; } else spush(ra); ra = sref(1); hp = rds_elt(r, sp, hp); if (iseof(ra)) { sdrop(2); return hp; } else spush(ra); - hreserve(hbsz(3), sp-r); + hreserve(pairbsz(), sp-r); *--hp = sref(0); *--hp = sref(1); - *--hp = obj_from_size(PAIR_BTAG); - ra = hendblk(3); + ra = hend_pair(); sdrop(3); } break; case 'l': { @@ -3397,13 +3420,12 @@ static obj *rds_sexp(obj *r, obj *sp, obj *hp) ra = sref((int)i); hp = rds_elt(r, sp, hp); if (iseof(ra)) { sdrop(i+1); return hp; } else spush(ra); } - hreserve(hbsz(3)*n, sp-r); + hreserve(pairbsz()*n, sp-r); ra = mknull(); for (i = 0; i < n; ++i) { *--hp = ra; *--hp = sref((int)i); - *--hp = obj_from_size(PAIR_BTAG); - ra = hendblk(3); + ra = hend_pair(); } sdrop(n+1); } break; @@ -3414,10 +3436,9 @@ static obj *rds_sexp(obj *r, obj *sp, obj *hp) ra = sref((int)i); hp = rds_elt(r, sp, hp); if (iseof(ra)) { sdrop(i+1); return hp; } else spush(ra); } - hreserve(hbsz(n+1), sp-r); + hreserve(vecbsz(n), sp-r); hp -= n; memcpy(hp, sp-n, n*sizeof(obj)); - *--hp = obj_from_size(VECTOR_BTAG); - ra = hendblk(n+1); + ra = hend_vec(n); sdrop(n+1); } break; case 's': case 'y': { @@ -3518,7 +3539,7 @@ static struct embranch *rds_prefix(obj port) static obj lastpair(obj l) { - obj p = obj_from_bool(0); + obj p = bool_obj(0); while (ispair(l)) { p = l; l = cdr(l); } return p; } @@ -3534,10 +3555,9 @@ static fixnum_t length(obj l) obj *revlist2vec(obj *r, obj *sp, obj *hp) { obj l; fixnum_t n = length(ra), i; - hreserve(hbsz(n+1), sp-r); + hreserve(vecbsz(n), sp-r); for (l = ra, i = 0; i < n; ++i, l = cdr(l)) *--hp = car(l); - *--hp = obj_from_size(VECTOR_BTAG); - ra = hendblk(n+1); + ra = hend_vec(n); return hp; } @@ -3546,7 +3566,7 @@ obj *close0(obj *r, obj *sp, obj *hp) { hreserve(vmclobsz(1), sp-r); *--hp = ra; - ra = hpushvmclo(1); + ra = hend_vmclo(1); return hp; } @@ -3576,13 +3596,13 @@ static obj *rds_global_loc(obj *r, obj *sp, obj *hp) if (ispair(p)) ra = cdr(p); else { /* prepend (sym . #&sym) to *globals* */ obj box; - hreserve(hbsz(2)*1+hbsz(3)*2, sp-r); - *--hp = ra; /* mksymbol(internsym("undefined")); */ - *--hp = obj_from_size(BOX_BTAG); box = hendblk(2); + hreserve(boxbsz()*1+pairbsz()*2, sp-r); + *--hp = ra; + box = hend_box(); *--hp = box; *--hp = ra; - *--hp = obj_from_size(PAIR_BTAG); ra = hendblk(3); + ra = hend_pair(); *--hp = cx__2Aglobals_2A; *--hp = ra; - *--hp = obj_from_size(PAIR_BTAG); cx__2Aglobals_2A = hendblk(3); + cx__2Aglobals_2A = hend_pair(); ra = box; } } else { @@ -3618,9 +3638,9 @@ static obj *rds_seq(obj *r, obj *sp, obj *hp) more: c = iportpeekc(sref(1)); if (c == EOF) { - hreserve(hbsz(3), sp-r); + hreserve(pairbsz(), sp-r); *--hp = sref(0); *--hp = glue(cx_ins_2D, halt); - *--hp = obj_from_size(PAIR_BTAG); ra = hendblk(3); + ra = hend_pair(); } else if (c == '}') { ra = sref(0); } else { @@ -3632,42 +3652,42 @@ more: ra = mkeof(); } else switch (pbr->etyp) { case 0: { - hreserve(hbsz(3), sp-r); + hreserve(pairbsz(), sp-r); *--hp = sref(0); *--hp = pbr->g; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); goto more; } break; case 1: { ra = sref(1); hp = rds_arg(r, sp, hp); if (iseof(ra)) goto out; - hreserve(hbsz(3)*2, sp-r); + hreserve(pairbsz()*2, sp-r); *--hp = sref(0); *--hp = pbr->g; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); *--hp = sref(0); *--hp = ra; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); goto more; } break; case 2: { ra = sref(1); hp = rds_arg(r, sp, hp); if (iseof(ra)) goto out; - hreserve(hbsz(3)*2, sp-r); + hreserve(pairbsz()*2, sp-r); *--hp = sref(0); *--hp = pbr->g; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); *--hp = sref(0); *--hp = ra; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); ra = sref(1); hp = rds_arg(r, sp, hp); if (iseof(ra)) goto out; - hreserve(hbsz(3), sp-r); + hreserve(pairbsz(), sp-r); *--hp = sref(0); *--hp = ra; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); goto more; } break; case 'f': case 't': case 'n': { - hreserve(hbsz(3)*2, sp-r); + hreserve(pairbsz()*2, sp-r); *--hp = sref(0); *--hp = pbr->g; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); *--hp = sref(0); *--hp = (pbr->etyp == 'n' ? mknull() : obj_from_bool(pbr->etyp == 't')); - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); goto more; } break; case 'g': { /* gref/gset */ @@ -3675,24 +3695,24 @@ more: if (iseof(ra)) goto out; hp = rds_global_loc(r, sp, hp); /* ra => ra */ if (iseof(ra)) goto out; - hreserve(hbsz(3)*2, sp-r); + hreserve(pairbsz()*2, sp-r); *--hp = sref(0); *--hp = pbr->g; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); *--hp = sref(0); *--hp = ra; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); goto more; } break; case 'a': { /* andbo */ - hreserve(hbsz(3), sp-r); + hreserve(pairbsz(), sp-r); *--hp = sref(0); *--hp = pbr->g; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); c = iportpeekc(sref(1)); if (c == EOF || c == '}') { ra = mkeof(); goto out; } pbr = rds_prefix(sref(1)); if (pbr->g == 0 || pbr->etyp != 0) { ra = mkeof(); goto out; } - hreserve(hbsz(3), sp-r); + hreserve(pairbsz(), sp-r); *--hp = sref(0); *--hp = pbr->g; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); goto more; } break; case 's': { /* save */ @@ -3700,11 +3720,11 @@ more: ra = sref(1); hp = rds_block(r, sp, hp); if (iseof(ra)) goto out; n = length(ra); - hreserve(hbsz(3)*2, sp-r); + hreserve(pairbsz()*2, sp-r); *--hp = sref(0); *--hp = pbr->g; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); *--hp = sref(0); *--hp = obj_from_fixnum(n); - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); if (n > 0) { obj lp = lastpair(ra); assert(ispair(lp)); cdr(lp) = sref(0); sref(0) = ra; @@ -3720,13 +3740,13 @@ more: if (iseof(ra)) goto out; hp = revlist2vec(r, sp, hp); /* ra => ra */ if (iseof(ra)) goto out; - hreserve(hbsz(3)*3, sp-r); + hreserve(pairbsz()*3, sp-r); *--hp = sref(0); *--hp = pbr->g; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); *--hp = sref(0); *--hp = obj_from_fixnum(n); - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); *--hp = sref(0); *--hp = ra; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); goto more; } break; case 'b': { /* branches */ @@ -3739,33 +3759,33 @@ more: spush(bseq1); /* ... port, l, bseq1 <= sp */ ra = sref(2); hp = rds_block(r, sp, hp); if (iseof(ra)) { sdrop(1); goto out; } - hreserve(hbsz(3)*4, sp-r); + hreserve(pairbsz()*4, sp-r); bseq1 = spop(); bseq2 = ra; n = length(bseq1); *--hp = sref(0); *--hp = pbr->g; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); *--hp = sref(0); *--hp = obj_from_fixnum(n+2); - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); if (n > 0) { obj lp = lastpair(bseq1); assert(ispair(lp)); cdr(lp) = sref(0); sref(0) = bseq1; } *--hp = sref(0); *--hp = glue(cx_ins_2D, br); - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); n = length(bseq2); *--hp = sref(0); *--hp = obj_from_fixnum(n); - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); if (n > 0) { obj lp = lastpair(bseq2); assert(ispair(lp)); cdr(lp) = sref(0); sref(0) = bseq2; } } else { /* regular 1-arm branch */ n = length(ra); - hreserve(hbsz(3)*2, sp-r); + hreserve(pairbsz()*2, sp-r); *--hp = sref(0); *--hp = pbr->g; - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); *--hp = sref(0); *--hp = obj_from_fixnum(n); - *--hp = obj_from_size(PAIR_BTAG); sref(0) = hendblk(3); + sref(0) = hend_pair(); if (n > 0) { obj lp = lastpair(ra); assert(ispair(lp)); cdr(lp) = sref(0); sref(0) = ra; @@ -3930,11 +3950,11 @@ static obj *init_module(obj *r, obj *sp, obj *hp, const char **mod) /* or add new binding */ spush(oldden); /* protect from gc */ if (!bnd) { /* acons (sym . #f) */ - hreserve(hbsz(3)*2, sp-r); + hreserve(pairbsz()*2, sp-r); *--hp = obj_from_bool(0); *--hp = sym; - *--hp = obj_from_size(PAIR_BTAG); bnd = hendblk(3); + bnd = hend_pair(); *--hp = cx__2Atransformers_2A; *--hp = bnd; - *--hp = obj_from_size(PAIR_BTAG); cx__2Atransformers_2A = hendblk(3); + cx__2Atransformers_2A = hend_pair(); } cdr(bnd) = spop(); /* oldden */ continue; @@ -3953,11 +3973,11 @@ static obj *init_module(obj *r, obj *sp, obj *hp, const char **mod) } /* or add new binding */ if (bnd == mknull()) { /* acons (sym . #f) */ - hreserve(hbsz(3)*2, sp-r); + hreserve(pairbsz()*2, sp-r); *--hp = obj_from_bool(0); *--hp = sym; - *--hp = obj_from_size(PAIR_BTAG); bnd = hendblk(3); + bnd = hend_pair(); *--hp = cx__2Atransformers_2A; *--hp = bnd; - *--hp = obj_from_size(PAIR_BTAG); cx__2Atransformers_2A = hendblk(3); + cx__2Atransformers_2A = hend_pair(); } /* sexp-decode data into the cdr of the binding */ spush(bnd); /* protect from gc */ diff --git a/src/s.scm b/src/s.scm index f0c5aee..d51e8a0 100644 --- a/src/s.scm +++ b/src/s.scm @@ -861,6 +861,8 @@ (define-syntax call-with-current-continuation call/cc) +;dynamic-wind + (define (%map1 p l) (let loop ([l l] [r '()]) (if (pair? l) @@ -945,6 +947,35 @@ (apply for-each p (map vector->list (cons v v*))))) +;--------------------------------------------------------------------------------------------- +; Exceptions +;--------------------------------------------------------------------------------------------- + +;TBD: +; +;with-exception-handler +;raise +;raise-continuable +;error +;error-object? +;error-object-message +;error-object-irritants +;read-error? +;file-error? + +;--------------------------------------------------------------------------------------------- +; Environments and evaluation +;--------------------------------------------------------------------------------------------- + +;TBD: +; +;environment +;scheme-report-environment +;null-environment +;interaction-environment +;eval + + ;--------------------------------------------------------------------------------------------- ; I/O Ports ;---------------------------------------------------------------------------------------------