Prefix the function argument limits

This commit is contained in:
Juan Jose Garcia Ripoll 2012-06-22 23:47:45 +02:00
parent 739f030787
commit a2fe30393f
12 changed files with 25 additions and 20 deletions

View file

@ -186,14 +186,14 @@ typedef unsigned char ecl_base_char;
* In general, any of these limits must fit in a "signed int".
*/
/* Maximum number of function arguments */
#define CALL_ARGUMENTS_LIMIT 65536
#define ECL_CALL_ARGUMENTS_LIMIT 65536
/* Maximum number of required arguments */
#define LAMBDA_PARAMETERS_LIMIT CALL_ARGUMENTS_LIMIT
#define ECL_LAMBDA_PARAMETERS_LIMIT ECL_CALL_ARGUMENTS_LIMIT
/* Numb. of args. which can be passed using the C stack */
/* See cmplam.lsp if you change this value */
#define C_ARGUMENTS_LIMIT 64
#define ECL_C_ARGUMENTS_LIMIT 64
/* Maximum number of output arguments */
#define ECL_MULTIPLE_VALUES_LIMIT 64

View file

@ -83,7 +83,7 @@ mangle_name(cl_object output, unsigned char *source, int l)
cl_object output;
cl_object package;
cl_object found = Cnil;
cl_object maxarg = ecl_make_fixnum(CALL_ARGUMENTS_LIMIT);
cl_object maxarg = ecl_make_fixnum(ECL_CALL_ARGUMENTS__LIMITLIMIT);
cl_object minarg = ecl_make_fixnum(0);
bool is_symbol;
cl_object name;

View file

@ -33,7 +33,7 @@ ecl_make_cfun(cl_objectfn_fixed c_function, cl_object name, cl_object cblock, in
cf->cfunfixed.file = Cnil;
cf->cfunfixed.file_position = ecl_make_fixnum(-1);
cf->cfunfixed.narg = narg;
if (ecl_unlikely(narg < 0 || narg > C_ARGUMENTS_LIMIT))
if (ecl_unlikely(narg < 0 || narg > ECL_C_ARGUMENTS_LIMIT_LIMIT))
FEprogram_error_noreturn("ecl_make_cfun: function requires "
"too many arguments.",0);
return cf;

View file

@ -451,7 +451,7 @@ static cl_object dispatch63 (cl_narg narg, cl_object x0, cl_object x1, cl_object
return fun->cfunfixed.entry_fixed(x0, x1, x2, x3, x4, x5, x6, x7, x8, x9, x10, x11, x12, x13, x14, x15, x16, x17, x18, x19, x20, x21, x22, x23, x24, x25, x26, x27, x28, x29, x30, x31, x32, x33, x34, x35, x36, x37, x38, x39, x40, x41, x42, x43, x44, x45, x46, x47, x48, x49, x50, x51, x52, x53, x54, x55, x56, x57, x58, x59, x60, x61, x62);
}
static cl_objectfn dispatch_table[C_ARGUMENTS_LIMIT+1] = {
static cl_objectfn dispatch_table[ECL_C_ARGUMENTS_LIMIT_LIMIT+1] = {
(cl_objectfn)dispatch0,
(cl_objectfn)dispatch1,
(cl_objectfn)dispatch2,

View file

@ -2895,7 +2895,7 @@ REST: unlikely_if (stage >= AT_REST)
goto LOOP;
OUTPUT:
if ((nreq+nopt+(!Null(rest))+nkey) >= CALL_ARGUMENTS_LIMIT)
if ((nreq+nopt+(!Null(rest))+nkey) >= ECL_CALL_ARGUMENTS__LIMITLIMIT)
FEprogram_error_noreturn("LAMBDA: Argument list ist too long, ~S.", 1,
org_lambda_list);
@(return CONS(ecl_make_fixnum(nreq), lists[0])

View file

@ -156,7 +156,7 @@ cl_funcall(cl_narg narg, cl_object function, ...)
ecl_stack_frame_push(frame, lastarg->frame.base[i]);
}
} else loop_for_in (lastarg) {
if (ecl_unlikely(i >= CALL_ARGUMENTS_LIMIT)) {
if (ecl_unlikely(i >= ECL_CALL_ARGUMENTS__LIMITLIMIT)) {
ecl_stack_frame_close(frame);
FEprogram_error_noreturn("CALL-ARGUMENTS-LIMIT exceeded",0);
}

View file

@ -269,7 +269,7 @@ cl_symbols[] = {
{"CADDDR", CL_ORDINARY, cl_cadddr, 1, OBJNULL},
{"CADDR", CL_ORDINARY, cl_caddr, 1, OBJNULL},
{"CADR", CL_ORDINARY, cl_cadr, 1, OBJNULL},
{"CALL-ARGUMENTS-LIMIT", CL_CONSTANT, NULL, -1, ecl_make_fixnum(CALL_ARGUMENTS_LIMIT)},
{"CALL-ARGUMENTS-LIMIT", CL_CONSTANT, NULL, -1, ecl_make_fixnum(ECL_CALL_ARGUMENTS__LIMITLIMIT)},
{"CAR", CL_ORDINARY, cl_car, 1, OBJNULL},
{"CASE", CL_FORM, NULL, -1, OBJNULL},
{"CATCH", CL_FORM, NULL, -1, OBJNULL},
@ -544,7 +544,7 @@ cl_symbols[] = {
{"LABELS", CL_FORM, NULL, -1, OBJNULL},
{"LAMBDA", CL_FORM, NULL, -1, OBJNULL},
{"LAMBDA-LIST-KEYWORDS", CL_CONSTANT, NULL, -1, OBJNULL},
{"LAMBDA-PARAMETERS-LIMIT", CL_CONSTANT, NULL, -1, ecl_make_fixnum(LAMBDA_PARAMETERS_LIMIT)},
{"LAMBDA-PARAMETERS-LIMIT", CL_CONSTANT, NULL, -1, ecl_make_fixnum(ECL_LAMBDA_PARAMETERS_LIMIT_LIMIT)},
{"LAST", CL_ORDINARY, cl_last, -1, OBJNULL},
{"LCM", CL_ORDINARY, cl_lcm, -1, OBJNULL},
{"LDB", CL_ORDINARY, ECL_NAME(cl_ldb), 2, OBJNULL},
@ -1146,7 +1146,7 @@ cl_symbols[] = {
{SYS_ "BDS-VAL", SI_ORDINARY, si_bds_val, 1, OBJNULL},
{SYS_ "BDS-VAR", SI_ORDINARY, si_bds_var, 1, OBJNULL},
{SYS_ "BIT-ARRAY-OP", SI_ORDINARY, si_bit_array_op, 4, OBJNULL},
{SYS_ "C-ARGUMENTS-LIMIT", SI_CONSTANT, NULL, -1, ecl_make_fixnum(C_ARGUMENTS_LIMIT)},
{SYS_ "C-ARGUMENTS-LIMIT", SI_CONSTANT, NULL, -1, ecl_make_fixnum(ECL_C_ARGUMENTS_LIMIT_LIMIT)},
{SYS_ "CHAR-SET", SI_ORDINARY, si_char_set, 3, OBJNULL},
{EXT_ "CHDIR", EXT_ORDINARY, si_chdir, -1, OBJNULL},
{SYS_ "CLEAR-COMPILER-PROPERTIES", SI_ORDINARY, cl_identity, 1, OBJNULL},

View file

@ -187,16 +187,16 @@ typedef unsigned char ecl_base_char;
* In general, any of these limits must fit in a "signed int".
*/
/* Maximum number of function arguments (arbitrary) */
#define CALL_ARGUMENTS_LIMIT 65536
#define ECL_CALL_ARGUMENTS__LIMITLIMIT 65536
/* Maximum number of required arguments */
#define LAMBDA_PARAMETERS_LIMIT CALL_ARGUMENTS_LIMIT
#define ECL_LAMBDA_PARAMETERS_LIMIT_LIMIT ECL_CALL_ARGUMENTS__LIMITLIMIT
/* Numb. of args. which will be passed using the C stack */
/* See cmplam.lsp if you change this value */
#define C_ARGUMENTS_LIMIT 63
#define ECL_C_ARGUMENTS_LIMIT_LIMIT 63
/* Maximum number of output arguments (>= C_ARGUMENTS_LIMIT) */
/* Maximum number of output arguments (>= ECL_C_ARGUMENTS_LIMIT_LIMIT) */
#define ECL_MULTIPLE_VALUES_LIMIT 64
/* A setjmp that does not save signals */
@ -205,7 +205,7 @@ typedef unsigned char ecl_base_char;
/*
* Structure/Instance limits. The index to a slot must fit in the
* "int" type. We also require ECL_SLOTS_LIMIT <= CALL_ARGUMENTS_LIMIT
* "int" type. We also require ECL_SLOTS_LIMIT <= ECL_CALL_ARGUMENTS__LIMITLIMIT
* because constructors typically require as many arguments as slots,
* or more.
*/

View file

@ -183,7 +183,7 @@ extern void _ecl_unexpected_return() ecl_attr_noreturn;
frame->frame.stack = 0; \
frame->frame.env = env; \
frame->frame.size = narg; \
if (narg < C_ARGUMENTS_LIMIT) { \
if (narg < ECL_C_ARGUMENTS_LIMIT_LIMIT) { \
va_list args; \
va_start(args, lastarg); \
frame->frame.base = (void*)args; \
@ -200,7 +200,7 @@ extern void _ecl_unexpected_return() ecl_attr_noreturn;
frame->frame.t = t_frame; \
frame->frame.env = env; \
frame->frame.size = narg; \
if (narg < C_ARGUMENTS_LIMIT) { \
if (narg < ECL_C_ARGUMENTS_LIMIT_LIMIT) { \
cl_object *p = frame->frame.base = env->values; \
va_list args; \
va_start(args, lastarg); \

View file

@ -126,3 +126,7 @@
#define ADIMLIM ECL_ARRAY_DIMENSION_LIMIT
#define ATOTLIM ECL_ARRAY_TOTAL_LIMIT
#define ARANKLIM ECL_ARRAY_RANK_LIMIT
#define CALL_ARGUMENTS_LIMIT ECL_CALL_ARGUMENTS_LIMIT
#define LAMBDA_PARAMETERS_LIMIT ECL_LAMBDA_PARAMETERS_LIMIT
#define C_ARGUMENTS_LIMIT ECL_C_ARGUMENTS_LIMIT

View file

@ -245,7 +245,7 @@ extern ECL_API ecl_frame_ptr _ecl_frs_push(register cl_env_ptr, register cl_obje
*******************
* Here we define how we handle the incoming arguments for a
* function. Our calling conventions specify that at most
* C_ARGUMENTS_LIMIT ar pushed onto the C stack. If the function
* ECL_C_ARGUMENTS_LIMIT_LIMIT ar pushed onto the C stack. If the function
* receives more than this number of arguments it will keep a copy of
* _all_ those arguments _plus_ the remaining ones in the lisp
* stack. The caller is responsible for storing and removing such
@ -267,7 +267,7 @@ extern ECL_API ecl_frame_ptr _ecl_frs_push(register cl_env_ptr, register cl_obje
#define cl_va_start(a,p,n,k) { \
a[0].narg = (n)-(k); \
va_start(a[0].args,p); \
a[0].sp = ((n) <= C_ARGUMENTS_LIMIT)? 0 : _ecl_va_sp(a[0].narg); }
a[0].sp = ((n) <= ECL_C_ARGUMENTS_LIMIT_LIMIT)? 0 : _ecl_va_sp(a[0].narg); }
#define cl_va_arg(a) \
(a[0].narg--,(a[0].sp? *(a[0].sp++) : va_arg(a[0].args,cl_object)))
#define cl_va_copy(dest,orig) { \

View file

@ -249,6 +249,7 @@
"h/bytecodes.h"
"h/cache.h"
"h/config.h.in"
"../msvc/ecl/config.h.msvc6"
"h/cons.h"
"h/cs.h"
"h/ecl-cmp.h"