mirror of
https://github.com/Mercury-Language/mercury.git
synced 2026-04-18 10:53:40 +00:00
Estimated hours taken: 10 Branches: main Change the implementation of thread.spawn in low-level C grades. Previously it called the thread goal (a closure) via an exported Mercury procedure. The problem with that is the call counts as a C -> Mercury call, and so goes via MR_call_engine() which sets up a large stack frame on the Mercury engine's C stack that won't be deallocated until the thread terminates. This is unnecessary inefficient since we can call the thread goal directly instead of via MR_call_engine(). The thread goal won't be returning to a C foreign proc when it finishes, and we don't need MR_call_engine() reserving C stack space for Mercury execution as any Mercury engine that is about to execute the thread goal would have that reserved space already. library/thread.m: As above. tests/par_conj/Mmakefile: tests/par_conj/spawn_many.exp: tests/par_conj/spawn_many.m: Add test case.
2 lines
3 B
Plaintext
2 lines
3 B
Plaintext
ok
|