diff --git a/compiler/tests-check-prim/main.output b/compiler/tests-check-prim/main.output index 52e2ae1dea..9dc29eed98 100644 --- a/compiler/tests-check-prim/main.output +++ b/compiler/tests-check-prim/main.output @@ -34,22 +34,6 @@ caml_bigstring_blit_string_to_ba caml_bigstring_memcmp caml_hash_mix_bigstring -From +domain.js: -caml_atomic_cas -caml_atomic_exchange -caml_atomic_fetch_add -caml_atomic_load -caml_domain_dls -caml_domain_dls_get -caml_domain_dls_set -caml_domain_id -caml_domain_spawn -caml_ml_domain_cpu_relax -caml_ml_domain_id -caml_ml_domain_set_name -caml_ml_domain_unique_token -caml_recommended_domain_count - From +dynlink.js: caml_add_debug_info caml_register_code_fragment diff --git a/compiler/tests-check-prim/main.output5 b/compiler/tests-check-prim/main.output5 index 5508398b53..3820c1272b 100644 --- a/compiler/tests-check-prim/main.output5 +++ b/compiler/tests-check-prim/main.output5 @@ -27,9 +27,6 @@ caml_bigstring_blit_string_to_ba caml_bigstring_memcmp caml_hash_mix_bigstring -From +domain.js: -caml_ml_domain_set_name - From +dynlink.js: caml_add_debug_info caml_register_code_fragment diff --git a/compiler/tests-check-prim/unix-unix.output b/compiler/tests-check-prim/unix-unix.output index b50df69614..a647b67cf2 100644 --- a/compiler/tests-check-prim/unix-unix.output +++ b/compiler/tests-check-prim/unix-unix.output @@ -143,22 +143,6 @@ caml_bigstring_blit_string_to_ba caml_bigstring_memcmp caml_hash_mix_bigstring -From +domain.js: -caml_atomic_cas -caml_atomic_exchange -caml_atomic_fetch_add -caml_atomic_load -caml_domain_dls -caml_domain_dls_get -caml_domain_dls_set -caml_domain_id -caml_domain_spawn -caml_ml_domain_cpu_relax -caml_ml_domain_id -caml_ml_domain_set_name -caml_ml_domain_unique_token -caml_recommended_domain_count - From +dynlink.js: caml_add_debug_info caml_register_code_fragment diff --git a/compiler/tests-check-prim/unix-unix.output5 b/compiler/tests-check-prim/unix-unix.output5 index 0c8f1ef23a..e0b77c8dff 100644 --- a/compiler/tests-check-prim/unix-unix.output5 +++ b/compiler/tests-check-prim/unix-unix.output5 @@ -138,9 +138,6 @@ caml_bigstring_blit_string_to_ba caml_bigstring_memcmp caml_hash_mix_bigstring -From +domain.js: -caml_ml_domain_set_name - From +dynlink.js: caml_add_debug_info caml_register_code_fragment diff --git a/compiler/tests-check-prim/unix-win32.output b/compiler/tests-check-prim/unix-win32.output index ad9aff0522..bad80e88a1 100644 --- a/compiler/tests-check-prim/unix-win32.output +++ b/compiler/tests-check-prim/unix-win32.output @@ -108,23 +108,6 @@ caml_bigstring_blit_string_to_ba caml_bigstring_memcmp caml_hash_mix_bigstring -From +domain.js: -caml_atomic_cas -caml_atomic_exchange -caml_atomic_fetch_add -caml_atomic_load -caml_atomic_make_contended -caml_domain_dls -caml_domain_dls_get -caml_domain_dls_set -caml_domain_id -caml_domain_spawn -caml_ml_domain_cpu_relax -caml_ml_domain_id -caml_ml_domain_set_name -caml_ml_domain_unique_token -caml_recommended_domain_count - From +dynlink.js: caml_add_debug_info caml_register_code_fragment diff --git a/compiler/tests-check-prim/unix-win32.output5 b/compiler/tests-check-prim/unix-win32.output5 index a546ef866f..a405364914 100644 --- a/compiler/tests-check-prim/unix-win32.output5 +++ b/compiler/tests-check-prim/unix-win32.output5 @@ -104,9 +104,6 @@ caml_bigstring_blit_string_to_ba caml_bigstring_memcmp caml_hash_mix_bigstring -From +domain.js: -caml_ml_domain_set_name - From +dynlink.js: caml_add_debug_info caml_register_code_fragment diff --git a/runtime/js/domain.js b/runtime/js/domain.js index 6d79fa38bd..e2808c3063 100644 --- a/runtime/js/domain.js +++ b/runtime/js/domain.js @@ -1,8 +1,10 @@ //Provides: caml_domain_dls +//Version: >= 5 var caml_domain_dls = [0]; //Provides: caml_domain_dls_set //Requires: caml_domain_dls +//Version: >= 5 function caml_domain_dls_set(a) { caml_domain_dls = a; } @@ -18,16 +20,19 @@ function caml_domain_dls_compare_and_set(old, n) { //Provides: caml_domain_dls_get //Requires: caml_domain_dls +//Version: >= 5 function caml_domain_dls_get(unit) { return caml_domain_dls; } //Provides: caml_atomic_load +//Version: >= 5 function caml_atomic_load(ref) { return ref[1]; } //Provides: caml_atomic_cas +//Version: >= 5 function caml_atomic_cas(ref, o, n) { if (ref[1] === o) { ref[1] = n; @@ -37,6 +42,7 @@ function caml_atomic_cas(ref, o, n) { } //Provides: caml_atomic_fetch_add +//Version: >= 5 function caml_atomic_fetch_add(ref, i) { var old = ref[1]; ref[1] += i; @@ -44,6 +50,7 @@ function caml_atomic_fetch_add(ref, i) { } //Provides: caml_atomic_exchange +//Version: >= 5 function caml_atomic_exchange(ref, v) { var r = ref[1]; ref[1] = v; @@ -57,18 +64,14 @@ function caml_atomic_make_contended(a) { } //Provides: caml_ml_domain_unique_token -//Version: < 5.2 +//Version: >= 5.0, < 5.2 var caml_ml_domain_unique_token_ = [0]; function caml_ml_domain_unique_token(unit) { return caml_ml_domain_unique_token_; } -//Provides: caml_ml_domain_set_name -function caml_ml_domain_set_name(_name) { - return 0; -} - //Provides: caml_recommended_domain_count +//Version: >= 5 function caml_recommended_domain_count(unit) { return 1; } @@ -81,6 +84,7 @@ function caml_ml_domain_index(unit) { } //Provides: caml_domain_id +//Version: >= 5 var caml_domain_id = 0; //Provides: caml_domain_spawn @@ -105,7 +109,7 @@ function caml_domain_spawn(f, term_sync) { //Requires: caml_ml_mutex_unlock //Requires: caml_domain_id //Requires: caml_callback -//Version: < 5.2 +//Version: >= 5.0, < 5.2 var caml_domain_latest_idx = 1; function caml_domain_spawn(f, mutex) { var id = caml_domain_latest_idx++; @@ -119,11 +123,13 @@ function caml_domain_spawn(f, mutex) { //Provides: caml_ml_domain_id //Requires: caml_domain_id +//Version: >= 5.0 function caml_ml_domain_id(unit) { return caml_domain_id; } //Provides: caml_ml_domain_cpu_relax +//Version: >= 5 function caml_ml_domain_cpu_relax(unit) { return 0; }