8 static char *
rcsid=
"@(#)$Id$";
29 if (vv[i]==sym)
return(&(obj->
c.
obj.
iv[i]));
36 {
register struct bindframe *bf=ctx->bindfp;
40 if (sym->c.sym.vtype>=V_SPECIAL) {
41 vt=
intval(sym->c.sym.vtype);
42 val=ctx->specials->
c.
vec.
v[vt];
48 if (sym->c.sym.vtype==V_CONSTANT)
return(sym->c.sym.speval);
54 if (val==UNBOUND)
goto getspecial;
58 if (vaddr)
return(*vaddr);}
71 {
register struct bindframe *bf=ctx->bindfp;
75 if (sym->c.sym.vtype>=V_SPECIAL) {
76 vt=
intval(sym->c.sym.vtype);
77 pointer_update(ctx->specials->c.vec.v[vt],val);
82 if (bf->
val==UNBOUND)
goto setspecial;
83 pointer_update(bf->
val,val);
return(val);}
86 if (vaddr) {pointer_update(*vaddr,val);
return(val);}}
90 if (sym->c.sym.vtype==V_GLOBAL)
goto setspecial;
92 pointer_update(sym->c.sym.speval,val);
100 {
register struct fletframe *ffp=ctx->fletfp;
106 return(f->c.sym.spefunc);}}
118 { pointer_update(sym->c.sym.spefunc,func);}
126 if (vaddr)
return(vaddr);
143 sbf->
oldval=speval(sym); speval(sym)=newval;}
144 else { sbf->
oldval=spevalof(sym,vt); spevalof(sym,vt)=newval;}
147 ctx->special_bind_count++;}
155 if (ctx->special_bind_count<count)
error(
E_USER,(
pointer)
"inconsistent special binding");
156 ctx->special_bind_count -=
count;
160 if (s->
c.
sym.
vtype==V_GLOBAL) {pointer_update(speval(s),sbfp->
oldval);}
161 else pointer_update(Spevalof(s),sbfp->
oldval);
171 while (limit<=sbfp) {
174 if (s->
c.
sym.
vtype==V_GLOBAL) {pointer_update(speval(s),sbfp->
oldval);}
175 else pointer_update(Spevalof(s),sbfp->
oldval);
177 ctx->special_bind_count--;}
186 ctx->vsp +=
sizeof(
struct bindframe)/sizeof(eusinteger_t);
202 while (p>declscope) {
204 if (p->
val==UNBOUND) {
bindspecial(ctx,var,val);
return(ctx->bindfp);}
209 if (var->c.sym.vtype>= V_GLOBAL ) {
217 return(ctx->bindfp);}
226 while (iscons(decllist)) {
227 decl=ccar(decllist); decllist=ccdr(decllist);
231 while (iscons(decl)) {
233 if (var->
c.
sym.
vtype < V_SPECIAL) env=
vbind(ctx,var,UNBOUND,env,ctx->bindfp);
234 decl=ccdr(decl); } } }
239 register
pointer keyvec, *actuals, *results;
240 int noarg,allowotherkeys;
241 {
register int i=0,
n=0,suppliedbits=0,keysize, bitpos;
242 register pointer akeyvar, *keys;
244 if (noarg<=0)
return(suppliedbits);
246 keysize=vecsize(keyvec);
247 for (i=0; i<keysize; i++) {
249 take_care(results[i]);
254 akeyvar=actuals[
n++];
258 keys=keyvec->
c.
vec.
v;
259 if (akeyvar==K_ALLOWOTHERKEYS) allowotherkeys=(actuals[
n]!=
NIL);
260 while (i<keysize && keys[i]!=akeyvar) i++;
263 if ((suppliedbits & bitpos) ==0) {
264 pointer_update(results[i],actuals[
n]);
265 suppliedbits |= bitpos;} }
268 return(suppliedbits);}
277 register pointer fkeyvar,akeyvar;
278 pointer keys[KEYWORDPARAMETERLIMIT],
279 vars[KEYWORDPARAMETERLIMIT],
280 inits[KEYWORDPARAMETERLIMIT];
281 register int nokeys=0,i,
n,allowotherkeys=0;
284 while (iscons(formal)) {
285 fkeyvar=ccar(formal); formal=ccdr(formal);
286 if (iscons(fkeyvar)) {
288 initform=ccdr(fkeyvar);
289 if (iscons(initform)) initform=ccar(initform);
else initform=
NIL;
291 fkeyvar=ccar(fvar); fvar=ccdr(fvar);
301 else if (fkeyvar==ALLOWOTHERKEYS) {
303 if (islist(formal)) {
304 fkeyvar=ccar(formal); formal=ccdr(formal);
305 if (fkeyvar==AUX)
break;
308 else if (fkeyvar==AUX)
break;
317 keys[nokeys]=fkeyvar;
319 inits[nokeys]=initform;
321 if (nokeys>=KEYWORDPARAMETERLIMIT) {
322 error(
E_USER,
"Too many keyword parameters >%d",KEYWORDPARAMETERLIMIT);
330 if (akeyvar==K_ALLOWOTHERKEYS) allowotherkeys=(argp[
n]!=
NIL);
332 while (i<nokeys && keys[i]!=akeyvar) i++;
335 if (inits[i]!=UNBOUND) {
336 env=
vbind(ctx,vars[i],argp[n],env,bf);
342 if (inits[i]!=UNBOUND) env=
vbind(ctx,vars[i],
eval(ctx,inits[i]),env,bf);
351 {
pointer ftype,fvar,result,decl,aval,initform,fkeyvar,akeyvar;
362 while (iscons(body)) {
364 if (!iscons(decl) || (ccar(decl)!=
QDECLARE))
break;
365 env=
declare(ctx,ccdr(decl),env);
369 while (iscons(formal)) {
370 fvar=ccar(formal); formal=ccdr(formal);
371 if (fvar==OPTIONAL)
goto bindopt;
372 if (fvar==REST)
goto bindrest;
373 if (fvar==KEY) { keyno=
n;
goto bindkey;}
374 if (fvar==AUX)
goto bindaux;
376 env=
vbind(ctx,fvar,argp[n],env,bf);
381 while (iscons(formal)) {
382 fvar=ccar(formal); formal=ccdr(formal);
383 if (fvar==REST)
goto bindrest;
384 if (fvar==KEY) { keyno=
n;
goto bindkey;}
385 if (fvar==AUX)
goto bindaux;
388 if (iscons(fvar)) fvar=ccar(fvar);}
389 else if (iscons(fvar)) {
392 if (iscons(initform)) {
GC_POINT;aval=
eval(ctx,ccar(initform));}
395 env=
vbind(ctx,fvar,aval,env,bf);
406 while (n<i) result=
cons(ctx,argp[--i],result);
407 env=
vbind(ctx,fvar,result,env,bf);
409 if (!iscons(formal))
goto evbody;
410 fvar=ccar(formal); formal=ccdr(formal);
411 if (fvar==KEY)
goto bindkey;
412 else if (fvar==AUX)
goto bindaux;
415 env=
bindkeyparams(ctx,formal,&argp[keyno],noarg-keyno,env,bf);
416 while (iscons(formal)) {
417 fvar=ccar(formal); formal=ccdr(formal);
418 if (fvar==AUX)
goto bindaux;}
421 while (iscons(formal)) {
422 fvar=ccar(formal); formal=ccdr(formal);
426 if (iscons(initform)) {
GC_POINT;aval=
eval(ctx,ccar(initform));}
429 env=
vbind(ctx,fvar,aval,env,bf); }
442 #ifdef __RETURN_BARRIER 443 check_return_barrier(ctx);
470 while (iscons(paramtypes)) {
471 p=ccar(paramtypes); paramtypes=ccdr(paramtypes);
474 cargv[i++].
ival=isint(lisparg)?
intval(lisparg):bigintval(lisparg);
477 if (elmtypeof(lisparg)==ELM_FOREIGN)
484 if (isint(lisparg)) cargv[i++].
ival=
intval(lisparg);
485 else if (isflt(lisparg)) cargv[i++].
fval=
ckfltval(lisparg);
486 else if (isvector(lisparg)) {
487 if (elmtypeof(lisparg)==ELM_FOREIGN)
492 if (resulttype==
K_FLOAT)
return(
makeflt(f_call_foreign(func,
n,cargv)));
494 i=i_call_foreign(func,
n,cargv);
495 if (resulttype==
K_INTEGER)
return(mkbigint(i));
497 p=makepointer(i-2*
sizeof(
pointer));
498 if (isvector(p))
return(p);
500 else if (iscons(resulttype)) {
503 resulttype=ccdr(resulttype);
504 if (resulttype!=
NIL) j=ckintval(ccar(resulttype));
505 else j=strlen((
char *)i);
508 resulttype=ccdr(resulttype);
509 if (resulttype!=
NIL) j=ckintval(ccar(resulttype));
510 else j=strlen((
char *)i);
522 extern int i_call_foreign(
eusinteger_t (*)(),
int,
int *);
523 extern double f_call_foreign(
eusinteger_t (*)(),
int,
int *);
535 unsigned int *offset,*isfloat,m=0;
545 offset=(
unsigned int *)alloca(
n*
sizeof(
unsigned int));
546 isfloat=(
unsigned int *)alloca(
n*
sizeof(
unsigned int));
547 while (iscons(paramtypes)) {
548 p=ccar(paramtypes); paramtypes=ccdr(paramtypes);
552 offset[i]=(m+1)&~1; m=offset[i++]+2;}
554 cargs[i++].
ival=isint(lisparg)?
intval(lisparg):bigintval(lisparg);
557 if (elmtypeof(lisparg)==ELM_FOREIGN)
565 if (isfloat[i]=isflt(lisparg)) {
567 offset[i]=(m+1)&~1; m=offset[i++]+2;}
568 else if (isint(lisparg)) {
571 else if (isvector(lisparg)) {
572 if (elmtypeof(lisparg)==ELM_FOREIGN)
579 cargv=(
int *)alloca(m*
sizeof(
int));
580 for (i=0; i<
n; ++i) {
582 numbox.d=(double)cargs[i].fval;
583 cargv[offset[i]]=numbox.i.i1; cargv[offset[i]+1]=numbox.i.i2;}
584 else cargv[offset[i]]=cargs[i].
ival;}
586 if (resulttype==
K_FLOAT)
return(
makeflt(f_call_foreign(func,m,cargv)));
588 i=i_call_foreign(func,m,cargv);
589 if (resulttype==
K_INTEGER)
return(mkbigint(i));
591 p=makepointer(i-2*
sizeof(
pointer));
592 if (isvector(p))
return(p);
594 else if (iscons(resulttype)) {
597 resulttype=ccdr(resulttype);
598 if (resulttype!=
NIL) j=ckintval(ccar(resulttype));
599 else j=strlen((
char *)i);
602 resulttype=ccdr(resulttype);
603 if (resulttype!=
NIL) j=ckintval(ccar(resulttype));
604 else j=strlen((
char *)i);
613 #if (defined(x86_64) || defined(aarch64)) 614 extern long exec_function_i(
void (*)(),
long *,
long *,
long,
long *);
615 extern long exec_function_f(
void (*)(),
long *,
long *,
long,
long *);
623 __asm__ (
".align 8\n" 625 "_exec_function_i:\n\t" 627 "exec_function_i:\n\t" 630 "sub $0x120, %rsp\n\t" 632 "movsd 0x00(%rax), %xmm0\n\t" 633 "movsd 0x08(%rax), %xmm1\n\t" 634 "movsd 0x10(%rax), %xmm2\n\t" 635 "movsd 0x18(%rax), %xmm3\n\t" 636 "movsd 0x20(%rax), %xmm4\n\t" 637 "movsd 0x28(%rax), %xmm5\n\t" 638 "movsd 0x30(%rax), %xmm6\n\t" 639 "movsd 0x38(%rax), %xmm7\n\t" 642 "cmpl %ecx, %r10d\n\t" 645 "mov (%r8), %rbx\n\t" 646 "mov %rbx, (%rax)\n\t" 650 "cmpl %r10d, %ecx\n\t" 655 "mov 0x00(%rax), %rdi\n\t" 656 "mov 0x08(%rax), %rsi\n\t" 657 "mov 0x10(%rax), %rdx\n\t" 658 "mov 0x18(%rax), %rcx\n\t" 659 "mov 0x20(%rax), %r8\n\t" 660 "mov 0x28(%rax), %r9\n\t" 661 "mov $0x00, %eax\n\t" 663 "add $0x120, %rsp\n\t" 667 __asm__ (
".align 8\n" 669 "_exec_function_f:\n\t" 671 "exec_function_f:\n\t" 674 "sub $0x120, %rsp\n\t" 676 "movsd 0x00(%rax), %xmm0\n\t" 677 "movsd 0x08(%rax), %xmm1\n\t" 678 "movsd 0x10(%rax), %xmm2\n\t" 679 "movsd 0x18(%rax), %xmm3\n\t" 680 "movsd 0x20(%rax), %xmm4\n\t" 681 "movsd 0x28(%rax), %xmm5\n\t" 682 "movsd 0x30(%rax), %xmm6\n\t" 683 "movsd 0x38(%rax), %xmm7\n\t" 686 "cmpl %ecx, %r10d\n\t" 689 "mov (%r8), %rbx\n\t" 690 "mov %rbx, (%rax)\n\t" 694 "cmpl %r10d, %ecx\n\t" 699 "mov 0x00(%rax), %rdi\n\t" 700 "mov 0x08(%rax), %rsi\n\t" 701 "mov 0x10(%rax), %rdx\n\t" 702 "mov 0x18(%rax), %rcx\n\t" 703 "mov 0x20(%rax), %r8\n\t" 704 "mov 0x28(%rax), %r9\n\t" 705 "mov $0x00, %eax\n\t" 707 "movsd %xmm0, (%rsp)\n\t" 708 "mov (%rsp), %rax\n\t" 709 "add $0x120, %rsp\n\t" 716 __asm__ (
".align 8\n" 717 "exec_function_i:\n\t" 718 "sub sp, sp, #192\n\t" 719 "stp x29, x30, [sp, 128]\n\t" 720 "add x29, sp, 128\n\t" 721 "str x0, [x29, 56]\n\t" 722 "str x1, [x29, 48]\n\t" 723 "str x2, [x29, 40]\n\t" 724 "str x3, [x29, 32]\n\t" 725 "str x4, [x29, 24]\n\t" 728 "ldr x2, [x29, 24]\n\t" 738 "ldr x5, [x29, 32]\n\t" 742 "ldr x0, [x29, 40]\n\t" 759 "ldr x0, [x29, 48]\n\t" 776 "ldr x8, [x29, 56]\n\t" 780 "ldp x29, x30, [sp], 64\n\t" 784 __asm__ (
".align 8\n" 785 "exec_function_f:\n\t" 786 "sub sp, sp, #192\n\t" 787 "stp x29, x30, [sp, 128]\n\t" 788 "add x29, sp, 128\n\t" 789 "str x0, [x29, 56]\n\t" 790 "str x1, [x29, 48]\n\t" 791 "str x2, [x29, 40]\n\t" 792 "str x3, [x29, 32]\n\t" 793 "str x4, [x29, 24]\n\t" 796 "ldr x2, [x29, 24]\n\t" 806 "ldr x5, [x29, 32]\n\t" 810 "ldr x0, [x29, 40]\n\t" 827 "ldr x0, [x29, 48]\n\t" 844 "ldr x8, [x29, 56]\n\t" 847 "str d0, [x29, 56]\n\t" 848 "ldr x0, [x29, 56]\n\t" 850 "ldp x29, x30, [sp], 64\n\t" 856 #define NUM_INT_ARGUMENTS 6 857 #define NUM_FLT_ARGUMENTS 8 858 #define NUM_EXTRA_ARGUMENTS 16 860 #define NUM_INT_ARGUMENTS 8 861 #define NUM_FLT_ARGUMENTS 8 862 #define NUM_EXTRA_ARGUMENTS 16 877 int icntr = 0, fcntr = 0, vcntr = 0;
897 while (iscons(paramtypes)) {
898 p=ccar(paramtypes); paramtypes=ccdr(paramtypes);
901 c = isint(lisparg)?
intval(lisparg):bigintval(lisparg);
902 if(icntr < NUM_INT_ARGUMENTS) iargv[icntr++] = c;
else vargv[vcntr++] = c;
904 if (elmtypeof(lisparg)==ELM_FOREIGN) c=lisparg->
c.
ivec.
iv[0];
906 if(icntr < NUM_INT_ARGUMENTS) iargv[icntr++] = c;
else vargv[vcntr++] = c;
910 if(fcntr < NUM_FLT_ARGUMENTS) fargv[fcntr++] = c;
else vargv[vcntr++] = c;
914 if(fcntr < NUM_FLT_ARGUMENTS) fargv[fcntr++] = c;
else vargv[vcntr++] = c;
916 if (vcntr >= NUM_EXTRA_ARGUMENTS) {
923 if (isint(lisparg)) {
925 if(icntr < NUM_INT_ARGUMENTS) iargv[icntr++] = c;
else vargv[vcntr++] = c;
926 }
else if (isflt(lisparg)) {
929 if(fcntr < NUM_FLT_ARGUMENTS) fargv[fcntr++] = c;
else vargv[vcntr++] = c;
930 }
else if (isvector(lisparg)) {
931 if (elmtypeof(lisparg)==ELM_FOREIGN) c=lisparg->
c.
ivec.
iv[0];
933 if(icntr < NUM_INT_ARGUMENTS) iargv[icntr++] = c;
else vargv[vcntr++] = c;
934 }
else if (isbignum(lisparg)){
935 if (bigsize(lisparg)==1){
938 if(icntr < NUM_INT_ARGUMENTS) iargv[icntr++] = c;
else vargv[vcntr++] = c;
940 fprintf(stderr,
"bignum size!=1\n");
944 if(icntr < NUM_INT_ARGUMENTS) iargv[icntr++] = c;
else vargv[vcntr++] = c;
946 if (vcntr >= NUM_EXTRA_ARGUMENTS) {
952 numbox.l = exec_function_f((
void (*)())ifunc, iargv, fargv, vcntr, vargv);
956 numbox.l = exec_function_f((
void (*)())ifunc, iargv, fargv, vcntr, vargv);
957 f = (double)numbox.f;
960 c = exec_function_i((
void (*)())ifunc, iargv, fargv, vcntr, vargv);
964 p=makepointer(c-2*
sizeof(
pointer));
965 if (isvector(p))
return(p);
967 }
else if (iscons(resulttype)) {
970 resulttype=ccdr(resulttype);
971 if (resulttype!=
NIL) j=ckintval(ccar(resulttype));
972 else j=strlen((
char *)c);
975 resulttype=ccdr(resulttype);
976 if (resulttype!=
NIL) j=ckintval(ccar(resulttype));
977 else j=strlen((
char *)c);
1006 #if (WORD_SIZE == 64) 1012 ffunc=(double (*)())ifunc;
1013 while (iscons(paramtypes)) {
1014 p=ccar(paramtypes); paramtypes=ccdr(paramtypes);
1017 cargv[i++]=isint(lisparg)?
intval(lisparg):bigintval(lisparg);
1019 if (elmtypeof(lisparg)==ELM_FOREIGN) cargv[i++]=lisparg->
c.
ivec.
iv[0];
1023 cargv[i++]=(int)numbox.i.i1;}
1026 cargv[i++]=numbox.i.i1; cargv[i++]=numbox.i.i2;}
1031 if (isint(lisparg)) cargv[i++]=
intval(lisparg);
1032 else if (isflt(lisparg)) {
1035 cargv[i++]=numbox.i.i1; cargv[i++]=numbox.i.i2;}
1036 else if (isvector(lisparg)) {
1037 if (elmtypeof(lisparg)==ELM_FOREIGN)
1038 cargv[i++]=lisparg->
c.
ivec.
iv[0];
1041 else if (isbignum(lisparg)){
1042 if (bigsize(lisparg)==1){
1046 fprintf(stderr,
"bignum size!=1\n");
1054 f=(*ffunc)(cargv[0],cargv[1],cargv[2],cargv[3],
1055 cargv[4],cargv[5],cargv[6],cargv[7]);
1057 f=(*ffunc)(cargv[0],cargv[1],cargv[2],cargv[3],
1058 cargv[4],cargv[5],cargv[6],cargv[7],
1059 cargv[8],cargv[9],cargv[10],cargv[11],
1060 cargv[12],cargv[13],cargv[14],cargv[15],
1061 cargv[16],cargv[17],cargv[18],cargv[19],
1062 cargv[20],cargv[21],cargv[22],cargv[23],
1063 cargv[24],cargv[25],cargv[26],cargv[27],
1064 cargv[28],cargv[29],cargv[30],cargv[31]);
1065 #if (sun3 || sun4 || mips || alpha) 1067 f=(*ffunc)(cargv[0],cargv[1],cargv[2],cargv[3],
1068 cargv[4],cargv[5],cargv[6],cargv[7],
1069 cargv[8],cargv[9],cargv[10],cargv[11],
1070 cargv[12],cargv[13],cargv[14],cargv[15],
1071 cargv[16],cargv[17],cargv[18],cargv[19],
1072 cargv[20],cargv[21],cargv[22],cargv[23],
1073 cargv[24],cargv[25],cargv[26],cargv[27],
1074 cargv[28],cargv[29],cargv[30],cargv[31],
1075 cargv[32],cargv[33],cargv[34],cargv[35],
1076 cargv[36],cargv[37],cargv[38],cargv[39],
1077 cargv[40],cargv[41],cargv[42],cargv[43],
1078 cargv[44],cargv[45],cargv[46],cargv[47],
1079 cargv[48],cargv[49],cargv[50],cargv[51],
1080 cargv[52],cargv[53],cargv[54],cargv[55],
1081 cargv[56],cargv[57],cargv[58],cargv[59],
1082 cargv[60],cargv[61],cargv[62],cargv[63],
1083 cargv[64],cargv[65],cargv[66],cargv[67],
1084 cargv[68],cargv[69],cargv[70],cargv[71],
1085 cargv[72],cargv[73],cargv[74],cargv[75],
1086 cargv[76],cargv[77],cargv[78],cargv[79]);
1091 i=(*ifunc)(cargv[0],cargv[1],cargv[2],cargv[3],
1092 cargv[4],cargv[5],cargv[6],cargv[7]);
1094 i=(*ifunc)(cargv[0],cargv[1],cargv[2],cargv[3],
1095 cargv[4],cargv[5],cargv[6],cargv[7],
1096 cargv[8],cargv[9],cargv[10],cargv[11],
1097 cargv[12],cargv[13],cargv[14],cargv[15],
1098 cargv[16],cargv[17],cargv[18],cargv[19],
1099 cargv[20],cargv[21],cargv[22],cargv[23],
1100 cargv[24],cargv[25],cargv[26],cargv[27],
1101 cargv[28],cargv[29],cargv[30],cargv[31]);
1102 #if (sun3 || sun4 || mips || alpha) 1104 i=(*ifunc)(cargv[0],cargv[1],cargv[2],cargv[3],
1105 cargv[4],cargv[5],cargv[6],cargv[7],
1106 cargv[8],cargv[9],cargv[10],cargv[11],
1107 cargv[12],cargv[13],cargv[14],cargv[15],
1108 cargv[16],cargv[17],cargv[18],cargv[19],
1109 cargv[20],cargv[21],cargv[22],cargv[23],
1110 cargv[24],cargv[25],cargv[26],cargv[27],
1111 cargv[28],cargv[29],cargv[30],cargv[31],
1112 cargv[32],cargv[33],cargv[34],cargv[35],
1113 cargv[36],cargv[37],cargv[38],cargv[39],
1114 cargv[40],cargv[41],cargv[42],cargv[43],
1115 cargv[44],cargv[45],cargv[46],cargv[47],
1116 cargv[48],cargv[49],cargv[50],cargv[51],
1117 cargv[52],cargv[53],cargv[54],cargv[55],
1118 cargv[56],cargv[57],cargv[58],cargv[59],
1119 cargv[60],cargv[61],cargv[62],cargv[63],
1120 cargv[64],cargv[65],cargv[66],cargv[67],
1121 cargv[68],cargv[69],cargv[70],cargv[71],
1122 cargv[72],cargv[73],cargv[74],cargv[75],
1123 cargv[76],cargv[77],cargv[78],cargv[79]);
1125 if (resulttype==
K_INTEGER)
return(mkbigint(i));
1127 p=makepointer(i-2*
sizeof(
pointer));
1128 if (isvector(p))
return(p);
1130 else if (iscons(resulttype)) {
1133 resulttype=ccdr(resulttype);
1134 if (resulttype!=
NIL) j=ckintval(ccar(resulttype));
1135 else j=strlen((
char *)i);
1138 resulttype=ccdr(resulttype);
1139 if (resulttype!=
NIL) j=ckintval(ccar(resulttype));
1140 else j=strlen((
char *)i);
1154 register pointer *argp=ctx->vsp;
1159 #if (WORD_SIZE == 64) 1165 if (func->c.code.entry2 !=
NIL) {
1166 #if (WORD_SIZE == 64) 1167 addr = addr | (
intval(func->c.code.entry2)&0x00000000ffffffff);
1169 addr = addr | (
intval(func->c.code.entry2)&0x0000ffff);
1174 #ifdef FUNCODE_DEBUG 1175 printf(
"funcode:func = " ); hoge_print( func );
1176 printf(
"funcode:args = " ); hoge_print( args );
1182 while (piscons(args)) {
1183 vpush(
eval(ctx,ccar(args))); args=ccdr(args); n++;
GC_POINT;}
1186 else return((*subr)(ctx,n,argp));}
1187 else if (pisfcode(func))
1189 else return((*subr)(ctx,noarg,args,0));
1193 while (iscons(args)) { vpush(ccar(args)); args=ccdr(args); n++;}
1195 tmp = (*subr)(ctx,
n,argp);
1197 return(
eval(ctx,tmp));
1200 else return((*subr)(ctx,args));
1214 {
pointer func,formal,aval,ftype,result,*argp,hook;
1219 struct fletframe *oldfletfp=ctx->fletfp, *fenv;
1225 if (noarg<0) vpush(
cons(ctx,fn,args));
1230 while (--i>=0) aval=
cons(ctx,argp[i],aval);
1231 vpush(
cons(ctx,fn,aval));}
1237 #ifdef __RETURN_BARRIER 1238 check_return_barrier(ctx);
1248 if (islist(fn)) env=ctx->bindfp;
1255 vf->
vlink=ctx->callfp;
1258 ctx->vsp+=
sizeof(
struct callframe)/(sizeof(pointer));
1261 if (pisclosure(func)) {
1265 #if (WORD_SIZE == 64) 1273 #if (WORD_SIZE == 64) 1279 #if (WORD_SIZE == 64) 1287 #if !Solaris2 && !SunOS4_1 && !Linux && !IRIX && !IRIX6 && !alpha && !Cygwin 1290 error(
E_USER,(pointer)
"garbage closure, fatal bug!"); }
1293 while (iscons(args)) {
1294 vpush(
eval(ctx,ccar(args))); args=ccdr(args); n++;
GC_POINT;}
1295 result=(*subr)(ctx,
n,argp,func);}
1296 else result=(*subr)(ctx,noarg,args,func);
1298 ctx->vsp=(pointer *)vf;
1299 ctx->callfp= vf->
vlink;
1300 ctx->fletfp=oldfletfp;
1301 #ifdef __RETURN_BARRIER 1302 check_return_barrier(ctx);
1307 else if (piscode(func)) {
1309 result=
funcode(ctx,func,args,noarg);
1310 ctx->vsp=(pointer *)vf;
1311 ctx->callfp= vf->
vlink;
1312 ctx->fletfp=oldfletfp;
1313 #ifdef __RETURN_BARRIER 1314 check_return_barrier(ctx);
1317 else if (piscons(func)) {
1322 else if (ftype==LAMCLOSURE) {
1323 fn=ccar(func); func=ccdr(func);
1325 if (env < (
struct bindframe *)ctx->stack ||
1326 (
struct bindframe *)ctx->stacklimit < env) env=0;
1337 while (iscons(args)) {
1341 vpush(aval); noarg++;}}
1343 argp=(pointer *)args;
1346 if (ftype==LAMCLOSURE) { ctx->fletfp=fenv; }
1347 result=
funlambda(ctx,fn,formal,func,argp,env,noarg);
1348 ctx->vsp=(pointer *)vf;
1349 ctx->callfp=vf->
vlink;
1351 if (ftype==MACRO) result=
eval(ctx,result);
1352 ctx->fletfp=oldfletfp;
1353 #ifdef __RETURN_BARRIER 1354 check_return_barrier(ctx);
1366 #if defined(DEBUG_COUNT) || defined(EVAL_DEBUG) 1375 printf(
"%d:", count );
1380 if (isnum(form)) p = form;
1381 else if (pissymbol(form)) p =
getval(ctx,form);
1382 else if (!piscons(form)) p = form;
1385 if (c!=
NIL && issymbol(c)) p = (*
ovafptr(
eval(ctx,ccar(form)),c));
1396 printf(
"%d:--- ", save_count );
1409 if (isnum(form))
return(form);
1410 else if (pissymbol(form))
return(
getval(ctx,form));
1411 else if (!piscons(form))
return(form);
1414 if (c!=
NIL && issymbol(c))
return(*
ovafptr(
eval(ctx,ccar(form)),c));
1422 while (iscons(forms)) {
1424 result=
eval(ctx,ccar(forms)); forms=ccdr(forms);}
1444 cnt = va_arg(ap,
int);
1446 vpush(rec); vpush(sel);
1447 while (i++ < cnt) vpush(va_arg(ap,
pointer));
1467 cnt = va_arg(ap,
int);
1469 vpush(rec); vpush(sel);
1470 while (i++ < cnt) vpush(va_arg(ap,
pointer));
pointer prinx(context *, pointer, pointer)
pointer * ovafptr(pointer o, pointer v)
pointer intern(context *, char *, int, pointer)
struct blockframe * makeblock(context *, pointer, pointer, jmp_buf *, struct blockframe *)
void setfunc(pointer sym, pointer func)
pointer cons(context *, pointer, pointer)
pointer getval(context *ctx, pointer sym)
pointer * getobjv(pointer sym, pointer varvec, pointer obj)
struct bindframe * vbind(context *ctx, pointer var, pointer val, struct bindframe *lex, struct bindframe *declscope)
struct bindframe * declare(context *ctx, pointer decllist, struct bindframe *env)
pointer call_foreign(eusinteger_t(*ifunc)(), pointer code, int n, args)
struct blockframe * dynklink
int parsekeyparams(pointer keyvec, pointer *actuals, int noarg, pointer *results, int allowotherkeys)
void bindspecial(context *ctx, pointer sym, pointer newval)
struct bindframe * bindkeyparams(context *ctx, pointer formal, pointer *argp, int noarg, struct bindframe *env, struct bindframe *bf)
pointer eval2(context *ctx, pointer form, pointer env)
pointer setval(context *ctx, pointer sym, pointer val)
void unbindx(context *ctx, int count)
struct bindframe * lexblink
pointer progn(context *ctx, pointer forms)
pointer funlambda(context *ctx, pointer fn, pointer formal, pointer body, pointer *argp, struct bindframe *env, int noarg)
struct bindframe * dynblink
struct fletframe * lexlink
pointer error(enum errorcode ec,...) pointer error(va_alist) va_dcl
void unbindspecial(context *ctx, struct specialbindframe *limit)
pointer SEND(context *, int, pointer *)
pointer makestring(char *, int)
struct specialbindframe * sblink
struct bindframe * fastbind(context *ctx, pointer var, pointer val, struct bindframe *lex)
pointer make_foreign_string(eusinteger_t, int)
pointer funcode(context *ctx, pointer func, pointer args, int noarg)
pointer eval(context *ctx, pointer form)
pointer ufuncall(context *ctx, pointer form, pointer fn, pointer args, struct bindframe *env, int noarg)
pointer getfunc(context *ctx, pointer f)
pointer get_sym_func(pointer s)