dillon1000/react

Commit

[rust] Use Rc<RefCell<>> for shared identifiers

Multiple Place instances can share a reference to a given Identifier in our JS 
implementation. For simplicity of the initial port I’m using Rc (for sharing) 
and RefCell (for runtime-checked mutability). This is the standard pattern for 
shared mutable references in Rust when you don’t need multi-threaded support. We 
don’t need HIR to be accessible by multiple threads so this is fine, if we do 
multiple threads it will be to parallelize compilation of separate functions. 

There are other idioms w less runtime overhead, such as Place holding an index 
into a separate vec of identifiers, but that would make the port much less 
straightforward.
Browse files
Changed paths7 files
First-parent comparison
M compiler/forget/crates/build-hir/src/build.rs ModifiedM compiler/forget/crates/build-hir/src/builder.rs ModifiedM compiler/forget/crates/hir/src/environment.rs ModifiedM compiler/forget/crates/hir/src/id_types.rs ModifiedM compiler/forget/crates/hir/src/instruction.rs ModifiedM compiler/forget/crates/hir/src/terminal.rs ModifiedM compiler/forget/crates/hir/src/types.rs Modified
Patch

Files changed

Rendering syntax-highlighted changes…