[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v2 1/2] pkl: codegen: make struct_{constructor,deintegrator}
From: |
Jose E. Marchesi |
Subject: |
Re: [PATCH v2 1/2] pkl: codegen: make struct_{constructor,deintegrator} exception-safe |
Date: |
Mon, 26 Sep 2022 14:22:12 +0200 |
User-agent: |
Gnus/5.13 (Gnus v5.13) Emacs/28.0.50 (gnu/linux) |
> Hi Jose.
>
> On Mon, Sep 26, 2022 at 01:22:18PM +0200, Jose E. Marchesi wrote:
>>
>> > @@ -2174,9 +2178,15 @@
>> > .let @itype = PKL_AST_TYPE_S_ITYPE (@type_struct)
>> > .let @uint64_type = pkl_ast_make_integral_type (PKL_PASS_AST, 64,
>> > 0)
>> > .e zero_extend_64 @itype
>> > - regvar $ival
>> > + ;; If constraint violation exception happens during the
>> > + ;; construction of deintegrated struct, this is the right
>> > + ;; place to restore the stack.
>> > + push PVM_E_CONSTRAINT
>> > + pushe .constraint_failed
>>
>> I agree the dup below is necessary in case the caller to
>> struct_deintegrator catches an exception and needs the stack restored
>> without the argument trashed.
>>
>> But why is this intermediate `pushe' needed at all? Just let the
>> exception fly thru.
>>
>
> Right. I over-thinked it.
> Either there's no exception handler and it reaches to the user,
> or there's a pushe somewhere and it will restore the stack height
> to right position.
>
> With removing this, is this OK for master?
Yes. Thanks.
- Re: [PATCH] pkl: add support for integral unions, (continued)
[PATCH v2 1/2] pkl: codegen: make struct_{constructor, deintegrator} exception-safe, Mohammad-Reza Nabipoor, 2022/09/25