by

Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Activity
    Richard Szibele
    @rszibele
    I'm now hitting the following error in the GC:
    error_1.png
    res_c is a really large number and the issue can be solved by changing offset to BigInt(offset), but I do not know if res_c should be such a large number.
    I assume it should be a large number due to 64bit address space, but I'll take a look at it tomorrow in detail.
    Shao Cheng
    @TerrorJack
    @rszibele Yes, it's reasonable for it to be a big number because of the 64-bit virtual address space
    Thanks for finding the bug. Mind filing a PR for it? :)
    Richard Szibele
    @rszibele
    Richard Szibele
    @rszibele
    I'm getting a differentRuntimeError now which is being thrown here: https://github.com/tweag/asterius/blob/master/asterius/rts/rts.gc.mjs#L882 because the switch statement doesn't handle indirection with the case ClosureTypes.IND.
    I'm not sure what is supposed to happen there. If I set a breakpoint and check the value of this.memory.i64Load(c + rtsConstants.offset_StgInd_indirectee)then it's 0n.
    Shao Cheng
    @TerrorJack
    @rszibele Can you give the wip-develop branch a try? On that branch I reversed a recent relevant patch. Does the same problem occur?
    Richard Szibele
    @rszibele
    @TerrorJack the wip-develop branch works :)
    Shao Cheng
    @TerrorJack
    @rszibele great to hear! btw is your project a public repo somewhere? i'd like to get a local repro and see if it can be fixed on the master branch as well
    Richard Szibele
    @rszibele
    @TerrorJack It isn't open source, but I will try to make a minimal example that reproduces the issue.
    Richard Szibele
    @rszibele
    So I did some profiling and it seems to me that the performance of Asterius is really good and it would be able to handle my game. The only thing that seems to be causing issues currently is the garbage collector.
    The gc spikes are noticeable and they are around 100-300ms, but it also seems like the gc times increase linearly over time.
    image.png
    x is total time and y is time taken for garbage collection.
    Richard Szibele
    @rszibele
    I assumed I had a space leak in my code somewhere but according to ghc's profiling tools I shouldn't have any noticeable space leaks:
    image.png
    I forgot to mention, but in the first graph the different colored points are for the gc threshold option. I also didn't run them for the same amount of time.
    Richard Szibele
    @rszibele
    I also left the game idle when recording that data.
    Shao Cheng
    @TerrorJack
    Thanks a lot for doing all the profiling and providing the graph above!

    gc times increase linearly over time

    It's somewhat expected behavior, since we don't do generational gc yet and is based on a naive copying gc implementation for now, so gc time (when it actually happens) is dependent on heap resident data size

    And we have a few loose ends to tighten up yet in the storage manager, e.g. we haven't done proper Weak support yet, so if they're used, the finalizers are never run and Weak refs are actually strong refs yet.
    Improving the gc situation is among our top priorities btw
    Emily
    @emiflake

    Hiya friends, I've been taking a look at Asterius and am really amazed by how well everything already works! I'm currently trying to attach event listeners, but am running into some trouble:

    foreign import javascript "(${1}).addEventListener(${2}, ${3})" ffi_addEventListener :: JSVal -> JSString -> JSFunction -> IO ()

    This is my foreign import, and this is the wrapper I make around it:

    addEventListener :: DOMNode -> String -> (JSVal -> IO ()) -> IO ()
    addEventListener node eventName _callback = do
      -- Temporary, just trying to get *something* out of Haskell
      cb <- makeHaskellCallback (putStrLn "Got callback")
      ffi_addEventListener (coerce node) (toJSString eventName) cb

    Unfortunately, I never end up getting anything back...
    Whenever I change the ffi import to

    foreign import javascript "(${1}).addEventListener(${2}, () => { console.log((${3})()) } )" ffi_addEventListener :: JSVal -> JSString -> JSFunction -> IO ()

    I do in fact get a console message, but it's a Promise that has already resolved by then. Does this have something to do with laziness?

    Emily
    @emiflake
    It seems that GHC can’t figure out what to be lazy on when it comes to callback functions, modifyIORef', for example, works
    Shao Cheng
    @TerrorJack
    @emiflake Hi, thanks for reaching out. I tried locally, and if you don't use putStrLn and instead import console.log as a Haskell function and make it a callback, it'll work.
    This is not related to laziness, our implementation of "standard output and error" in the browser is buggy, after the main thread exits, later writes to stdout/stderr buffers won't be affected to the actual browser console..
    We'll fix this problem and make the stdout/stderr buffer writes go to the actual console as soon as a line delimiter is detected in the buffer.
    Emily
    @emiflake
    Ah, thank you for your answer! This is exactly what I was able to reproduce as well earlier. Interesting. How active is development on Asterius still? I am currently playing around with a small library for web apps and it’s working really well, is the project still taking contributions?
    Shao Cheng
    @TerrorJack
    It's still active, I'm working full time on it and would be glad to take contributions!
    Emily
    @emiflake
    I've been trying to compile Asterius from source on Nix, but I have had no success. Any tips on how to get it done? (I'm a nix newbie, but wanting to learn.) Ideally I would add the derivation if I succeed with creating it.
    Shao Cheng
    @TerrorJack
    I know little nix myself so hard to tell how much remaining work it takes to full nix support.
    Emily
    @emiflake
    Ah, thank you! I'll keep on smashing my head against it until it compiles, maybe. Maybe that link will help.
    santhiya-v
    @santhiya-v
    Anyone have any suggestions for how to patch the packages for those that are dependent on integer-gmp to make it run in austerius? More details : tweag/asterius#610
    Mike Solomon
    @mikesol
    @TerrorJack is there a form of ghci for ahc (ie ahci)? I'd love to use
    something like rapid to prototype web projects in an ahci so that the process went faster. Thanks!
    Jack Armitage
    @jarmitage
    Hey, greetings from the tidalcycles.org community! We noticed that you list tidal as a package that compiles with asterius tweag/asterius#354
    Has anyone here tried to run/use tidal?
    We would be very excited to know
    Jack Armitage
    @jarmitage
    Trying to do ahc-cabal install tidal but Cabal-3.2.0.0 and hsc2hs both fail to install, the latter with openBinaryFile: does not exist (related? https://gitlab.haskell.org/ghc/ghc/issues/15758)
    Cabal-3.2.0.0with
    cabal: Failed to build Cabal-3.2.0.0. The build process was killed (i.e.
    SIGKILL). The typical reason for this is that there is not enough memory
    available (e.g. the OS killed a process using lots of memory).
    Any ideas?
    Also the readme says "The image also ships ~2k prebuilt packages from a recent Stackage snapshot for convenience of testing simple programs without needing to set up a Cabal project.", but when I did import Sound.Tidal.Context it was not found. So maybe I'm confused about what the readme means
    Jack Armitage
    @jarmitage
    @TerrorJack i would also be interested to know the deal with ghci / ahci!
    Cristhian Motoche
    @CristhianMotoche

    Hello! I usedahc-cabal to create a simple hello-world app (ahc-cabal init -p helloworld). After adding base to the build-depends, I build the project: ahc-cabal new-build && ahc-cabal new-install --installdir .. It worked but when I tried to use ahc-dist to generate the wasm file and the js files I got this error:

    root@5ec2d300a3d2:/workspace/hello# ahc-dist --input-exe helloworld
    ahc-dist: Out of memory

    I used the image with tag 200707 and I used podman.
    Please, let me know if I'm missing any step or if I'm doing something wrong.