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: Mohammad-Reza Nabipoor
Subject: Re: [WIP][PATCH 1/2] pvm: add new pvm value: opaque values
Date: Wed, 15 Feb 2023 19:21:34 +0100

Hi Jose.

On Wed, Feb 15, 2023 at 10:26:39AM +0100, Jose E. Marchesi wrote:
> > +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?
> 

No. I just put it there because of completeness, I can remove it.


> > +/* 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?
> 

The `_pkl_eq_opaque' compares both name and payload/pointer (I'm using both
`opqgetn' and `opqgetp' instructions).
And do you mean we only need to compare the payloads and not names?



Regards,
Mohammad-Reza



reply via email to

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