[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Guile-commits] 55/99: Implement immediate version of vector primitives.
From: |
Christopher Allan Webber |
Subject: |
[Guile-commits] 55/99: Implement immediate version of vector primitives. |
Date: |
Sun, 10 Oct 2021 21:50:59 -0400 (EDT) |
cwebber pushed a commit to branch compile-to-js-merge
in repository guile.
commit 0b9b08a28d5c103241b1bf53df8992fbcfce0ce7
Author: Ian Price <ianprice90@googlemail.com>
AuthorDate: Wed Aug 2 21:03:11 2017 +0100
Implement immediate version of vector primitives.
* module/language/js-il/runtime.js
(make-vector/immediate, vector-set!/immediate,
vector-ref/immediate): New Primitives.
---
module/language/js-il/runtime.js | 18 +++++++++++++++---
1 file changed, 15 insertions(+), 3 deletions(-)
diff --git a/module/language/js-il/runtime.js b/module/language/js-il/runtime.js
index 6b33f5c..a140147 100644
--- a/module/language/js-il/runtime.js
+++ b/module/language/js-il/runtime.js
@@ -235,9 +235,21 @@ scheme.primitives["vector?"] = function (obj) {
return coerce_bool(obj instanceof scheme.Vector);
};
-scheme.primitives["make-vector/immediate"] = not_implemented_yet;
-scheme.primitives["vector-set!/immediate"] = not_implemented_yet;
-scheme.primitives["vector-ref/immediate"] = not_implemented_yet;
+scheme.primitives["make-vector/immediate"] = function(length, init) {
+ var v = new scheme.Vector();
+
+ var temp = []
+ for (var i=0; i < length; i++) {
+ temp[i] = init;
+ }
+
+ v.array = temp;
+
+ return v;
+};
+
+scheme.primitives["vector-set!/immediate"] = scheme.primitives["vector-set!"];
+scheme.primitives["vector-ref/immediate"] = scheme.primitives["vector-ref"];
// Bytevectors
- [Guile-commits] 23/99: Compile cps $prompt form to javascript, (continued)
- [Guile-commits] 23/99: Compile cps $prompt form to javascript, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 26/99: abort-to-prompt takes multiple arguments, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 34/99: Change function type representation, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 33/99: Change program type representation, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 31/99: Different types for Continuation and Variable identifiers, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 29/99: Use scheme.frame.Prompt objects for prompts on dynstack, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 30/99: Implement fluid primitives, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 36/99: Handle more identifier characters, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 47/99: Add some primitives to runtime.js, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 50/99: Add more variables to no-values-primitives, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 55/99: Implement immediate version of vector primitives.,
Christopher Allan Webber <=
- [Guile-commits] 62/99: scm_struct_init skips hidden fields., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 59/99: Implement built-in string procedures., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 60/99: Implement struct built-ins., Christopher Allan Webber, 2021/10/10
- [Guile-commits] 70/99: Add `guild jslink' to bundle JS programs, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 75/99: scheme.HashTable uses ES6 Map objects, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 41/99: Fix build of (language cps compile-js), Christopher Allan Webber, 2021/10/10
- [Guile-commits] 45/99: Add #:js-inline? and #:js-flatten? debugging options, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 54/99: Implement structs in runtime.js, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 25/99: Implement call-with-values, Christopher Allan Webber, 2021/10/10
- [Guile-commits] 52/99: Add macro type in runtime.js, Christopher Allan Webber, 2021/10/10