If a reference argument is not read within the function, the compiler does not trigger an unused symbol warning.
This commit modifies the compiler to trigger warnings in such cases.
Notes:
I spent some time checking through every reference that was made to the `uREAD` flag in the entire codebase. As far as I could see, there would be no side-effects of this commit.
Using 2^23 allocates 128MB memory for the hash table. Seems like
a waste of memory, especially for small scripts.
For example, I didn't notice a huge difference in time between 1000
and the old number when compiling most of YSI includes and tests.
Hash tables double in size when they need more space, it's pretty
efficient (at least this implementation does so).
In `initarray`, `prev1` and `prev2` are dangling pointers. When assigned, they point to an address of an item in the literal queue. The compiler checks the literal queue size before adding an element. If the size isn't sufficient to hold another element, it reallocates the literal queue to accommodate more items. When the reallocation happens, the previous references (`prev1` and `prev2`) to the elements of the literal queue are invalidated. De-referencing the broken pointers will cause undefined behavior.
This commit replaces the pointers with indexes. The indexes are invariant to the reallocation.
Now it should be possible to do this:
const SOME_VAL = 1;
emit const.pri -SOME_VAL
or this:
static some_array[] = { 0, 1, 2, 3, 4, 5 };
static some_var;
emit { const.pri some_var };
new some_var_offset = emit { add.c -some_array };
Example:
main()
{
new x;
emit load.pri x
}
Before this commit:
error 017: undefined symbol "x"
After:
error 001: expected token: "-data offset-", but found "-local variable-"
This changes the way 'switch', 'casetbl' and 'case' are handled; now 'casetbl' can't be used directly and the arguments for the first case table entry (the number of entries and 'default' label) are specified to 'switch'.
Example:
emit
{
load.s.pri my_var
switch 3 lbl_deafult
case 0 lbl_0
case 2 lbl_2
case 4 lbl_4
}