This file contains a collection of non-configurable limits: Program properties ================== * maximum program length: 1 MB (1048575 Bytes) This is defined by FUNSTART_MASK in exec.h, which is the maximum offset (address) of a functions code within the program block (relativ to the beginning). Changing it involves changing funflag_t and probably other stuff. * maximum number of programs: 2^32-1 The unique program ID number is a int32. It is incremented for each compiled program. If it reaches zero (after wrapping to negative values) the compiler or swapper calls renumber_programs(), which recycles numbers from old programs. (exec.h, prolang.y, swap.c, ...) * maximum number of functions in a program: 65534 The lookup table for function indexes holding the offsets of the function in the functions tables is unsigned short. The types of function arguments are stored in program_s.argument_types, which is index by the unsigned short programs_s.type_start. 65535 has a special meaning. Some code relies that this is unsigned short. (exec.h, ...) program_s.num_function_names and num_functions are unsigned short as well. * maximum length of switch: 256k (262143 Bytes) Limited by BREAK_ADDRESS_MASK and CONTINUE_ADDRESS_MASK? * maximum offset for branches: 32765 (0x7ffd) (prolang.y) * number of virtual variables: 256 * number of global variables: 65536 (F_IDENTIFIER16) * number of local variables: 256 (F_PUSH_LOCAL_VARIABLE_LVALUE) * number of context variables: 256 (Should be consistent with local variables, MAX_LOCAL applies to both. 16 bit opcodes are not used yet.) * max number of struct members: 255 (exec.h, ...) * max number of structs per program: usually 32767 (short) Hash tables =========== * maximum size of the hash table for identifiers (ITABLE): 32768 The hashes of identifiers are signed short which are in most cases 16 bit wide integers (lex.h, lex.c, ...) * maximum size of the hash table for objects (OTABLE): 65536 * maximum size of the hash table for shared strings (HTABLE): 65536 The hashes are of type unsigned short which are in most cases 16 bit wide integers. Objects ======= * maximum clone ID number: 2^32-1 Not a real limitation, after that the driver starts checking if blueprint name + #cloneid are unique. Memory management ================= * max. size of single large block in slaballo.c and smalloc.c: 0x07ffffff (134217727, defined by M_MASK) Ref-counted entities ==================== * Reference counters for entities with ref-counters (arrays, objects, mappings, structs, closures etc.) overflow at 4294967295 users pointing to them (268435455 for strings). When this happens, these entities could be erroneously free'd. Language ======== * maximum number of simul-efuns: unlimited But only 65534 simul-efuns are managed in a table. Simul-efuns with an index above 65533 have therefore some restrictions: - Lookups will be done by name at runtime (these calls are slower). - If the simul-efun vanishes, there will be no lookups in any other simul-efun object (either backup simul-efun or primary simul-efun with a different object name). For closures to simul-efuns the limit is 2048 (only values 0xf800-0xffff in .x.closure_type of a T_CLOSURE svalue are reserved for simul-efuns). Closures to efuns with a higher index will be created as lfun closures and have the following drawbacks: - There will be a lookup by name at runtime when creating the closure. - The closure only lives as long as the simul-efun object. When the simul-efun is reloaded, the closure will be destroyed. - The closure cannot be saved with save_object() or save_value(). * maximum number of python efuns: 2048 Only values 0xe800-0xefff in .x.closure_type of a T_CLOSURE svalue are reserved for python efuns. F_PYTHON_EFUN however takes a short int, so there 65536 python efuns would be possible.