Giter VIP home page Giter VIP logo

Comments (7)

TerrorJack avatar TerrorJack commented on August 23, 2024 1

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.

TerrorJack avatar TerrorJack commented on August 23, 2024

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/InCalls, run queues in Capability, 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.

TerrorJack avatar TerrorJack commented on August 23, 2024

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 a Capability as a parameter
  • The rts_eval* functions used to return nothing; now they return an i32 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.

TerrorJack avatar TerrorJack commented on August 23, 2024

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.

TerrorJack avatar TerrorJack commented on August 23, 2024

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 a ThreadKilled status code with no attached context.

from asterius.

TerrorJack avatar TerrorJack commented on August 23, 2024

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.

TerrorJack avatar TerrorJack commented on August 23, 2024

It's been a long time. We have gc and exceptions now.

from asterius.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.