Branch: Tag:

2003-03-18

2003-03-18 18:25:06 by Henrik Grubbström (Grubba) <grubba@grubba.org>

Fix for DO_RECUR/RETURN_LOCAL incompatibility.

Rev: src/interpret_functions.h:1.142

2:   || This file is part of Pike. For copyright information see COPYRIGHT.   || Pike is distributed under GPL, LGPL and MPL. See the file COPYING   || for more information. - || $Id: interpret_functions.h,v 1.141 2003/03/14 15:50:44 grubba Exp $ + || $Id: interpret_functions.h,v 1.142 2003/03/18 18:25:06 grubba Exp $   */      /*
1098:    pop_stack();    }else{    DO_BRANCH(); +  pop_stack(); +  push_int(0);    }   });   
1719:   #define MKAPPLY(OP,OPCODE,NAME,TYPE, ARG2, ARG3) \   OP(PIKE_CONCAT(F_,OPCODE),NAME, I_PC_AT_NEXT, { \   Pike_fp->pc=PROG_COUNTER; \ - if(low_mega_apply(TYPE,DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)), \ + if(low_mega_apply(TYPE,0,DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)), \    ARG2, ARG3)) \   { \    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL; \
1729:    \   OP(PIKE_CONCAT3(F_,OPCODE,_AND_POP),NAME " & pop", I_PC_AT_NEXT, { \    Pike_fp->pc=PROG_COUNTER; \ -  if(low_mega_apply(TYPE, DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)), \ +  if(low_mega_apply(TYPE, 0, DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)), \    ARG2, ARG3)) \    { \    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL | PIKE_FRAME_RETURN_POP; \
1741:    \   PIKE_CONCAT(OP,_RETURN)(PIKE_CONCAT3(F_,OPCODE,_AND_RETURN), \    NAME " & return", 0, { \ -  if(low_mega_apply(TYPE,DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)), \ +  if(low_mega_apply(TYPE,0,DO_NOT_WARN((INT32)(Pike_sp - *--Pike_mark_sp)), \    ARG2,ARG3)) \    { \    PIKE_OPCODE_T *addr = Pike_fp->pc; \
1760:    \   OP(PIKE_CONCAT(F_MARK_,OPCODE),"mark, " NAME, I_PC_AT_NEXT, { \    Pike_fp->pc=PROG_COUNTER; \ -  if(low_mega_apply(TYPE,0, \ +  if(low_mega_apply(TYPE,0, 0, \    ARG2, ARG3)) \    { \    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL; \
1770:    \   OP(PIKE_CONCAT3(F_MARK_,OPCODE,_AND_POP),"mark, " NAME " & pop", I_PC_AT_NEXT, { \    Pike_fp->pc=PROG_COUNTER; \ -  if(low_mega_apply(TYPE, 0, \ +  if(low_mega_apply(TYPE, 0, 0, \    ARG2, ARG3)) \    { \    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL | PIKE_FRAME_RETURN_POP; \
1782:    \   PIKE_CONCAT(OP,_RETURN)(PIKE_CONCAT3(F_MARK_,OPCODE,_AND_RETURN), \    "mark, " NAME " & return", 0, { \ -  if(low_mega_apply(TYPE,0, \ +  if(low_mega_apply(TYPE,0, 0, \    ARG2,ARG3)) \    { \    PIKE_OPCODE_T *addr = Pike_fp->pc; \
1821:    p);    if(fun >= 0)    { -  if(low_mega_apply(APPLY_LOW, args-1, o, (void *)(ptrdiff_t)fun)) +  if(low_mega_apply(APPLY_LOW, 0, args-1, o, (void *)(ptrdiff_t)fun))    {    Pike_fp->save_sp--;    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;
1847:    *s=tmp2;    print_return_value();    -  if(low_mega_apply(APPLY_STACK, args, 0, 0)) +  if(low_mega_apply(APPLY_STACK, 0, args, 0, 0))    {    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL;    DO_JUMP_TO(Pike_fp->pc);
1873:    p);    if(fun >= 0)    { -  if(low_mega_apply(APPLY_LOW, args-1, o, (void *)(ptrdiff_t)fun)) +  if(low_mega_apply(APPLY_LOW, 0, args-1, o, (void *)(ptrdiff_t)fun))    {    Pike_fp->save_sp--;    Pike_fp->flags |=
1901:    *s=tmp2;    print_return_value();    -  if(low_mega_apply(APPLY_STACK, args, 0, 0)) +  if(low_mega_apply(APPLY_STACK, 0, args, 0, 0))    {    Pike_fp->flags |= PIKE_FRAME_RETURN_INTERNAL | PIKE_FRAME_RETURN_POP;    DO_JUMP_TO(Pike_fp->pc);
1926:    p);    if(fun >= 0)    { -  if(low_mega_apply(APPLY_LOW, args-1, o, (void *)(ptrdiff_t)fun)) +  if(low_mega_apply(APPLY_LOW, 0, args-1, o, (void *)(ptrdiff_t)fun))    {    PIKE_OPCODE_T *addr = Pike_fp->pc;    Pike_fp->save_sp--;
1954:    *s=tmp2;    print_return_value();    -  if(low_mega_apply(APPLY_STACK, args, 0, 0)) +  if(low_mega_apply(APPLY_STACK, 0, args, 0, 0))    {    PIKE_OPCODE_T *addr = Pike_fp->pc;    DO_IF_DEBUG(Pike_fp->next->pc=0);
2116:    * Note: The second part of the test is sufficient, but    * the since first case is much simpler to test and    * is common, it should offer a speed improvement. +  *    * /grubba 2002-11-14 -  +  * +  * Also test if the function uses scoping. DO_RECUR() doesn't +  * adjust fp->expendible which will make eg RETURN_LOCAL fail. +  * +  * /grubba 2003-03-25    */ -  if((p != Pike_fp->context.prog) && +  if(((p != Pike_fp->context.prog) &&    (p->inherits[p->identifier_references[Pike_fp->context.identifier_level +    arg1].inherit_offset].prog != -  Pike_fp->context.prog)) +  Pike_fp->context.prog)) || +  (ID_FROM_INT(p, arg1+Pike_fp->context.identifier_level)-> +  identifier_flags & IDENTIFIER_SCOPE_USED))    {    PIKE_OPCODE_T *faddr = PROG_COUNTER+GET_JUMP();    ptrdiff_t num_locals = READ_INCR_BYTE(faddr); /* ignored */    ptrdiff_t args = READ_INCR_BYTE(faddr);    -  if(low_mega_apply(APPLY_LOW, +  if(low_mega_apply(APPLY_LOW, 0,    args,    Pike_fp->current_object,    (void *)(ptrdiff_t)(arg1+