ac73aaf59e24bb414fe7520c16a6f5f87d6d34ac
Introduce global inlining by allowing the Optimizer to access the environment's global values. This enables replacing global variable accesses with their constant values when appropriate. Additionally, implement Dead Code Elimination (DCE) for global definitions. A global definition can be removed if it was only used for inlining within the current script and has no side effects. Update the Optimizer struct to hold an optional reference to the global values and modify the `Optimizer::new` constructor to accept this. The `Environment::specialize` and `Environment::compile_script` methods are updated to pass the global values to the optimizer. The `SubstitutionMap` is also updated to track script-local global substitutions and used global indices, supporting both global inlining and global DCE.
Description
No description provided
Languages
Rust
100%