Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Sep 20 01:01
    CI run 1251821551 passed
  • Sep 20 00:22

    gambiteer on master

    Remove obsolete comment. (compare)

  • Sep 19 19:46
    CI run 1251319275 passed
  • Sep 19 19:04

    gambiteer on master

    Simplify and document bignum mu… (compare)

  • Aug 24 05:49
    CI run 1161317361 passed
  • Aug 24 05:08

    feeley on master

    Improve hashing of uninterned s… (compare)

  • Aug 24 04:57
    MacOS build of CI run 1161242223 failed
  • Aug 24 04:32

    feeley on master

    Fix collision handling bug in _… (compare)

  • Aug 20 18:24
    CI run 1151566506 passed
  • Aug 20 17:43

    feeley on master

    Fix issue with macro body that … (compare)

  • Aug 14 19:38
    CI run 1131109944 passed
  • Aug 14 19:00

    gambiteer on master

    Allow Karatsuba multiplication … (compare)

  • Jul 31 20:18
    janus synchronize #715
  • Jul 30 20:49
    gambiteer reopened #659
  • Jul 30 20:49
    gambiteer commented #659
  • Jul 30 20:17
    CI run 1083377048 passed
  • Jul 30 19:39
    gambiteer commented on 47f2eb7
  • Jul 30 19:39

    gambiteer on master

    Revert "Fix reordering of claus… (compare)

  • Jul 30 19:27
    gambiteer commented on 47f2eb7
  • Jul 30 19:19
    Windows-msvc build of CI run failed
Drew Crampsie
@drewc
I'll have to make try myself then, which I wanted to do anyway, so there you go. Yay! :)
Jaime Fournier
@ober
Removing child 0x7fb5a11017e0 PID 1633 from chain.
make[1]: Leaving directory '/opt/gambit-src/lib'
make[1]: * [makefile:179: _io.c] Segmentation fault (core dumped)
still failing for me
Drew Crampsie
@drewc
make try failed for me at first but it's all my 'fault' for running NixOS, but when I got rid of the npx and the /user/local/ docs, it worked wonderfully.
Upon playing with it, I really started to enjoy the \globalThis.Object.create(null) syntax, so, before bed, it's true.
drewc @drewc does a happy dance
Marc Feeley
@feeley
@drewc Wonderful! 1 down 9999 to go…
if you have a more portable solution for the make try makefile rules please do a PR
Drew Crampsie
@drewc
So, how very right you are about the performance difference by using declarative Environment Recordsvs. object Environment Records for the runtime system. I'm very happy my opinions and beliefs are not my knowledge and are quite mutable, for \I.really(globalThis.appreciate) certain things my opinion was against and am in total disbelief about the performance difference.
Like, 500% difference.
Drew Crampsie
@drewc
Question: When can I / is it ever safe to use _host2scm_call?
drewc @drewc know nows how needed ##heartbeat! is. :)
Drew Crampsie
@drewc
Or, at least, to have the main thread running/sleeping or at least doing something in order to have other threads actually run as well. I have done so in the past but without any know-how of what I was actually doing and conceptually why it matters.
Marc Feeley
@feeley
all highly evolved living things need a heatbeat...
but for the JS backend I think the heartbeat is optional and only required if you want preemptive threads
Drew Crampsie
@drewc
I seem to remember there was a setTimeout() in VM.scm at one point, I'll have to lookup the git history and see if that was to solve what a running primordial now does :). Learning so very much about SpiderMonkey and V8.
To not think of everything as eventually being C and/or with POSIX and libc is a hard one.
Drew Crampsie
@drewc
I personally found that without "anything" running, where node will exit as the program is 'finished', but of course the browser and SPA are still up, the threads will of course not run and therefore though the scm2host "function" will the system is not where it wants to be when finished it.
And it's all my fault for not treating it as a process that I am operating but, rather, an operating system process.
Drew Crampsie
@drewc
And, of course, without anything "running" the async promise is always pending as the heartbeat needs to pump blood and run the async queue loop (which is brilliant, btw!). I mean, I cannot believe I thought that it would be running after exit .... that's totally nonsensical.
Marc Feeley
@feeley
yes you have to be careful with “primordial thread termination” because it can be a signal to the RTS that your program is “done”… one strategy (which is designed to work that way) is to not create a separate event handling thread but rather have the primordial thread run the event handling loop (after all initialisation is done)

so instead of having lib/_univlib.scm call (##start-callback-loop-thread) :

(define (##start-callback-loop-thread)
  (let* ((tgroup
          (##make-tgroup 'callback-loop #f))
         (callback-loop-thread
          (##make-root-thread
           ##callback-loop
           'callback-loop
           tgroup)))
    (##thread-start! callback-loop-thread)))

(##start-callback-loop-thread)

you should just end the program with the call (##callback-loop) so that it is the primordial thread that runs the callback handling loop

drewc @drewc gives @feeley big virtual hugs
Drew Crampsie
@drewc
That is exactly what I'm working on at this very moment, a default process that is loaded by the init of the VM.scm module. My (let lol () (thread-sleep! 100) (lol))works, don't get me wrong, but that's a much better idea.
I'll likely make my own event handler as I'll not be doing any modifications to _univlib.scm, but thank you so much for laying in out in such a simple fashion, that helps so much!
adam-7
@adam-7

@feeley Dear Marc, just curious how are C/C++ atomics kind of functionality done in Scheme?

Say you want to |set!| a variable in Gambit processor A, in such a way that Gambit processor B when it sees that variable, is guaranteed to see all of its contents.

Do you have an |atomic-set!| or such variant of |set!| that will have that guarantee, a la C/C++ atomics?

(This in practice will only be of concern on weakly ordered architectures as in ARM64 and is it RISCV.)

Note that the atomic mutator primitive would not only have a memory barrier kind of function (as in expand to (##mbarrier) (set! x y)), BUT also have the effect on Gambit's compiler, to prohibit compiler optimizations to reorder loads and stores in such a way that they would switch side of the |atomic-set!|
adam-7
@adam-7
@gcartier just curious ##wr-set! does what?
Marc Feeley
@feeley
@gcartier it sets ##wr to the procedure that is called by write, display, etc
Marc Feeley
@feeley

@adam-7 The atomicity of reading/writing Scheme variables is not yet clear. However there are atomic operations on vectors: vector-inc! (increment an element) and vector-cas! (compare and swap):

> (define v (vector 5))
> (vector-inc! v 0)     
5
> (vector-inc! v 0)
6
> v
#(7)
> (vector-cas! v 0 'foo 42) 
7
> v
#(7)
> (vector-cas! v 0 'foo 7) 
7
> v
#(foo)

The first two parameters of these procedures are the vector and the index of the element. vector-inc! increments the element (which must be a fixnum) and returns the value before incrementation. vector-cas! will compare the element with the fourth parameter and will set it to the third parameter if they are eq?. The previous content of the element is returned. So you can use (vector-cas! v i #f #f) as an atomic (vector-ref v i).

Guillaume Cartier
@gcartier
@adam-7 I use ##wr to custom print some define-type
Marc Feeley
@feeley
@gcartier sorry I should have mentionned @adam-7...
Guillaume Cartier
@gcartier
@feeley hey! No worries
drewc @drewc <3's _os_load_object_file, that is exactly the logic he needed to see for _r0 and _r1 and he pretends he now knows what they register :P
Marc Feeley
@feeley
_r0 = return address, _r1 = return value (and parameter #1), _r2 = parameter #2, ...
Drew Crampsie
@drewc
Ok, that makes sense. So when setting _r0 to null (for the browser) that says to the VM that we are not trying to return a value or something similar so that on loading the JS object file it does not get confused, then setting it back to where is was, while setting the return to the vector we actually want to return and jumping on the trampoline, reinstates that aspect and picks up where we left off?
Which must now be to run the init function of the _module_latest_registered which is why it is returned that way? ... must go look at the code again!
Drew Crampsie
@drewc
Awesome, that makes things clear. Yay Gambit!
drewc @drewc does another happy dance
salotz
@salotz:matrix.org
[m]

all highly evolved living things need a heatbeat...

I will not take this anti-vegetable slander lying down!!

Drew Crampsie
@drewc
They breathe, but are heartless ... I think I know some vegetables personally! Cellular respiration does not require a heart, just a sunny day.
Drew Crampsie
@drewc
drewc@nyx:~/me/src/gxjs/packages/gambit-scheme]$ node
Welcome to Node.js v12.18.4.
Type ".help" for more information.
> const VM = require('gambit-scheme');
undefined
> let foo = () => { console.log ('host function runs here!') }, bar = _host2scm(foo)
undefined
> _g['run-me-now!'] = bar ; VM.runProcedure = 'run-me-now!'
'run-me-now!'
> host function runs here!
> baz = _scm2host(_g['run-me-now!']); baz();
host function runs here!
Promise { undefined }
>
drewc @drewc has threads working well and thanks you for it :)
drewc @drewc also has minimization working wonderfully:
Drew Crampsie
@drewc
[drewc@nyx:~/me/src/gxjs/packages/gambit-scheme]$ ./bin/gsi.js 
Gambit v4.9.3

> (time (fib 20))
(time (fib 20))
    0.014000 secs real time
    0.014000 secs cpu time (0.014000 user, 0.000000 system)
    no collections
    no bytes allocated
    no minor faults
    no major faults
6765
> ,q

[drewc@nyx:~/me/src/gxjs/packages/gambit-scheme]$ du ./bin/gsi.js 
3100    ./bin/gsi.js
13 replies
 gzip -9 bin/gsi.js 

[drewc@nyx:~/me/src/gxjs/packages/gambit-scheme]$ du ./bin/gsi.js.gz 
664     ./bin/gsi.js.gz
not quite 640k, but close enough :)
Jaime Fournier
@ober
wow
amirouche
@amirouche
Re JavaScript target: How can I disable the behavior that will resolve JavaScript promises implicitly? I want that because I want to run concurrently several fetch? Maybe there is another way to do that with threads?