Revert "Check if function is naked before adding +1 for PROC opcide (#357)" (#361)

This reverts commit 6dec728efe5b8c394b4059e6845d394392c68605.
This commit is contained in:
Barnaby Keene 2018-09-02 18:49:49 +01:00 committed by GitHub
parent 6dec728efe
commit 27bdc075b2
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 5 additions and 14 deletions

View File

@ -2337,13 +2337,8 @@ static int declloc(int fstatic)
modstk(-(int)size*sizeof(cell)); modstk(-(int)size*sizeof(cell));
assert(curfunc!=NULL); assert(curfunc!=NULL);
assert((curfunc->usage & uNATIVE)==0); assert((curfunc->usage & uNATIVE)==0);
if (curfunc->flags & flagNAKED) { if (curfunc->x.stacksize<declared+1)
if (curfunc->x.stacksize<declared) curfunc->x.stacksize=declared+1; /* +1 for PROC opcode */
curfunc->x.stacksize=declared;
} else {
if (curfunc->x.stacksize<declared+1)
curfunc->x.stacksize=declared+1; /* +1 for PROC opcode */
} /* if */
} /* if */ } /* if */
/* now that we have reserved memory for the variable, we can proceed /* now that we have reserved memory for the variable, we can proceed
* to initialize it */ * to initialize it */
@ -3161,10 +3156,7 @@ SC_FUNC symbol *fetchfunc(char *name,int tag)
/* set library ID to NULL (only for native functions) */ /* set library ID to NULL (only for native functions) */
sym->x.lib=NULL; sym->x.lib=NULL;
/* set the required stack size to zero (only for non-native functions) */ /* set the required stack size to zero (only for non-native functions) */
if (sym->flags & flagNAKED) sym->x.stacksize=1; /* 1 for PROC opcode */
sym->x.stacksize=0; /* zero for naked functions */
else
sym->x.stacksize=1; /* 1 for PROC opcode */
} /* if */ } /* if */
if (pc_deprecate!=NULL) { if (pc_deprecate!=NULL) {
assert(sym!=NULL); assert(sym!=NULL);

View File

@ -2421,9 +2421,8 @@ static int nesting=0;
/* maintain max. amount of memory used */ /* maintain max. amount of memory used */
{ {
long totalsize; long totalsize;
totalsize=declared+decl_heap; /* local variables & return value size */ totalsize=declared+decl_heap+1; /* local variables & return value size,
if ((sym->flags & flagNAKED)==0) * +1 for PROC opcode */
totalsize++; /* +1 for PROC opcode */
if (lval_result->ident==iREFARRAY) if (lval_result->ident==iREFARRAY)
totalsize++; /* add hidden parameter (on the stack) */ totalsize++; /* add hidden parameter (on the stack) */
if ((sym->usage & uNATIVE)==0) if ((sym->usage & uNATIVE)==0)