Added cwasm_arena.c and cwasm_debug.c. Arena API hasn't been tested well yet. There's also something wrong with our DebugOutputLineBuffer usage for splitting lines to multiple Javascript output calls. Also added an int level to jsStdPrint and a bunch of macros to cwasm.h

This commit is contained in:
2025-08-31 17:33:48 -07:00
parent d0aa7a1d0e
commit cca61ea163
9 changed files with 566 additions and 11 deletions

View File

@@ -10,5 +10,105 @@
"build",
],
}
]
],
"settings":
{
"build_options":
[
],
"custom_constants":
[
"ArenaFlag_All",
"ArenaFlag_Count",
"ArenaFlag_Debug",
"ArenaFlag_DefaultAligned16",
"ArenaFlag_DefaultAligned4",
"ArenaFlag_DefaultAligned8",
"ArenaFlag_IsMainWasmMemory",
"ArenaFlag_IsScratch",
"ArenaFlag_None",
"CWASM_ASSERTIONS_ENABLED",
"CWASM_DEBUG",
"CWASM_DEBUG_OUTPUT_LINE_BUFFER_SIZE",
"CWASM_DEBUG_OUTPUT_PRINT_BUFFER_SIZE",
"CWASM_ENABLE_DBG_LEVEL_DEBUG",
"CWASM_ENABLE_DBG_LEVEL_DEBUG",
"CWASM_ENABLE_DBG_LEVEL_ERROR",
"CWASM_ENABLE_DBG_LEVEL_ERROR",
"CWASM_ENABLE_DBG_LEVEL_INFO",
"CWASM_ENABLE_DBG_LEVEL_INFO",
"CWASM_ENABLE_DBG_LEVEL_WARNING",
"CWASM_ENABLE_DBG_LEVEL_WARNING",
"DbgLevel_Count",
"DbgLevel_Debug",
"DbgLevel_Error",
"DbgLevel_Info",
"DbgLevel_None",
"DbgLevel_Warning",
"END_EXTERN_C",
"LANGUAGE_IS_C",
"LANGUAGE_IS_CPP",
"MAYBE_END_EXTERN_C",
"MAYBE_EXTERN_C",
"MAYBE_START_EXTERN_C",
"SCRATCH_ARENAS_SIZE",
"START_EXTERN_C",
"WASM_MEMORY_MAX_NUM_PAGES",
"WASM_MEMORY_MAX_SIZE",
"WASM_MEMORY_PAGE_SIZE",
"WASM_PROTECTED_SIZE",
"ZEROED",
],
"custom_functions":
[
"#define AlignOffset(pntr, alignment)",
"#define AllocArray(type, arenaPntr, count)",
"#define AllocStruct(type, arenaPntr)",
"#define ArrayCount(array)",
"#define Assert(condition)",
"#define IsAlignedTo(pntr, alignment)",
"#define PrintLine_D(formatStrNt, ...)",
"#define PrintLine_E(formatStrNt, ...)",
"#define PrintLine_I(formatStrNt, ...)",
"#define PrintLine_W(formatStrNt, ...)",
"#define Print_D(formatStrNt, ...)",
"#define Print_E(formatStrNt, ...)",
"#define Print_I(formatStrNt, ...)",
"#define Print_W(formatStrNt, ...)",
"#define ScratchBegin(scratchName)",
"#define ScratchBegin1(scratchName, conflictArenaPntr)",
"#define ScratchEnd(scratchName)",
"#define WASM_EXPORT(functionName)",
"#define WriteLine_D(messageNt)",
"#define WriteLine_E(messageNt)",
"#define WriteLine_I(messageNt)",
"#define WriteLine_W(messageNt)",
"#define Write_D(messageNt)",
"#define Write_E(messageNt)",
"#define Write_I(messageNt)",
"#define Write_W(messageNt)",
"Arena NewArena(void* basePntr, u32 size)",
"Arena* AllocArena(Arena* sourceArena, u32 newArenaFlags, u32 newArenaSize, u32 newArenaAlignment)",
"ArenaMark GetArenaMark(Arena* arena)",
"ArenaMark GetScratch()",
"ArenaMark GetScratch1(Arena* conflictArena)",
"inline void* ReallocMem(Arena* arena, void* oldPntr, u32 oldSize, u32 newSize)",
"inline void* ReallocMemUnaligned(Arena* arena, void* oldPntr, u32 oldSize, u32 newSize)",
"void InitGlobalArenas(u32 scratchArenasSize)",
"void ResetToArenaMark(ArenaMark arenaMark)",
"void ResetToMark(Arena* arena, u32 mark)",
"void* AllocMemUnaligned(Arena* arena, u32 numBytes)",
"void* ReallocMemAligned(Arena* arena, void* oldPntr, u32 oldSize, u32 newSize, u32 newAlignment)",
],
"custom_globals":
[
],
"custom_types":
[
"Arena",
"ArenaFlag",
"ArenaMark",
"DbgLevel",
],
},
}