poke-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [WIP][PATCH 1/2] pvm: add new pvm value: opaque values


From: Jose E. Marchesi
Subject: Re: [WIP][PATCH 1/2] pvm: add new pvm value: opaque values
Date: Wed, 15 Feb 2023 10:26:39 +0100
User-agent: Gnus/5.13 (Gnus v5.13)

Hi Mohammad.

> diff --git a/libpoke/pkl-insn.def b/libpoke/pkl-insn.def
> index c086bdf1..cf30396b 100644
> --- a/libpoke/pkl-insn.def
> +++ b/libpoke/pkl-insn.def
> @@ -281,6 +281,12 @@ PKL_DEF_INSN(PKL_INSN_OSETM,"","osetm")
>  PKL_DEF_INSN(PKL_INSN_OGETU,"","ogetu")
>  PKL_DEF_INSN(PKL_INSN_OGETBT,"","ogetbt")
>  
> +/* Opaque instructions.  */

I would say there "Opaque values instructions.".

> +PKL_DEF_INSN(PKL_INSN_OPQGETN,"","opqgetn")
> +PKL_DEF_INSN(PKL_INSN_OPQSETN,"","opqsetn")

Hm do we really need an opqsetn instruction?  Isn't the name in #<NAME>
something that is up to whatever is providing the opaque value?

> +PKL_DEF_INSN(PKL_INSN_OPQGETP,"","opqgetp")
> +
>  /* Containers instructions.  */
>  
>  PKL_DEF_INSN(PKL_INSN_SEL,"","sel")
> @@ -367,6 +373,9 @@ PKL_DEF_INSN(PKL_INSN_TYOGETM,"","tyogetm")
>  PKL_DEF_INSN(PKL_INSN_TYOGETU,"","tyogetu")
>  PKL_DEF_INSN(PKL_INSN_TYISO,"","tyiso")
>  
> +PKL_DEF_INSN(PKL_INSN_MKTYOPQ,"","mktyopq")
> +PKL_DEF_INSN(PKL_INSN_TYISOPQ,"","tyisopq")
> +
>  PKL_DEF_INSN(PKL_INSN_MKTYC,"","mktyc")
>  PKL_DEF_INSN(PKL_INSN_TYISC,"","tyisc")
>  /* PKL_DEF_INSN(PKL_INSN_TYCNA,"","tycna") */

> [...]

> +/* Determine whether two given opaque values are equal.  */
> +
> +immutable fun _pkl_eq_opaque = (any v1, any v2) int<32>:
> +{
> +  if (asm string: ("opqgetn; nip" : v1) != asm string: ("opqgetn; nip" : v2))
> +    return 0;
> +  if (asm uint<64>: ("opqgetp; nip" : v1) != asm uint<64>: ("opqgetp; nip" : 
> v2))
> +    return 0;
> +  return 1;
> +}

I thought the #<NAME> basically identifies a class of opaque types.  For
example, #<regexp>.

Then every regexp is equal to another?

Woulnd't it make more sense to introduce an eqopq instruction that
compares by payload/pointer?



reply via email to

[Prev in Thread] Current Thread [Next in Thread]