Commit Graph
8 Commits
Author SHA1 Message Date
Michel Hermier abc32676bf fix: rename static write function to writeFn to avoid glibc 2.34 symbol conflict
The static function `write` in vm.c conflicts with the POSIX `write` system call
declaration in glibc >= 2.34, causing build failures. Renaming it to `writeFn`
resolves the collision while maintaining the same callback behavior.
2022-04-09 00:09:23 +00:00
Michel Hermier 93ccdb5ddc chore: remove blank lines and commented debug prints from wren_core.wren.inc 2018-07-25 09:58:50 +00:00
Michel Hermier 596f64685d refactor: extract inline fiber error check into dedicated wrenHasError function
Replace direct `!IS_NULL(fiber->error)` checks across vm and core files with calls to the new `wrenHasError()` inline function, improving code readability and centralizing the error detection logic.
2018-07-19 15:57:51 +00:00
Michel Hermier 1a394212e2 docs: add Michel Hermier to AUTHORS file 2018-07-19 16:04:15 +00:00
Michel Hermier 0f74a07c86 feat: add wrenStringEqualStrLength and wrenStringsEqual helpers for string comparison
Introduce two new inline functions in wren_value.h: wrenStringEqualStrLength
compares an ObjString against a raw C string with known length, while
wrenStringsEqual compares two ObjString instances using hash pre-check and
delegating to wrenStringEqualStrLength. Refactor wrenSymbolTableFind in
wren_utils.c and wrenValuesEqual in wren_value.c to use these new helpers,
replacing inline memcmp calls for improved code clarity and reuse.
2018-03-29 07:12:32 +00:00
Michel Hermier 4e53cda68d refactor: replace custom String struct with ObjString* in symbol table and method names
Unify string representation across the codebase by switching SymbolTable and method name storage from a manually-managed `String` struct (char* buffer + length) to `ObjString*` pointers. This eliminates duplicate string allocations in the meta API's `metaGetModuleVariables`, reduces memory management overhead by leveraging the existing GC for symbol strings, and adds `wrenBlackenSymbolTable` to properly trace these GC-roots during collection. The change touches the compiler, debug dumper, VM runtime error formatting, and module variable initialization to use `->value` and `->length` fields directly from `ObjString`.
2018-03-28 16:12:50 +00:00
Michel Hermier 44e0714458 refactor: move Obj* forward declarations to wren_common.h and unify struct naming
Consolidate all Obj* type forward declarations from wren_value.h into wren_common.h
to centralize type definitions and reduce header dependencies. Convert anonymous
typedef structs to named structs with sObj* tags for consistent naming convention
across all object types.
2018-03-28 15:51:34 +00:00
Michel Hermier 28b3234fa5 fix: correct opcode argument counts and field offset patching in wrenBindMethodCode
The getNumArguments function had CODE_IMPORT_MODULE incorrectly listed as a 1-argument
opcode and CODE_IMPORT_VARIABLE as a 2-argument opcode. This swap caused incorrect
bytecode parsing during method binding. Additionally, wrenBindMethodCode had two bugs:
the instruction fetch was incrementing ip before reading the opcode, and field offset
patching was using ip++ instead of ip+1, corrupting subsequent bytecode. The super
instruction handling also had an incorrect ip+=2 skip that removed the symbol offset
before reading the constant index.
2018-01-11 10:56:03 +00:00