Re: Can't remove a call_out.
Henrik Grubbström <[email protected]>
| Newsgroups | gmane.comp.lang.pike.user |
|---|---|
| Organization | Roxen Internet Software AB |
| Message-ID | <[email protected]> |
On Fri, 24 Oct 2014, Arne Goedeke wrote:
> I would propose the following patch. It tries to follow the same logic
> that is_eq uses when comparing trampolines:
>
> diff --git a/src/svalue.c b/src/svalue.c
> index 0f960b2..958c290 100644
> --- a/src/svalue.c
> +++ b/src/svalue.c
> @@ -448,6 +448,15 @@ PMOD_EXPORT unsigned INT32 hash_svalue(const struct
> svalue *s)
> return q;
> }
> }
> + case T_FUNCTION:
> + if ((SUBTYPEOF(*s) != FUNCTION_BUILTIN) && s->u.object &&
> s->u.object->prog == pike_trampoline_program) {
Not quite good enough, you still need to check that TYPEOF(*s) is
T_FUNCTION (as there is a fall through from the object case), and
the fall through ought to be marked with a comment as well.
> + struct pike_trampoline *tramp = get_storage(s->u.object,
> pike_trampoline_program);
> + if (tramp) {
> + q = PTR_TO_INT(tramp->func) ^ PTR_TO_INT(tramp->frame);
> + break;
> + }
> + }
> +
> /* FALL THROUGH */
> default:
> #if SIZEOF_CHAR_P > 4
Otherwise it looks good to me.
--
Henrik Grubbström [email protected]
Roxen Internet Software AB