Skip to content

Commit

Permalink
Runtime: adjust effects prims
Browse files Browse the repository at this point in the history
  • Loading branch information
hhugo committed Nov 19, 2024
1 parent 6d9e874 commit 0fe8005
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 24 deletions.
8 changes: 0 additions & 8 deletions compiler/tests-check-prim/main.output
Original file line number Diff line number Diff line change
Expand Up @@ -35,14 +35,6 @@ caml_bigstring_memcmp
caml_hash_mix_bigstring

From +effect.js:
caml_alloc_stack
caml_continuation_use_and_update_handler_noexc
caml_continuation_use_noexc
caml_get_continuation_callstack
caml_ml_condition_broadcast
caml_ml_condition_new
caml_ml_condition_signal
caml_ml_condition_wait
jsoo_effect_not_supported

From +fs.js:
Expand Down
8 changes: 0 additions & 8 deletions compiler/tests-check-prim/unix-unix.output
Original file line number Diff line number Diff line change
Expand Up @@ -144,14 +144,6 @@ caml_bigstring_memcmp
caml_hash_mix_bigstring

From +effect.js:
caml_alloc_stack
caml_continuation_use_and_update_handler_noexc
caml_continuation_use_noexc
caml_get_continuation_callstack
caml_ml_condition_broadcast
caml_ml_condition_new
caml_ml_condition_signal
caml_ml_condition_wait
jsoo_effect_not_supported

From +fs.js:
Expand Down
8 changes: 0 additions & 8 deletions compiler/tests-check-prim/unix-win32.output
Original file line number Diff line number Diff line change
Expand Up @@ -109,14 +109,6 @@ caml_bigstring_memcmp
caml_hash_mix_bigstring

From +effect.js:
caml_alloc_stack
caml_continuation_use_and_update_handler_noexc
caml_continuation_use_noexc
caml_get_continuation_callstack
caml_ml_condition_broadcast
caml_ml_condition_new
caml_ml_condition_signal
caml_ml_condition_wait
jsoo_effect_not_supported

From +fs.js:
Expand Down
9 changes: 9 additions & 0 deletions runtime/js/effect.js
Original file line number Diff line number Diff line change
Expand Up @@ -130,6 +130,7 @@ function caml_perform_effect(eff, cont, k0) {
//Provides: caml_alloc_stack
//Requires: caml_pop_fiber, caml_fiber_stack, caml_call_gen, caml_stack_check_depth, caml_trampoline_return
//If: effects
//Version: >= 5.0
function caml_alloc_stack(hv, hx, hf) {
function call(i, x) {
var f = caml_fiber_stack.h[i];
Expand All @@ -151,11 +152,13 @@ function caml_alloc_stack(hv, hx, hf) {

//Provides: caml_alloc_stack
//If: !effects
//Version: >= 5.0
function caml_alloc_stack(hv, hx, hf) {
return 0;
}

//Provides: caml_continuation_use_noexc
//Version: >= 5.0
function caml_continuation_use_noexc(cont) {
var stack = cont[1];
cont[1] = 0;
Expand All @@ -164,6 +167,7 @@ function caml_continuation_use_noexc(cont) {

//Provides: caml_continuation_use_and_update_handler_noexc
//Requires: caml_continuation_use_noexc
//Version: >= 5.0
function caml_continuation_use_and_update_handler_noexc(
cont,
hval,
Expand All @@ -176,26 +180,31 @@ function caml_continuation_use_and_update_handler_noexc(
}

//Provides: caml_get_continuation_callstack
//Version: >= 5.0
function caml_get_continuation_callstack() {
return [0];
}

//Provides: caml_ml_condition_new
//Version: >= 5.0
function caml_ml_condition_new(unit) {
return { condition: 1 };
}

//Provides: caml_ml_condition_wait
//Version: >= 5.0
function caml_ml_condition_wait(t, mutext) {
return 0;
}

//Provides: caml_ml_condition_broadcast
//Version: >= 5.0
function caml_ml_condition_broadcast(t) {
return 0;
}

//Provides: caml_ml_condition_signal
//Version: >= 5.0
function caml_ml_condition_signal(t) {
return 0;
}
Expand Down

0 comments on commit 0fe8005

Please sign in to comment.