## Where communities thrive

• Join over 1.5M+ people
• Join over 100K+ communities
• Free without limits
##### Activity
• 01:01
CI run 1251821551 passed
• 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
Having most of the interaction be in a promise saves so much headscratching and will totally get rid of my "fake" js#function where I copy the stack and sp. I never thought I'd enjoy the JS universe so much, but 4 odd months of Universal Runtime and interactions with it, I'm now quite a fan.
Uniting threads and async was what I needed to have IndexedDB interactions without having to pass callbacks.
That was my plan this week, with mutexes and a loop, so 10% of what you did in 1000% of a timesink due to my lack of clue... so I'm very happy :) What a fun Monday.
Marc Feeley
@feeley
too bad you don’t also like SIX… but I’ll give you some time
Drew Crampsie
@drewc
I've thought about that as well and already figured a number of reasons to get along with it, so likely next week you'll hear my praise \infix('of)
Marc Feeley
@feeley
I don’t want praise… I want the happy dance
Drew Crampsie
@drewc
lol, it could happen!
Drew Crampsie
@drewc
Question: why does my gsc and _gambit.js seem to have glo as _i or RTS.i while it most certainly seems to be _g? Is there an easy way to find/see that mapping?
Marc Feeley
@feeley
You’ll find the mapping in gsc/_t-univ-1.scm :
(define (univ-rts-field-low-level-name ctx name)
(if (univ-compactness>=? ctx 5)
(case name
((r0)        'r)
((r1)        'a)
((r2)        'b)
((r3)        'c)
((r4)        'd)
((glo)       'g)
((stack)     's)
((sp)        't)
((nargs)     'n)
((peps)      'e)
((pollcount) 'q)
((inttemp1)  'o)
((inttemp2)  'h)
(else        name))
name))

(define (univ-rts-method-low-level-name ctx name)
(if (univ-compactness>=? ctx 5)
(case name
((poll)                 'p)
((wrong_nargs)          'w)
((make_interned_symbol) 'i)
((check_procedure_glo)  'u)
((ctrlpt_init)          'j)
((returnpt_init)        'k)
((entrypt_init)         'l)
((parententrypt_init)   'm)
((flonumbox)            'F)
((flonump)              'f)
((vectorbox)            'V)
((vectorp)              'v)
((stringbox)            'Z)
;;        ((stringp)              'z)
((cons)                 'X)
((pairp)                'x)
((jsnumberp)            'y)
((base92_decode)        'z)
(else                   name))
name))
Drew Crampsie
@drewc
Brilliant, thanks!
Jaime Fournier
@ober
Jaime Fournier
@ober
Marc Feeley
@feeley
@ober should be fixed now
Jaime Fournier
@ober
ty sir
Drew Crampsie
@drewc
Marc Feeley
@feeley
it seems the whole CS department’s network is down… I can’t reach any of the machines
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'
[91mmake[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
'callback-loop
tgroup)))

(##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!

@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!|
@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