edit lexer atoms
This commit is contained in:
2
Makefile
2
Makefile
@@ -58,7 +58,7 @@ static:
|
||||
# Bootstrap: build cell from scratch using meson (only needed once)
|
||||
# Also installs core scripts to ~/.cell/core
|
||||
bootstrap:
|
||||
meson setup build_bootstrap -Dbuildtype=debugoptimized
|
||||
meson setup build_bootstrap -Dbuildtype=debugoptimized -Db_sanitize=address
|
||||
meson compile -C build_bootstrap
|
||||
cp build_bootstrap/cell .
|
||||
cp build_bootstrap/libcell_runtime.dylib .
|
||||
|
||||
62
plan.md
62
plan.md
@@ -95,38 +95,40 @@ static JS_BOOL js_key_equal_str(JSValue a, const char *str);
|
||||
|
||||
### Remaining Work
|
||||
|
||||
#### 5.3 Update js_parse_property_name()
|
||||
- [ ] Change return type from JSAtom* to JSValue*
|
||||
- [ ] Update all callers (js_parse_object_literal, etc.)
|
||||
- [ ] This is a larger change affecting many functions
|
||||
#### 5.3 Update js_parse_property_name() ✓
|
||||
- [x] Change return type from JSAtom* to JSValue*
|
||||
- [x] Update all callers (js_parse_object_literal, etc.)
|
||||
- [x] Updated get_lvalue(), put_lvalue(), js_parse_destructuring_element()
|
||||
|
||||
#### 5.4 Replace remaining emit_atom() calls with emit_key()
|
||||
- [ ] Many emit_atom calls remain in bytecode generation
|
||||
- [ ] emit_atom is currently a wrapper that calls emit_key
|
||||
- [ ] Eventually remove emit_atom entirely
|
||||
#### 5.4 Replace remaining emit_atom() calls with emit_key() ✓
|
||||
- [x] Removed emit_atom wrapper function
|
||||
- [x] Changed last emit_atom(JS_ATOM_this) to emit_key(JS_KEY_this)
|
||||
|
||||
#### 5.5 Update Variable Opcode Format in quickjs-opcode.h
|
||||
- [ ] Change `atom` format opcodes to `key` format
|
||||
- [ ] Change `atom_u8` and `atom_u16` to `key_u8` and `key_u16`
|
||||
|
||||
#### 5.6 Update VM Opcode Handlers
|
||||
These read atoms from bytecode using get_u32(). Need to change to read cpool indices:
|
||||
- [ ] OP_check_var, OP_get_var_undef, OP_get_var
|
||||
- [ ] OP_put_var, OP_put_var_init, OP_put_var_strict
|
||||
- [ ] OP_set_name, OP_make_var_ref, OP_delete_var
|
||||
- [ ] OP_define_var, OP_define_func, OP_throw_error
|
||||
- [ ] OP_make_loc_ref, OP_make_arg_ref
|
||||
#### 5.6 Update VM Opcode Handlers ✓
|
||||
These now read cpool indices and look up JSValue:
|
||||
- [x] OP_check_var, OP_get_var_undef, OP_get_var
|
||||
- [x] OP_put_var, OP_put_var_init, OP_put_var_strict
|
||||
- [x] OP_set_name, OP_make_var_ref, OP_delete_var
|
||||
- [x] OP_define_var, OP_define_func, OP_throw_error
|
||||
- [x] OP_make_loc_ref, OP_make_arg_ref
|
||||
- [x] OP_define_method, OP_define_method_computed
|
||||
|
||||
#### 5.7 Update resolve_scope_var()
|
||||
- [ ] Currently reads var_name as atom from bytecode
|
||||
- [ ] Compares with JS_ATOM_* constants
|
||||
- [ ] Need to change to read cpool index and compare with JSValue
|
||||
#### 5.7 Update resolve_scope_var() ✓
|
||||
- [x] Changed signature to use JSValue var_name
|
||||
- [x] Updated all comparisons to use js_key_equal()/js_key_equal_str()
|
||||
- [x] Updated var_object_test() to use JSValue
|
||||
- [x] Updated optimize_scope_make_global_ref() to use JSValue
|
||||
- [x] Updated resolve_variables() callers to read from cpool
|
||||
|
||||
#### 5.8 Convert Remaining JS_ATOM_* Usages (~41 comparisons remain)
|
||||
Categories:
|
||||
- Bytecode reading (get_u32 reads atoms) - will change with opcode format
|
||||
- js_parse_property_name callers - need function update first
|
||||
- Stub atom functions - will be removed in Phase 7
|
||||
#### 5.8 Convert Remaining JS_ATOM_* Usages
|
||||
Categories remaining:
|
||||
- Some debug/print functions still use JSAtom
|
||||
- Some function signatures not yet converted
|
||||
- Will be addressed in Phase 7 cleanup
|
||||
|
||||
---
|
||||
|
||||
@@ -174,8 +176,8 @@ Categories:
|
||||
**Build: SUCCEEDS** with warnings (unused variables, labels)
|
||||
|
||||
**Statistics:**
|
||||
- JS_ATOM_* comparisons: ~41 remaining (down from 171+)
|
||||
- Most remaining are in bytecode reading code (will change with opcode format)
|
||||
- JS_ATOM_* usages: ~40 remaining (down from 171+)
|
||||
- Most remaining are stub functions and debug code
|
||||
|
||||
**What Works:**
|
||||
- Keyword detection via string comparison
|
||||
@@ -183,11 +185,13 @@ Categories:
|
||||
- Variable definition with JSValue names
|
||||
- Property access with JSValue keys
|
||||
- Closure variable tracking with JSValue names
|
||||
- VM opcode handlers read cpool indices and look up JSValue
|
||||
- resolve_scope_var() uses JSValue throughout
|
||||
- js_parse_property_name() returns JSValue
|
||||
|
||||
**Next Priority:**
|
||||
1. Update js_parse_property_name() to use JSValue
|
||||
2. Update VM opcode handlers to read from cpool
|
||||
3. Convert remaining bytecode-related JS_ATOM_* usages
|
||||
1. Update bytecode serialization (Phase 6)
|
||||
2. Final cleanup - remove JSAtom type completely (Phase 7)
|
||||
|
||||
---
|
||||
|
||||
|
||||
905
source/quickjs.c
905
source/quickjs.c
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user