Skip to content

Commit 6aaf8ea

Browse files
committed
Commit some fixes
1 parent 13246ad commit 6aaf8ea

3 files changed

Lines changed: 23 additions & 1 deletion

File tree

codegen/metac_codegen.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1017,6 +1017,7 @@ static void MetaCCodegen_doArrowExpr(metac_bytecode_ctx_t* ctx,
10171017
BCValue addr;
10181018
BCValue e1Value = {BCValueType_Unknown};
10191019
BCValue offsetVal = {BCValueType_Unknown};
1020+
bool isExternal = false;
10201021

10211022
assert(idxKind == type_index_ptr);
10221023
assert(exp->Kind == expr_arrow || exp->Kind == expr_dot);
@@ -1028,7 +1029,10 @@ static void MetaCCodegen_doArrowExpr(metac_bytecode_ctx_t* ctx,
10281029
addrType = type_;
10291030
}
10301031

1032+
10311033
MetaCCodegen_doExpr(ctx, e1, &e1Value, _Rvalue);
1034+
isExternal = (e1Value.vType == BCValueType_External);
1035+
10321036
addr = gen.GenTemporary(c, addrType);
10331037

10341038
if (e1Value.vType == BCValueType_External)

libinterpret/bc_interpreter_backend.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1386,7 +1386,7 @@ BCValue BCGen_interpret(BCGen* self, uint32_t fnIdx, BCValue* args, uint32_t n_a
13861386

13871387
case LongInst_ImmUlt:
13881388
{
1389-
cond = (((int64_t)(*opRef)) < cast(uint32_t)hi);
1389+
cond = (((uint64_t)(*opRef)) < cast(uint32_t)hi);
13901390
}
13911391
break;
13921392
case LongInst_ImmUgt:

parser/metac_identifier_table.c

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,13 @@ void IdentifierTable_Free(metac_identifier_table_t* table)
6060
static const metac_identifier_table_t zeroTable = {0};
6161
(*table) = zeroTable;
6262
}
63+
64+
bool MetaCIdentifierTable_Grow(metac_identifier_table_t* self, uint32_t nSlots)
65+
{
66+
uint32_t log2Slots = LOG2(nSlots);
67+
uint32_t slots2Allocate = (1 << log2Slots);
68+
}
69+
6370
#define ALIGN4(N) (((N) + 3) & ~3)
6471
metac_identifier_ptr_t GetOrAddIdentifier(metac_identifier_table_t* table,
6572
uint32_t identifierKey,
@@ -74,6 +81,10 @@ metac_identifier_ptr_t GetOrAddIdentifier(metac_identifier_table_t* table,
7481
const uint32_t initialSlotIndex = (identifierKey & slotIndexMask);
7582
// TracyCPlot("TargetIndex", initialSlotIndex);
7683
uint32_t displacement = 0;
84+
if (table->SlotsUsed > (slotIndexMask - (1 << (table->SlotCount_Log2 -1))) )
85+
{
86+
// we should grow the table here.
87+
}
7788
for(
7889
uint32_t slotIndex = initialSlotIndex;
7990
(++slotIndex & slotIndexMask) != initialSlotIndex;
@@ -328,6 +339,13 @@ bool IsInTable(metac_identifier_table_t* table,
328339
return IdentifierTableLookup(table, key, value) != 0;
329340
}
330341

342+
static inline float MetaCIdentifierTable_LoadFactor(
343+
metac_identifier_table_t* self)
344+
{
345+
uint32_t slotCount = ((1 << self->SlotCount_Log2) - 1);
346+
return ((float)self->SlotsUsed / (float)slotCount);
347+
}
348+
331349
#ifdef WRITE_TABLE
332350
#define CRT_SECURE_NO_WARNINGS
333351
metac_identifier_table_t ReadTable(const char* filename)

0 commit comments

Comments
 (0)