Skip to content

Commit

Permalink
prim: Fix values procedure
Browse files Browse the repository at this point in the history
  • Loading branch information
okuoku committed Mar 13, 2023
1 parent f16f866 commit 6f50e68
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
4 changes: 4 additions & 0 deletions c-proto/c-proto.c
Original file line number Diff line number Diff line change
Expand Up @@ -1166,6 +1166,10 @@ call_lambda(RnCtx* ctx, struct vmstate_s* state){
}
/* Construct rest argument on acc */
RnZone0(ctx, &acc, ZZ_NIL);
#ifdef TRACE
fprintf(stderr, "vals = %d, layout = %zd, argnc = %zd, nargs = %zd\n",
state->vals, layout, argnc, nargs);
#endif
for(res = argnc; res != 0; res--){
RnRibRef(ctx, &tmp, &state->stack, 0);
/*
Expand Down
5 changes: 5 additions & 0 deletions c-proto/prims.inc.h
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,7 @@ ExProcedureP(RnCtx* ctx, Value* out, Value* x){
static void
ExValues(RnCtx* ctx, int argc, Value* stack){
int i;
Value zero;
Value six;
Value tmp;
Value tmp2;
Expand All @@ -667,16 +668,20 @@ ExValues(RnCtx* ctx, int argc, Value* stack){
}else{
RnValueLink(ctx, &tmp2);
RnValueLink(ctx, &tmp);
RnValueLink(ctx, &zero);
RnValueLink(ctx, &six);
RnInt64(ctx, &zero, 0);
RnInt64(ctx, &six, 6);
RnZone0(ctx, &tmp, ZZ_NIL);
for(i=0;i!=argc;i++){
RnRibRef(ctx, &tmp2, stack, 0);
RnCons(ctx, &tmp, &tmp2, &tmp);
RnRibRef(ctx, stack, stack, 1);
}
RnRib(ctx, &tmp, &tmp, &zero, &six);
RnCons(ctx, stack, &tmp, stack);
RnValueUnlink(ctx, &six);
RnValueUnlink(ctx, &zero);
RnValueUnlink(ctx, &tmp);
RnValueUnlink(ctx, &tmp2);
}
Expand Down

0 comments on commit 6f50e68

Please sign in to comment.