[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2] pvm.jitter: fix `iolist' to have right type
From: |
Mohammad-Reza Nabipoor |
Subject: |
[PATCH v2] pvm.jitter: fix `iolist' to have right type |
Date: |
Mon, 24 Oct 2022 20:51:15 +0200 |
2022-10-23 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
* libpoke/pvm.jitter (iolist): Change the instruction to get an
array from the stack.
* libpoke/pkl-rt.pk (iolist): Pass an array on the stack to
`iolist'.
---
Hi Jose.
On Mon, Oct 24, 2022 at 12:05:50AM +0200, Jose E. Marchesi wrote:
> > + pvm_val arr_type = pvm_make_array_type (arr_etype, PVM_NULL);
>
> The bound in the array type cannot be PVM_NULL. It must be a closure
> with signature ()void that once executed returns PVM_NULL.
>
> It is probably a good idea to have a function
>
> pvm_make_unbounded_array_type (ETYPE)
>
> that uses such a closure internally. I suggest to define that closure
> as a RAS function.
>
I found a simpler way :)
ChangeLog | 7 +++++++
libpoke/pkl-rt.pk | 4 +++-
libpoke/pvm.jitter | 12 +++++-------
3 files changed, 15 insertions(+), 8 deletions(-)
diff --git a/ChangeLog b/ChangeLog
index f89acd26..d76aaae2 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,10 @@
+2022-10-23 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
+
+ * libpoke/pvm.jitter (iolist): Change the instruction to get an
+ array from the stack.
+ * libpoke/pkl-rt.pk (iolist): Pass an array on the stack to
+ `iolist'.
+
2022-10-23 Mohammad-Reza Nabipoor <mnabipoor@gnu.org>
* libpoke/pkl-insn.def (PKL_INSN_TYSCTN): Removed.
diff --git a/libpoke/pkl-rt.pk b/libpoke/pkl-rt.pk
index 963bd193..f2ebd1cd 100644
--- a/libpoke/pkl-rt.pk
+++ b/libpoke/pkl-rt.pk
@@ -71,7 +71,9 @@ immutable fun iobias = (int<32> ios = get_ios)
offset<uint<64>,1>:
immutable fun iolist = int<32>[]:
{
- return asm int<32>[]: ("iolist");
+ var a = int<32>[] ();
+
+ return asm int<32>[]: ("iolist" : a);
}
immutable fun iosetbias = (offset<uint<64>,1> bias = 0#1, int<32> ios =
get_ios) void:
diff --git a/libpoke/pvm.jitter b/libpoke/pvm.jitter
index 8fe50780..efcf82aa 100644
--- a/libpoke/pvm.jitter
+++ b/libpoke/pvm.jitter
@@ -1814,21 +1814,19 @@ end
# Instruction: iolist
#
-# Push an array of open IO spaces (array of signed integers) on the stack.
-# This array may be empty if no IO space is open.
+# Given an array on the stack, populate the array with open IO
+# spaces (array of signed integers).
+# This array may be unchanged if no IO space is open.
#
-# Stack: ( -- ARR )
+# Stack: ( ARR -- ARR )
instruction iolist ()
code
struct iolist_ctx iolist_ctx;
- pvm_val arr = pvm_make_array (pvm_make_integral_type (PVM_MAKE_ULONG (32,
64),
- PVM_MAKE_INT (1,
32)),
- PVM_MAKE_ULONG (0, 64));
+ pvm_val arr = JITTER_TOP_STACK ();
iolist_ctx.arr_ios = arr;
ios_map (iolist_callback, &iolist_ctx);
- JITTER_PUSH_STACK (arr);
end
end
--
2.38.1
[PATCH 5/5] pkl-rt.pk: _pkl_print_format_any: handle PVM types, Mohammad-Reza Nabipoor, 2022/10/23
[PATCH 2/5] pkl: rename instruction s/tysctn/tysctgetn/, Mohammad-Reza Nabipoor, 2022/10/23