Skip to content

Commit 3fa88ec

Browse files
TyOverbyhhugo
andauthored
Runtime: precompute prng lxm constants (#1730)
Co-authored-by: Hugo Heuzard <hugo.heuzard@gmail.com>
1 parent e67805e commit 3fa88ec

File tree

5 files changed

+18
-13
lines changed

5 files changed

+18
-13
lines changed

CHANGES.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
* Lib: Modify Typed_array API for compatibility with WebAssembly
2727
* Lib: add details element and toggle event (#1728)
2828
* Toplevel: no longer set globals for toplevel initialization
29+
* Runtime: precompute constants used in `caml_lxm_next` (#1730)
2930

3031
## Bug fixes
3132
* Runtime: fix parsing of unsigned integers (0u2147483648) (#1633, #1666)

compiler/tests-check-prim/main.output

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -177,9 +177,6 @@ caml_obj_is_block
177177
caml_obj_is_shared
178178
caml_obj_update_tag
179179

180-
From +prng.js:
181-
caml_lxm_next
182-
183180
From +runtime_events.js:
184181
caml_custom_event_index
185182
caml_ml_runtime_events_pause

compiler/tests-check-prim/unix-unix.output

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -286,9 +286,6 @@ caml_obj_is_block
286286
caml_obj_is_shared
287287
caml_obj_update_tag
288288

289-
From +prng.js:
290-
caml_lxm_next
291-
292289
From +runtime_events.js:
293290
caml_custom_event_index
294291
caml_ml_runtime_events_pause

compiler/tests-check-prim/unix-win32.output

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -251,9 +251,6 @@ caml_obj_is_block
251251
caml_obj_is_shared
252252
caml_obj_update_tag
253253

254-
From +prng.js:
255-
caml_lxm_next
256-
257254
From +runtime_events.js:
258255
caml_custom_event_index
259256
caml_ml_runtime_events_pause

runtime/js/prng.js

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,15 @@
1+
//Provides: caml_lxm_M
2+
//Requires: caml_int64_of_string
3+
//Requires: caml_new_string
4+
//Version: >= 5
5+
var caml_lxm_M = caml_int64_of_string(caml_new_string("0xd1342543de82ef95"));
6+
7+
//Provides: caml_lxm_daba
8+
//Requires: caml_int64_of_string
9+
//Requires: caml_new_string
10+
//Version: >= 5
11+
var caml_lxm_daba = caml_int64_of_string(caml_new_string("0xdaba0b6eb09322e3"));
12+
113
//Provides: caml_lxm_next
214
//Requires: caml_int64_shift_left
315
//Requires: caml_int64_shift_right_unsigned
@@ -7,8 +19,9 @@
719
//Requires: caml_int64_mul
820
//Requires: caml_ba_get_1
921
//Requires: caml_ba_set_1
10-
//Requires: caml_int64_of_string
11-
//Requires: caml_new_string
22+
//Requires: caml_lxm_M
23+
//Requires: caml_lxm_daba
24+
//Version: >= 5
1225
function caml_lxm_next(v) {
1326
function shift_l(x, k) {
1427
return caml_int64_shift_left(x, k);
@@ -37,8 +50,8 @@ function caml_lxm_next(v) {
3750
function set(a, i, x) {
3851
return caml_ba_set_1(a, i, x);
3952
}
40-
var M = caml_int64_of_string(caml_new_string("0xd1342543de82ef95"));
41-
var daba = caml_int64_of_string(caml_new_string("0xdaba0b6eb09322e3"));
53+
var M = caml_lxm_M;
54+
var daba = caml_lxm_daba;
4255
var z, q0, q1;
4356
var st = v;
4457
var a = get(st, 0);

0 commit comments

Comments
 (0)