From 6834ad8a6464ca7095d9ffde544e978f86c2bcc6 Mon Sep 17 00:00:00 2001 From: Spiros Eliopoulos Date: Sat, 10 Feb 2018 21:28:09 +0000 Subject: [PATCH 1/5] js-annot: add Provides and Requires annotations to js file Closes #132 --- lib/runtime.js | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/lib/runtime.js b/lib/runtime.js index 3f05448..4b702b8 100644 --- a/lib/runtime.js +++ b/lib/runtime.js @@ -31,18 +31,24 @@ POSSIBILITY OF SUCH DAMAGE. ----------------------------------------------------------------------------*/ +//Provides: angstrom_bigstring_blit_to_bytes +//Requires: string_unsafe_set, caml_ba_unsafe_ref_1 function angstrom_bigstring_blit_to_bytes(src, src_off, dst, dst_off, len) { for (var i = 0; i < len; i++) { string_unsafe_set(dst, dst_off + i, caml_ba_unsafe_ref_1(src, src_off + i)); } } +//Provides: angstrom_bigstring_blit_to_bigstring +//Requires: caml_ba_unsafe_set_1, caml_ba_unsafe_ref_1 function angstrom_bigstring_blit_to_bigstring(src, src_off, dst, dst_off, len) { for (var i = 0; i < len; i++) { caml_ba_unsafe_set_1(dst, dst_off + i, caml_ba_unsafe_ref_1(src, src_off + i)); } } +//Provides: angstrom_bigstring_blit_from_bytes +//Requires: caml_ba_unsafe_set_1, string_unsafe_get function angstrom_bigstring_blit_from_bytes(src, src_off, dst, dst_off, len) { for (var i = 0; i < len; i++) { caml_ba_unsafe_set_1(dst, dstoff + i, string_unsafe_get(src, src_off + i)); From 8b83e7ceb21874d6b52303127af37bb6070e5d58 Mon Sep 17 00:00:00 2001 From: Spiros Eliopoulos Date: Sat, 10 Feb 2018 21:51:57 +0000 Subject: [PATCH 2/5] js-annot: use intrinsics that are available in js --- lib/runtime.js | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/lib/runtime.js b/lib/runtime.js index 4b702b8..3ab9c68 100644 --- a/lib/runtime.js +++ b/lib/runtime.js @@ -32,25 +32,25 @@ ----------------------------------------------------------------------------*/ //Provides: angstrom_bigstring_blit_to_bytes -//Requires: string_unsafe_set, caml_ba_unsafe_ref_1 +//Requires: string_unsafe_set, caml_ba_get_1 function angstrom_bigstring_blit_to_bytes(src, src_off, dst, dst_off, len) { for (var i = 0; i < len; i++) { - string_unsafe_set(dst, dst_off + i, caml_ba_unsafe_ref_1(src, src_off + i)); + string_unsafe_set(dst, dst_off + i, caml_ba_get_1(src, src_off + i)); } } //Provides: angstrom_bigstring_blit_to_bigstring -//Requires: caml_ba_unsafe_set_1, caml_ba_unsafe_ref_1 +//Requires: caml_ba_unsafe_set_1, caml_ba_get_1 function angstrom_bigstring_blit_to_bigstring(src, src_off, dst, dst_off, len) { for (var i = 0; i < len; i++) { - caml_ba_unsafe_set_1(dst, dst_off + i, caml_ba_unsafe_ref_1(src, src_off + i)); + caml_ba_set_1(dst, dst_off + i, caml_ba_get_1(src, src_off + i)); } } //Provides: angstrom_bigstring_blit_from_bytes -//Requires: caml_ba_unsafe_set_1, string_unsafe_get +//Requires: caml_ba_set_1, string_unsafe_get function angstrom_bigstring_blit_from_bytes(src, src_off, dst, dst_off, len) { for (var i = 0; i < len; i++) { - caml_ba_unsafe_set_1(dst, dstoff + i, string_unsafe_get(src, src_off + i)); + caml_ba_set_1(dst, dstoff + i, string_unsafe_get(src, src_off + i)); } } From 2e6e328006d505e4a0eeb52ad091c9b17dae2ce3 Mon Sep 17 00:00:00 2001 From: Spiros Eliopoulos Date: Sat, 10 Feb 2018 21:55:54 +0000 Subject: [PATCH 3/5] js-annot: fix dstoff -> dst_off typo --- lib/runtime.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/runtime.js b/lib/runtime.js index 3ab9c68..bdff249 100644 --- a/lib/runtime.js +++ b/lib/runtime.js @@ -51,6 +51,6 @@ function angstrom_bigstring_blit_to_bigstring(src, src_off, dst, dst_off, len) { //Requires: caml_ba_set_1, string_unsafe_get function angstrom_bigstring_blit_from_bytes(src, src_off, dst, dst_off, len) { for (var i = 0; i < len; i++) { - caml_ba_set_1(dst, dstoff + i, string_unsafe_get(src, src_off + i)); + caml_ba_set_1(dst, dst_off + i, string_unsafe_get(src, src_off + i)); } } From 1835af18fbaccc7856d19688cbe003fd81dae2ae Mon Sep 17 00:00:00 2001 From: Spiros Eliopoulos Date: Sat, 10 Feb 2018 21:57:16 +0000 Subject: [PATCH 4/5] js-annot: fix caml_ba_unsafe_set in annotation --- lib/runtime.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/runtime.js b/lib/runtime.js index bdff249..2408cfd 100644 --- a/lib/runtime.js +++ b/lib/runtime.js @@ -40,7 +40,7 @@ function angstrom_bigstring_blit_to_bytes(src, src_off, dst, dst_off, len) { } //Provides: angstrom_bigstring_blit_to_bigstring -//Requires: caml_ba_unsafe_set_1, caml_ba_get_1 +//Requires: caml_ba_set_1, caml_ba_get_1 function angstrom_bigstring_blit_to_bigstring(src, src_off, dst, dst_off, len) { for (var i = 0; i < len; i++) { caml_ba_set_1(dst, dst_off + i, caml_ba_get_1(src, src_off + i)); From 1055904bb64faf5a9acfbe5eec512bc6dddc1972 Mon Sep 17 00:00:00 2001 From: Spiros Eliopoulos Date: Sat, 10 Feb 2018 22:44:36 +0000 Subject: [PATCH 5/5] js-annot: string ops have to be prefixed by caml_ --- lib/runtime.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/runtime.js b/lib/runtime.js index 2408cfd..a9f063a 100644 --- a/lib/runtime.js +++ b/lib/runtime.js @@ -32,10 +32,10 @@ ----------------------------------------------------------------------------*/ //Provides: angstrom_bigstring_blit_to_bytes -//Requires: string_unsafe_set, caml_ba_get_1 +//Requires: caml_string_unsafe_set, caml_ba_get_1 function angstrom_bigstring_blit_to_bytes(src, src_off, dst, dst_off, len) { for (var i = 0; i < len; i++) { - string_unsafe_set(dst, dst_off + i, caml_ba_get_1(src, src_off + i)); + caml_string_unsafe_set(dst, dst_off + i, caml_ba_get_1(src, src_off + i)); } } @@ -48,9 +48,9 @@ function angstrom_bigstring_blit_to_bigstring(src, src_off, dst, dst_off, len) { } //Provides: angstrom_bigstring_blit_from_bytes -//Requires: caml_ba_set_1, string_unsafe_get +//Requires: caml_ba_set_1, caml_string_unsafe_get function angstrom_bigstring_blit_from_bytes(src, src_off, dst, dst_off, len) { for (var i = 0; i < len; i++) { - caml_ba_set_1(dst, dst_off + i, string_unsafe_get(src, src_off + i)); + caml_ba_set_1(dst, dst_off + i, caml_string_unsafe_get(src, src_off + i)); } }