Zesstra | 7ea4a03 | 2019-11-26 20:11:40 +0100 | [diff] [blame] | 1 | This file contains a collection of non-configurable limits: |
| 2 | |
| 3 | Program properties |
| 4 | ================== |
| 5 | * maximum program length: 1 MB (1048575 Bytes) |
| 6 | This is defined by FUNSTART_MASK in exec.h, which is the maximum offset |
| 7 | (address) of a functions code within the program block (relativ to the |
| 8 | beginning). Changing it involves changing funflag_t and probably other |
| 9 | stuff. |
| 10 | |
| 11 | * maximum number of programs: 2^32-1 |
| 12 | The unique program ID number is a int32. It is incremented for each compiled |
| 13 | program. If it reaches zero (after wrapping to negative values) the |
| 14 | compiler or swapper calls renumber_programs(), which recycles numbers from |
| 15 | old programs. |
| 16 | (exec.h, prolang.y, swap.c, ...) |
| 17 | |
| 18 | * maximum number of functions in a program: 65534 |
| 19 | The lookup table for function indexes holding the offsets of the function in |
| 20 | the functions tables is unsigned short. |
| 21 | The types of function arguments are stored in program_s.argument_types, |
| 22 | which is index by the unsigned short programs_s.type_start. 65535 has a |
| 23 | special meaning. Some code relies that this is unsigned short. |
| 24 | (exec.h, ...) |
| 25 | program_s.num_function_names and num_functions are unsigned short as well. |
| 26 | |
| 27 | * maximum length of switch: 256k (262143 Bytes) |
| 28 | Limited by BREAK_ADDRESS_MASK and CONTINUE_ADDRESS_MASK? |
| 29 | |
| 30 | * maximum offset for branches: 32765 (0x7ffd) |
| 31 | (prolang.y) |
| 32 | |
| 33 | * number of virtual variables: 256 |
| 34 | * number of global variables: 65536 (F_IDENTIFIER16) |
| 35 | * number of local variables: 256 (F_PUSH_LOCAL_VARIABLE_LVALUE) |
| 36 | * number of context variables: 256 (Should be consistent with local |
| 37 | variables, MAX_LOCAL applies to both. 16 bit opcodes are not used yet.) |
| 38 | |
| 39 | * max number of struct members: 255 |
| 40 | (exec.h, ...) |
| 41 | |
| 42 | * max number of structs per program: usually 32767 (short) |
| 43 | |
| 44 | |
| 45 | Hash tables |
| 46 | =========== |
| 47 | * maximum size of the hash table for identifiers (ITABLE): 32768 |
| 48 | The hashes of identifiers are signed short which are in most cases 16 bit |
| 49 | wide integers (lex.h, lex.c, ...) |
| 50 | |
| 51 | * maximum size of the hash table for objects (OTABLE): 65536 |
| 52 | * maximum size of the hash table for shared strings (HTABLE): 65536 |
| 53 | The hashes are of type unsigned short which are in most cases 16 bit |
| 54 | wide integers. |
| 55 | |
| 56 | |
| 57 | Objects |
| 58 | ======= |
| 59 | * maximum clone ID number: 2^32-1 |
| 60 | Not a real limitation, after that the driver starts checking if |
| 61 | blueprint name + #cloneid are unique. |
| 62 | |
| 63 | |
| 64 | Memory management |
| 65 | ================= |
| 66 | * max. size of single large block in slaballo.c and smalloc.c: |
| 67 | 0x07ffffff (134217727, defined by M_MASK) |
| 68 | |
| 69 | |
| 70 | Language |
| 71 | ======== |
| 72 | * maximum number of simul-efuns: 2048 |
| 73 | Only values 0xf800-0xffff in .x.closure_type of |
| 74 | a T_CLOSURE svalue are reserved for simul-efuns. |
| 75 | F_SIMUL_EFUN however takes a short int, so there 65536 |
| 76 | simul-efuns would be possible. |
| 77 | |
| 78 | * maximum number of python efuns: 2048 |
| 79 | Only values 0xe800-0xefff in .x.closure_type of |
| 80 | a T_CLOSURE svalue are reserved for python efuns. |
| 81 | F_PYTHON_EFUN however takes a short int, so there 65536 |
| 82 | python efuns would be possible. |