8 static char *
rcsid=
"@(#)$Id$";
29 if (vv[i]==sym)
return(&(obj->
c.
obj.
iv[i]));
36 {
register struct bindframe *bf=ctx->bindfp;
42 val=ctx->specials->
c.
vec.
v[vt];
54 if (val==UNBOUND)
goto getspecial;
58 if (vaddr)
return(*vaddr);}
71 {
register struct bindframe *bf=ctx->bindfp;
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;
100 {
register struct fletframe *ffp=ctx->fletfp;
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++;}
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);}
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);
984 #elif defined(ARM) && defined(__ARM_ARCH_7A__) 986 extern int exec_function_i(
void (*)(),
int *,
int *,
int,
int *);
987 extern int exec_function_f(
void (*)(),
int *,
int *,
int,
int *);
989 #define exec_function_asm(FUNC) \ 992 "str r3, [r7, #60]\n\t" \ 993 "b ."FUNC"_LPCK\n\t" \ 995 "ldr r3, [r7, #60]\n\t" \ 997 "lsl r4, r3, #2\n\t" \ 998 "ldr r1, [r7, #80]\n\t" \ 999 "add r1, r1, r4\n\t" \ 1000 "add r2, sp, r4\n\t" \ 1001 "ldr r0, [r1]\n\t" \ 1002 "str r0, [r2]\n\t" \ 1003 "adds r3, r3, #1\n\t" \ 1004 "str r3, [r7, #60]\n\t" \ 1005 "."FUNC"_LPCK:\n\t" \ 1006 "ldr r2, [r7, #60]\n\t" \ 1007 "ldr r3, [r7]\n\t" \ 1009 "blt ."FUNC"_LP\n\t" \ 1011 "ldr r0, [r7,#4]\n\t" \ 1012 "vldr.32 s0, [r0]\n\t" \ 1013 "vldr.32 s1, [r0,#4]\n\t" \ 1014 "vldr.32 s2, [r0,#8]\n\t" \ 1015 "vldr.32 s3, [r0,#12]\n\t" \ 1016 "vldr.32 s4, [r0,#16]\n\t" \ 1017 "vldr.32 s5, [r0,#20]\n\t" \ 1018 "vldr.32 s6, [r0,#24]\n\t" \ 1019 "vldr.32 s7, [r0,#28]\n\t" \ 1020 "vldr.32 s8, [r0,#32]\n\t" \ 1021 "vldr.32 s9, [r0,#36]\n\t" \ 1022 "vldr.32 s10, [r0,#40]\n\t" \ 1023 "vldr.32 s11, [r0,#44]\n\t" \ 1024 "vldr.32 s12, [r0,#48]\n\t" \ 1025 "vldr.32 s13, [r0,#52]\n\t" \ 1026 "vldr.32 s14, [r0,#56]\n\t" \ 1027 "vldr.32 s15, [r0,#60]\n\t" \ 1029 "ldr r0, [r7,#8]\n\t" \ 1030 "ldr r0, [r0]\n\t" \ 1031 "ldr r1, [r7,#8]\n\t" \ 1032 "ldr r1, [r1,#4]\n\t" \ 1033 "ldr r2, [r7,#8]\n\t" \ 1034 "ldr r2, [r2,#8]\n\t" \ 1035 "ldr r3, [r7,#8]\n\t" \ 1036 "ldr r3, [r3,#12]\n\t" \ 1038 "ldr r6, [r7, #12]\n\t" \ 1041 __asm__ (
".align 4\n" 1042 ".global exec_function_i\n\t" 1043 ".type exec_function_i, %function\n" 1044 "exec_function_i:\n\t" 1046 "sub sp, sp, #136\n\t" 1047 "add r7, sp, #64\n\t" 1048 "str r0, [r7, #12]\n\t" 1049 "str r1, [r7, #8]\n\t" 1050 "str r2, [r7, #4]\n\t" 1052 exec_function_asm(
"FUNCI")
1054 "adds r7, r7, #72\n\t" 1058 ".size exec_function_i, .-exec_function_i\n\t" 1061 __asm__ (
".align 4\n" 1062 ".global exec_function_f\n\t" 1063 ".type exec_function_f, %function\n" 1064 "exec_function_f:\n\t" 1066 "sub sp, sp, #136\n\t" 1067 "add r7, sp, #64\n\t" 1068 "str r0, [r7, #12]\n\t" 1069 "str r1, [r7, #8]\n\t" 1070 "str r2, [r7, #4]\n\t" 1072 exec_function_asm(
"FUNCF")
1074 "vmov r0, s0 @ <retval>\n\t" 1075 "vmov r1, s1 @ <retval>\n\t" 1076 "adds r7, r7, #72\n\t" 1080 ".size exec_function_f, .-exec_function_f\n\t" 1083 #define NUM_INT_ARGUMENTS 4 1084 #define NUM_FLT_ARGUMENTS 16 1085 #define NUM_EXTRA_ARGUMENTS 16 1099 int icntr = 0, fcntr_d = 0, fcntr_f = 0, vcntr_8 = 0, vcntr_16 = 0;
1118 while (iscons(paramtypes)) {
1119 p=ccar(paramtypes); paramtypes=ccdr(paramtypes);
1122 c = isint(lisparg)?
intval(lisparg):bigintval(lisparg);
1123 if(icntr < NUM_INT_ARGUMENTS) {
1126 vargv[vcntr_8++] = c;
1127 if ( vcntr_8 % 2 == 1 ) vcntr_16 += 2;
1128 if ( vcntr_8 % 2 == 0 ) vcntr_8 = vcntr_16;
1131 if (elmtypeof(lisparg)==ELM_FOREIGN) c=lisparg->
c.
ivec.
iv[0];
1133 if(icntr < NUM_INT_ARGUMENTS) {
1136 vargv[vcntr_8++] = c;
1137 if ( vcntr_8 % 2 == 1 ) vcntr_16 += 2;
1138 if ( vcntr_8 % 2 == 0 ) vcntr_8 = vcntr_16;
1145 if(fcntr_f < NUM_FLT_ARGUMENTS) {
1146 fargv[fcntr_f++] = c;
1147 if ( fcntr_f % 2 == 1 ) fcntr_d += 2;
1148 if ( fcntr_f % 2 == 0 ) fcntr_f = fcntr_d;
1150 vargv[vcntr_8++] = c;
1151 if ( vcntr_8 % 2 == 1 ) vcntr_16 += 2;
1152 if ( vcntr_8 % 2 == 0 ) vcntr_8 = vcntr_16;
1155 numbox.d=(double)
ckfltval(lisparg);
1156 if(fcntr_d < NUM_FLT_ARGUMENTS-1) {
1157 fargv[fcntr_d++] = numbox.i.i1; fargv[fcntr_d++] = numbox.i.i2;
1158 if ( fcntr_f % 2 == 0 ) fcntr_f = fcntr_d;
1159 if(fcntr_d >= NUM_FLT_ARGUMENTS) fcntr_f = fcntr_d;
1161 vargv[vcntr_16++] = numbox.i.i1; vargv[vcntr_16++] = numbox.i.i2;
1162 if ( vcntr_8 % 2 == 0 ) vcntr_8 = vcntr_16;
1165 if (
max(vcntr_8, vcntr_16) >= NUM_EXTRA_ARGUMENTS) {
1169 int vcntr =
max(vcntr_8, vcntr_16);
1173 if (isint(lisparg)) {
1175 if(icntr < NUM_INT_ARGUMENTS) iargv[icntr++] = c;
else vargv[vcntr++] = c;
1176 }
else if (isflt(lisparg)) {
1179 if(fcntr_f < NUM_FLT_ARGUMENTS) fargv[fcntr_f++] = c;
else vargv[vcntr++] = c;
1180 }
else if (isvector(lisparg)) {
1181 if (elmtypeof(lisparg)==ELM_FOREIGN) c=lisparg->
c.
ivec.
iv[0];
1183 if(icntr < NUM_INT_ARGUMENTS) iargv[icntr++] = c;
else vargv[vcntr++] = c;
1184 }
else if (isbignum(lisparg)){
1185 if (bigsize(lisparg)==1){
1188 if(icntr < NUM_INT_ARGUMENTS) iargv[icntr++] = c;
else vargv[vcntr++] = c;
1190 fprintf(stderr,
"bignum size!=1\n");
1194 if(icntr < NUM_INT_ARGUMENTS) iargv[icntr++] = c;
else vargv[vcntr++] = c;
1196 if (vcntr >= NUM_EXTRA_ARGUMENTS) {
1202 numbox.l = exec_function_f((
void (*)())ifunc, iargv, fargv, vcntr, vargv);
1203 f = (double)numbox.f;
1206 c = exec_function_i((
void (*)())ifunc, iargv, fargv, vcntr, vargv);
1208 return(mkbigint(c));
1210 p=makepointer(c-2*
sizeof(
pointer));
1211 if (isvector(p))
return(p);
1213 }
else if (iscons(resulttype)) {
1216 resulttype=ccdr(resulttype);
1217 if (resulttype!=
NIL) j=ckintval(ccar(resulttype));
1218 else j=strlen((
char *)c);
1221 resulttype=ccdr(resulttype);
1222 if (resulttype!=
NIL) j=ckintval(ccar(resulttype));
1223 else j=strlen((
char *)c);
1253 #if (WORD_SIZE == 64) 1259 while (iscons(paramtypes)) {
1260 p=ccar(paramtypes); paramtypes=ccdr(paramtypes);
1263 cargv[i++]=isint(lisparg)?
intval(lisparg):bigintval(lisparg);
1265 if (elmtypeof(lisparg)==ELM_FOREIGN) cargv[i++]=lisparg->
c.
ivec.
iv[0];
1269 cargv[i++]=(int)numbox.i.i1;}
1272 cargv[i++]=numbox.i.i1; cargv[i++]=numbox.i.i2;}
1277 if (isint(lisparg)) cargv[i++]=
intval(lisparg);
1278 else if (isflt(lisparg)) {
1281 cargv[i++]=numbox.i.i1; cargv[i++]=numbox.i.i2;}
1282 else if (isvector(lisparg)) {
1283 if (elmtypeof(lisparg)==ELM_FOREIGN)
1284 cargv[i++]=lisparg->
c.
ivec.
iv[0];
1287 else if (isbignum(lisparg)){
1288 if (bigsize(lisparg)==1){
1292 fprintf(stderr,
"bignum size!=1\n");
1311 ifunc=(double (*)())tmp_ifunc;
1314 n.i=(*ifunc)(cargv[0],cargv[1],cargv[2],cargv[3],
1315 cargv[4],cargv[5],cargv[6],cargv[7]);
1317 n.i=(*ifunc)(cargv[0],cargv[1],cargv[2],cargv[3],
1318 cargv[4],cargv[5],cargv[6],cargv[7],
1319 cargv[8],cargv[9],cargv[10],cargv[11],
1320 cargv[12],cargv[13],cargv[14],cargv[15],
1321 cargv[16],cargv[17],cargv[18],cargv[19],
1322 cargv[20],cargv[21],cargv[22],cargv[23],
1323 cargv[24],cargv[25],cargv[26],cargv[27],
1324 cargv[28],cargv[29],cargv[30],cargv[31]);
1325 #if (sun3 || sun4 || mips || alpha) 1327 n.i=(*ifunc)(cargv[0],cargv[1],cargv[2],cargv[3],
1328 cargv[4],cargv[5],cargv[6],cargv[7],
1329 cargv[8],cargv[9],cargv[10],cargv[11],
1330 cargv[12],cargv[13],cargv[14],cargv[15],
1331 cargv[16],cargv[17],cargv[18],cargv[19],
1332 cargv[20],cargv[21],cargv[22],cargv[23],
1333 cargv[24],cargv[25],cargv[26],cargv[27],
1334 cargv[28],cargv[29],cargv[30],cargv[31],
1335 cargv[32],cargv[33],cargv[34],cargv[35],
1336 cargv[36],cargv[37],cargv[38],cargv[39],
1337 cargv[40],cargv[41],cargv[42],cargv[43],
1338 cargv[44],cargv[45],cargv[46],cargv[47],
1339 cargv[48],cargv[49],cargv[50],cargv[51],
1340 cargv[52],cargv[53],cargv[54],cargv[55],
1341 cargv[56],cargv[57],cargv[58],cargv[59],
1342 cargv[60],cargv[61],cargv[62],cargv[63],
1343 cargv[64],cargv[65],cargv[66],cargv[67],
1344 cargv[68],cargv[69],cargv[70],cargv[71],
1345 cargv[72],cargv[73],cargv[74],cargv[75],
1346 cargv[76],cargv[77],cargv[78],cargv[79]);
1348 fprintf(stderr,
"%d %f\n",
n.i,
n.f);
1352 i=(*ifunc)(cargv[0],cargv[1],cargv[2],cargv[3],
1353 cargv[4],cargv[5],cargv[6],cargv[7]);
1355 i=(*ifunc)(cargv[0],cargv[1],cargv[2],cargv[3],
1356 cargv[4],cargv[5],cargv[6],cargv[7],
1357 cargv[8],cargv[9],cargv[10],cargv[11],
1358 cargv[12],cargv[13],cargv[14],cargv[15],
1359 cargv[16],cargv[17],cargv[18],cargv[19],
1360 cargv[20],cargv[21],cargv[22],cargv[23],
1361 cargv[24],cargv[25],cargv[26],cargv[27],
1362 cargv[28],cargv[29],cargv[30],cargv[31]);
1363 #if (sun3 || sun4 || mips || alpha) 1365 i=(*ifunc)(cargv[0],cargv[1],cargv[2],cargv[3],
1366 cargv[4],cargv[5],cargv[6],cargv[7],
1367 cargv[8],cargv[9],cargv[10],cargv[11],
1368 cargv[12],cargv[13],cargv[14],cargv[15],
1369 cargv[16],cargv[17],cargv[18],cargv[19],
1370 cargv[20],cargv[21],cargv[22],cargv[23],
1371 cargv[24],cargv[25],cargv[26],cargv[27],
1372 cargv[28],cargv[29],cargv[30],cargv[31],
1373 cargv[32],cargv[33],cargv[34],cargv[35],
1374 cargv[36],cargv[37],cargv[38],cargv[39],
1375 cargv[40],cargv[41],cargv[42],cargv[43],
1376 cargv[44],cargv[45],cargv[46],cargv[47],
1377 cargv[48],cargv[49],cargv[50],cargv[51],
1378 cargv[52],cargv[53],cargv[54],cargv[55],
1379 cargv[56],cargv[57],cargv[58],cargv[59],
1380 cargv[60],cargv[61],cargv[62],cargv[63],
1381 cargv[64],cargv[65],cargv[66],cargv[67],
1382 cargv[68],cargv[69],cargv[70],cargv[71],
1383 cargv[72],cargv[73],cargv[74],cargv[75],
1384 cargv[76],cargv[77],cargv[78],cargv[79]);
1386 if (resulttype==
K_INTEGER)
return(mkbigint(i));
1388 p=makepointer(i-2*
sizeof(
pointer));
1389 if (isvector(p))
return(p);
1391 else if (iscons(resulttype)) {
1394 resulttype=ccdr(resulttype);
1395 if (resulttype!=
NIL) j=ckintval(ccar(resulttype));
1396 else j=strlen((
char *)i);
1399 resulttype=ccdr(resulttype);
1400 if (resulttype!=
NIL) j=ckintval(ccar(resulttype));
1401 else j=strlen((
char *)i);
1415 register pointer *argp=ctx->vsp;
1420 #if (WORD_SIZE == 64) 1427 #if (WORD_SIZE == 64) 1435 #ifdef FUNCODE_DEBUG 1436 printf(
"funcode:func = " ); hoge_print( func );
1437 printf(
"funcode:args = " ); hoge_print( args );
1443 while (piscons(args)) {
1444 vpush(
eval(ctx,ccar(args))); args=ccdr(args); n++;
GC_POINT;}
1447 else return((*subr)(ctx,n,argp));}
1448 else if (pisfcode(func))
1450 else return((*subr)(ctx,noarg,args,0));
1454 while (iscons(args)) { vpush(ccar(args)); args=ccdr(args); n++;}
1456 tmp = (*subr)(ctx,
n,argp);
1458 return(
eval(ctx,tmp));
1461 else return((*subr)(ctx,args));
1475 {
pointer func,formal,aval,ftype,result,*argp,hook;
1480 struct fletframe *oldfletfp=ctx->fletfp, *fenv;
1486 if (noarg<0) vpush(
cons(ctx,fn,args));
1491 while (--i>=0) aval=
cons(ctx,argp[i],aval);
1492 vpush(
cons(ctx,fn,aval));}
1498 #ifdef __RETURN_BARRIER 1499 check_return_barrier(ctx);
1509 if (islist(fn)) env=ctx->bindfp;
1516 vf->
vlink=ctx->callfp;
1519 ctx->vsp+=
sizeof(
struct callframe)/(sizeof(pointer));
1522 if (pisclosure(func)) {
1526 #if (WORD_SIZE == 64) 1534 #if (WORD_SIZE == 64) 1540 #if (WORD_SIZE == 64) 1548 #if !Solaris2 && !SunOS4_1 && !Linux && !IRIX && !IRIX6 && !alpha && !Cygwin 1551 error(
E_USER,(pointer)
"garbage closure, fatal bug!"); }
1554 while (iscons(args)) {
1555 vpush(
eval(ctx,ccar(args))); args=ccdr(args); n++;
GC_POINT;}
1556 result=(*subr)(ctx,
n,argp,func);}
1557 else result=(*subr)(ctx,noarg,args,func);
1559 ctx->vsp=(pointer *)vf;
1560 ctx->callfp= vf->
vlink;
1561 ctx->fletfp=oldfletfp;
1562 #ifdef __RETURN_BARRIER 1563 check_return_barrier(ctx);
1568 else if (piscode(func)) {
1570 result=
funcode(ctx,func,args,noarg);
1571 ctx->vsp=(pointer *)vf;
1572 ctx->callfp= vf->
vlink;
1573 ctx->fletfp=oldfletfp;
1574 #ifdef __RETURN_BARRIER 1575 check_return_barrier(ctx);
1578 else if (piscons(func)) {
1583 else if (ftype==LAMCLOSURE) {
1584 fn=ccar(func); func=ccdr(func);
1586 if (env < (
struct bindframe *)ctx->stack ||
1587 (
struct bindframe *)ctx->stacklimit < env) env=0;
1598 while (iscons(args)) {
1602 vpush(aval); noarg++;}}
1604 argp=(pointer *)args;
1607 if (ftype==LAMCLOSURE) { ctx->fletfp=fenv; }
1608 result=
funlambda(ctx,fn,formal,func,argp,env,noarg);
1609 ctx->vsp=(pointer *)vf;
1610 ctx->callfp=vf->
vlink;
1612 if (ftype==MACRO) result=
eval(ctx,result);
1613 ctx->fletfp=oldfletfp;
1614 #ifdef __RETURN_BARRIER 1615 check_return_barrier(ctx);
1627 #if defined(DEBUG_COUNT) || defined(EVAL_DEBUG) 1636 printf(
"%d:", count );
1641 if (isnum(form)) p = form;
1642 else if (pissymbol(form)) p =
getval(ctx,form);
1643 else if (!piscons(form)) p = form;
1646 if (c!=
NIL && issymbol(c)) p = (*
ovafptr(
eval(ctx,ccar(form)),c));
1657 printf(
"%d:--- ", save_count );
1670 if (isnum(form))
return(form);
1671 else if (pissymbol(form))
return(
getval(ctx,form));
1672 else if (!piscons(form))
return(form);
1675 if (c!=
NIL && issymbol(c))
return(*
ovafptr(
eval(ctx,ccar(form)),c));
1683 while (iscons(forms)) {
1685 result=
eval(ctx,ccar(forms)); forms=ccdr(forms);}
1705 cnt = va_arg(ap,
int);
1707 vpush(rec); vpush(sel);
1708 while (i++ < cnt) vpush(va_arg(ap,
pointer));
1728 cnt = va_arg(ap,
int);
1730 vpush(rec); vpush(sel);
1731 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)