expand symbol table (#1534)

* expand symbol table

* ah!

* fix minor errors

* fix kernel test

* fix another test
This commit is contained in:
ManDude
2022-06-24 23:27:00 +01:00
committed by GitHub
parent 628ce47b2e
commit 67c815bf18
6 changed files with 12 additions and 11 deletions
+5 -5
View File
@@ -13,10 +13,10 @@ constexpr int ARRAY_DATA_OFFSET = 12; // not including type tag
* Here you can change the size of the symbol table!
* Make sure to also edit the constant in gcommon.gc
*/
constexpr s32 GOAL_MAX_SYMBOLS = 8192; // this MUST be a multiple of 2!!
constexpr s32 SYM_INFO_OFFSET = 8167 * 8 - 4;
// constexpr s32 GOAL_MAX_SYMBOLS = 16384;
// constexpr s32 SYM_INFO_OFFSET = GOAL_MAX_SYMBOLS * 8 - 4;
// constexpr s32 GOAL_MAX_SYMBOLS = 8192; // this MUST be a multiple of 2!!
// constexpr s32 SYM_INFO_OFFSET = 8167 * 8 - 4;
constexpr s32 GOAL_MAX_SYMBOLS = 16384;
constexpr s32 SYM_INFO_OFFSET = GOAL_MAX_SYMBOLS * 8 - 4;
constexpr s32 SYM_TABLE_MEM_SIZE = GOAL_MAX_SYMBOLS * 8 * 2;
@@ -34,7 +34,7 @@ constexpr int bits_for_sym() {
}
return b + 1;
}
static_assert(bits_for_sym() != 1, "symbol table invalid length");
static_assert(bits_for_sym() != -1, "symbol table invalid length");
enum class RegClass { GPR_64, FLOAT, INT_128, VECTOR_FLOAT, INVALID };
+1 -1
View File
@@ -713,7 +713,7 @@ Ptr<Symbol> find_symbol_from_c(const char* name) {
auto bits = bits_for_sym() - 1;
s32 sh1 = hash << (0x20 - bits);
s32 sh2 = sh1 >> (0x20 - bits - 3);
// will be signed, bottom 3 bits 0 (for alignment, symbol are every 8 bytes)
// will be signed, bottom 3 bits 0 (for alignment, symbols are every 8 bytes)
// upper 16 bits are the same, so we will reach +/- 8 kb around 0.
if (sh2 > 0) {
+1 -1
View File
@@ -1396,7 +1396,7 @@
)
)
((= (-> s2-0 -1) symbol)
(set! s4-0 (-> (&+ s2-0 #xff38) 0))
(set! s4-0 (symbol->string (the-as symbol s2-0)))
(set! s3-0 (lookup-part-group-pointer-by-name (the-as string s4-0)))
(if s3-0
(set! (-> s5-1 0) s3-0)
+1 -1
View File
@@ -35,7 +35,7 @@
;; distance from a symbol pointer to a (pointer string)
;; this relies on the memory layout of the symbol table
;; this must match SYM_INFO_OFFSET in goal_constants.h + offset of the str field in struct SymUpper.
(defconstant SYM_TO_STRING_OFFSET #xff38)
(defconstant SYM_TO_STRING_OFFSET #x20000) ;; changed from #xff38
;; pointers larger than this are invalid by valid?
(defconstant END_OF_MEMORY #x8000000)
+2 -2
View File
@@ -103,9 +103,9 @@ TEST_F(VariableTests, StackStructureAlignment) {
TEST_F(VariableTests, GetSymbol) {
shared_compiler->runner.run_static_test(env, testCategory, "get-symbol-1.static.gc",
{"1342756\n"}); // 0x147d24 in hex
{"1375524\n"}); // 0x14fd24 in hex
shared_compiler->runner.run_static_test(env, testCategory, "get-symbol-2.static.gc",
{"1342764\n"}); // 0x147d2c in hex
{"1375532\n"}); // 0x14fd2c in hex
}
TEST_F(VariableTests, Constants) {
+2 -1
View File
@@ -304,7 +304,8 @@ void setup_hack_heaps(void* mem, int size) {
init_crc();
// create a fake symbol table
auto symbol_table = kmalloc(kglobalheap, 0x20000, KMALLOC_MEMSET, "symbol-table").cast<u32>();
auto symbol_table =
kmalloc(kglobalheap, SYM_TABLE_MEM_SIZE, KMALLOC_MEMSET, "symbol-table").cast<u32>();
s7 = symbol_table + (GOAL_MAX_SYMBOLS / 2) * 8 + BASIC_OFFSET;
SymbolTable2 = symbol_table + BASIC_OFFSET;
LastSymbol = symbol_table + 0xff00;