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`.
This commit is contained in:
Michel Hermier
2018-03-28 16:12:50 +00:00
parent 44e0714458
commit 4e53cda68d
7 changed files with 43 additions and 41 deletions
+1 -3
View File
@@ -52,9 +52,7 @@ void metaGetModuleVariables(WrenVM* vm) {
for (int i = 0; i < names->elements.count; i++)
{
String* name = &module->variableNames.data[i];
names->elements.data[i] = wrenNewStringLength(vm,
name->buffer, name->length);
names->elements.data[i] = OBJ_VAL(module->variableNames.data[i]);
}
}