feat: add wasm build targets, profile hooks, os_demo example, and restructure manual source

- Add `wasm`, `wasm-clean`, and `install-emscripten` phony targets to Makefile for WebAssembly cross-compilation
- Insert `WREN_PROFILE_ENTER`/`WREN_PROFILE_EXIT` macros in `wren_vm.h` and `wren_vm.c` to support optional runtime profiling via `WREN_PROFILE_ENABLED`
- Create `example/os_demo.wren` demonstrating Platform, Process, and conditional exit usage
- Update `example/regex_demo.wren` to import `Match` and exercise Match object properties, groups, and `matchAll`
- Remove static HTML manual pages (`base64.html`, `dns.html`, `json.html`) and replace with structured `manual_src/` directory containing Jinja2 templates, YAML metadata, and content pages
- Expand `README.md` with build targets table, manual building instructions, source layout, and guide for adding new module documentation
This commit is contained in:
2026-01-26 04:12:14 +00:00
parent 79ff93c9a2
commit 04e467e09b
143 changed files with 13333 additions and 15112 deletions
+1
View File
@@ -1215,6 +1215,7 @@ static WrenInterpretResult runInterpreter(WrenVM* vm, register ObjFiber* fiber)
CASE_CODE(RETURN):
{
Value result = POP();
WREN_PROFILE_EXIT(fiber);
fiber->numFrames--;
// Close any upvalues still in scope.
+17
View File
@@ -6,6 +6,22 @@
#include "wren_value.h"
#include "wren_utils.h"
#ifdef WREN_PROFILE_ENABLED
struct ProfileEntry;
struct ProfileFrame;
struct ProfileState;
extern struct ProfileState* g_profile;
void wrenProfileEnter(WrenVM* vm, ObjFiber* fiber, ObjClosure* closure);
void wrenProfileExit(ObjFiber* fiber);
#define WREN_PROFILE_ENTER(vm, fiber, closure) \
do { if (g_profile) wrenProfileEnter(vm, fiber, closure); } while(0)
#define WREN_PROFILE_EXIT(fiber) \
do { if (g_profile) wrenProfileExit(fiber); } while(0)
#else
#define WREN_PROFILE_ENTER(vm, fiber, closure) ((void)0)
#define WREN_PROFILE_EXIT(fiber) ((void)0)
#endif
// The maximum number of temporary objects that can be made visible to the GC
// at one time.
#define WREN_MAX_TEMP_ROOTS 8
@@ -193,6 +209,7 @@ static inline void wrenCallFunction(WrenVM* vm, ObjFiber* fiber,
wrenEnsureStack(vm, fiber, needed);
wrenAppendCallFrame(vm, fiber, closure, fiber->stackTop - numArgs);
WREN_PROFILE_ENTER(vm, fiber, closure);
}
// Marks [obj] as a GC root so that it doesn't get collected.