Skip to content

Refactor ScriptManager #15

@VIPO777

Description

@VIPO777

Scope

Refactor ScriptManager to use proper names aligned with Racket semantics, replace ad-hoc containers with shared ones, and rename the global pointer.

Inputs / References


1) Structures — Explore & Normalize

Goal: Inventory and rename the main and related structures tied to ScriptManager, mapping to Racket terms. Keep offsets correct.

1.1 Identify Core Types

  • Dc (Racket Symbol): m_name, m_hash (StringId64), m_index, m_flags.
  • ScriptModule (Racket Module): name, resolved path, namespace, bindings, bytecode, exports, requires, state, flags.
  • ScriptNamespace (Racket Namespace): top-level defs, imports, exports.
  • ScriptValue (boxed value): opaque payload / tag.
  • ScriptManager: symbol table, module maps (by name/path), namespaces, loaded-list, config flags, search root.

1.2 Naming Rules

  • Use actual engine terms, only use placeholders for unknowns (m_field{:offset}).
  • Align conceptual names to Racket (module/symbol/namespace/export/require), but do not override proven engine names.

1.3 Deliverables

  • A Racket mapping table (engine term → Racket concept) to keep terminology consistent.

2) Functions — Audit & Rename

Goal: Catalog ScriptManager public/major functions and standardize names/arguments to reflect Racket semantics.

2.2 Naming/Args Conventions

  • Use argument names mirroring Racket.

2.3 Deliverables

  • A function matrix (name, purpose, key args, return).
  • Cross-references to the structures they read/write.

3) Containers — Replace Ad-Hoc with Shared

Goal: Replace the legacy bucket with FixedSizeHashTable<>; use ListArray<>/StaticArray<> where appropriate.

3.1 Replace Legacy

  • Remove the ad-hoc ModuleBucket (0x98) and migrate to: FixedSizeHashTable
  • Lists of exports/requires: ListArray<Dc>.

4) Global Pointer — Rename

Goal: Rename the global pointer to reflect its role.

  • g_scriptGlobalsg_ScriptManager.
  • it is not part of EngineComponents and is intentionally a global singleton pointer.
  • Update all references; (ABI/exports)

4.1 Deliverables

  • Rename diff summary (symbols touched, external visibility impact).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions