Comments (3)
I think a ref-counted GC is okay for a first implementation, but the lack of cycle detection is going to bite hard later, so you'll need to switch to a tracing GC (or similar) eventually.
If it stored a shadow stack in the linear memory, it would be possible to access the GC stack roots by using the shadow stack (this technique is already used in other languages compiled to wasm, like C, C++, and Rust).
from grain.
Note: for this to really be useful, we're going to need to essentially implement malloc
on top of the WASM linear memory space.
from grain.
Update on this: the gc
branch is now using an asm.js
implementation of K&R C's malloc()
for its memory allocation . Next on the to-do list is to implement a notion of GC-managed types in the runtime (so we can do the ref counts).
I'm brainstorming an API to try to make this extensible; the gc
branch has a ManagedType
class checked in, but it's currently unused. Note that, if we opt to have some form of mallocTagged
function, this will have an impact on the codegen, but the exact effect is unclear.
from grain.
Related Issues (20)
- Grainfmt: Experiment with removal of infix_wrap argument HOT 1
- Grainfmt: Remove print_assigment
- Grainfmt: Experiment with print_comment_range refactor
- Grainfmt: Better API for concat_map
- Grainfmt: Support `formatter-ignore` in more places
- Grainfmt: Comment lost when preceding a number HOT 1
- Formatter: Pun aliases when possible
- Formatter: Missing trailing comma on inline record fields
- Stdlib: Add `String.map` and `String.flatMap` functions
- Formatter: disallow double-breaks on attributes
- Docs: Add variant docs to Json data structure
- Cleanup: Use graindoc `Markdown` lib in lsp
- Lsp: Provide context for `use XXX.*`
- stdlib: Add `input` function HOT 2
- language: look into overloading the `array[x]` syntax to support multiple number types.
- Rework: `toString` to use a buffer HOT 1
- Decrease initial memory pages to 1 HOT 3
- Implement LEB128 stdlib HOT 1
- stdlib: Add a `TOML` library
- stdlib/runtime: Implement a basic parsing library
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from grain.