TOPIC

limitations

DESCRIPTION

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: 255
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)
temporary text to keep this from stacking on below header

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)

Language

maximum number of simul-efuns: 2048
Only values 0xf800-0xffff in .x.closure_type of a T_CLOSURE svalue are reserved for simul-efuns. F_SIMUL_EFUN however takes a short int, so there 65536 simul-efuns would be possible.