This commit is contained in:
2026-02-24 07:27:23 +02:00
parent c9e71b38bd
commit 04be10fbec

View File

@@ -261,8 +261,9 @@ static void semaBlockGrowInstructions(SemaBlock* block, uint32_t new_cap) {
= realloc(block->instructions, new_cap * sizeof(uint32_t));
} else {
uint32_t* heap = malloc(new_cap * sizeof(uint32_t));
memcpy(heap, block->inline_instructions,
block->instructions_len * sizeof(uint32_t));
if (heap)
memcpy(heap, block->inline_instructions,
block->instructions_len * sizeof(uint32_t));
block->instructions = heap;
block->instructions_on_heap = true;
}
@@ -470,7 +471,7 @@ static uint8_t analyzeBodyRuntimeBreak(
Sema* sema, SemaBlock* block, const uint32_t* body, uint32_t body_len);
static uint16_t floatBits(TypeIndex ty);
static void analyzeFuncBodyAndRecord(Sema* sema, SemaBlock* block,
uint32_t func_inst, uint32_t name_idx, AirInstRef* call_args,
uint32_t func_inst, uint32_t name_idx, const AirInstRef* call_args,
uint32_t call_args_len, TypeIndex* call_arg_types);
// getParamBody: extract param body from a param_block ZIR instruction.
@@ -4931,7 +4932,7 @@ static AirInstRef zirCall(
// Used for both exported functions (from zirFunc) and non-inline callees
// (from zirCall). name_idx is a string_bytes index for the function name.
static void analyzeFuncBodyAndRecord(Sema* sema, SemaBlock* block,
uint32_t func_inst, uint32_t name_idx, AirInstRef* call_args,
uint32_t func_inst, uint32_t name_idx, const AirInstRef* call_args,
uint32_t call_args_len, TypeIndex* call_arg_types) {
if (!sema->func_air_list)
return;
@@ -5199,7 +5200,6 @@ static void analyzeFuncBodyAndRecord(Sema* sema, SemaBlock* block,
char* func_name = NULL;
if (name_idx != 0) {
const char* name_ptr = (const char*)&sema->code.string_bytes[name_idx];
size_t name_len = strlen(name_ptr);
if (call_args) {
// Generic monomorphization: "root.{name}__anon_{func_inst}"
// Matches upstream naming from finishFuncInstance.
@@ -5211,6 +5211,7 @@ static void analyzeFuncBodyAndRecord(Sema* sema, SemaBlock* block,
snprintf(func_name, fqn_len + 1, "root.%s__anon_%u", name_ptr,
func_inst);
} else {
size_t name_len = strlen(name_ptr);
size_t fqn_len = 5 + name_len; // "root." + name
func_name = malloc(fqn_len + 1);
if (func_name) {
@@ -6385,7 +6386,7 @@ static uint8_t analyzeBodyRuntimeBreak(
// --- zirRetImplicit ---
// Ported from src/Sema.zig zirRetImplicit / analyzeRet.
static void zirRetImplicit(Sema* sema, SemaBlock* block, uint32_t inst) {
static void zirRetImplicit(const Sema* sema, SemaBlock* block, uint32_t inst) {
(void)inst;
AirInstRef operand = AIR_REF_FROM_IP(IP_INDEX_VOID_VALUE);
if (block->inlining) {