Comments (7)
Finally! We no longer need to allocate a huge heap upon startup; both the nursery and the object pool can grow on demand, and the scheduler gracefully handles HeapOverflow
ret code. I'd say we're also not far from a real gc, but leaving that to a future issue.
from asterius.
Preliminary progress on 1:
- Pulled quite some weeds in the runtime (removing ~500 loc) without breaking a single test.
- We're gradually getting rid of a lot of internal data structure/interfaces of ghc's original runtime (e.g.
Task
/InCall
s, run queues inCapability
, etc). We're fine as long as we don't break the absolute essential interfaces used in ghc's emitted cmm code and rts cmm code (e.g.allocate*
functions,StgTSO
structs, etc)
from asterius.
As a result of implementing #44, almost all RTS APIs have different type signatures from the original versions:
- Except
allocate
/createThread
, RTS APIs no longer take aCapability
as a parameter - The
rts_eval*
functions used to return nothing; now they return ani32
thread id - The
rts_getSchedStatus
/rts_checkSchedStatus
functions now take thread id as a parameter; they no longer inspect a global data structure reused by the scheduler; they only inspect a thread-local storage. This is critical to prevent thread state leakage (a likely cause for scheduler-related bugs in todomvc)
Before next merge to master
, we should also update the docs on rts api, along with the second blog post.
from asterius.
For a more uniform styled RTS API, we should avoid passing Capability
in allocate
and createThread*
as well. However, quite a few rts cmm files call those functions. What should we do?
- Patch rts cmm files to avoid passing extra parameter
- Implement a hack in the codegen so when encountering such an unsafe ccall, simply wipe the first parameter
- Implement a layer of wrapper in
Asterius.Builtins
so the exported interfaces in js don't pass it, but the internal functions do
I'll try the last approach first
from asterius.
Simplified runtime & RTS API is merged to master
via 497a7e5. Rest of today's work:
- Handle
stg_gc*
/stg_raisezh
runtime primitives, so when a gc occurs or a Haskell exception is thrown, it's possible to get detailed error information, instead of aThreadKilled
status code with no attached context.
from asterius.
Handling stack overflow requires dealing with chunked stacks and underflow frames, adding extra difficulty for this issue. We'll just allocate a large stack upon createThread
, panic on stack overflow (and hope it doesn't). Heap overflow is simpler to deal with.
from asterius.
It's been a long time. We have gc and exceptions now.
from asterius.
Related Issues (20)
- Source code for demos HOT 3
- Asterius-compiled code is very slow
- Support for wasm2c
- Crash by "table index is out of bounds"
- confusing Uncaught (in promise) JSException
- Official bindists?
- ahc --help
- Haskell + C++ project? HOT 1
- Information about upgrading GHC and libraries
- Docs outdated? HOT 1
- JavaScript heap out of memory
- support upload 'docx' file and output 'html' string in the asterius pandoc online demo
- Fixes for the FFI blog post
- support the cabal condition "impl(ahc-ghc)"
- --export-function doesn't work with ahc-dist HOT 2
- Stack installation files missing, Docker image is huge and unwieldy to use HOT 1
- Order of --output-directory flag matters
- Building error on multi-packages cabal project. HOT 1
- How to trace the "unreachable" runtime error back to Haskell modules or functions?
- Runtime error related with GC options `--gc-threshold` HOT 1
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 asterius.