Branch: Tag:

2014-12-04

2014-12-04 19:27:03 by Per Hedbor <ph@opera.com>

Added CALL_LFUN<X>, useful when the number of arguments is known

458:    struct reference *ref =    Pike_compiler->new_program->identifier_references + id;    -  emit0(F_MARK); +  if((Pike_compiler->compiler_frame->current_function_number >= 0) && +  ((id == Pike_compiler->compiler_frame->current_function_number) || +  ((!ref->inherit_offset) && +  (ref->identifier_offset == +  Pike_compiler->new_program-> +  identifier_references[Pike_compiler->compiler_frame-> +  current_function_number].identifier_offset))) && +  !(Pike_compiler->new_program-> +  identifiers[ref->identifier_offset].identifier_flags & +  (IDENTIFIER_VARARGS|IDENTIFIER_SCOPE_USED)) && +  !(Pike_compiler->compiler_frame->lexical_scope & SCOPE_SCOPE_USED)) +  {    PUSH_CLEANUP_FRAME(do_pop_mark, 0); -  +  emit0(F_MARK);    do_docode(args,0);       /* Test description:
474:    *    * * Check that the current function doesn't contain scoped functions.    */ -  if((Pike_compiler->compiler_frame->current_function_number >= 0) && -  ((id == Pike_compiler->compiler_frame->current_function_number) || -  ((!ref->inherit_offset) && -  (ref->identifier_offset == -  Pike_compiler->new_program-> -  identifier_references[Pike_compiler->compiler_frame-> -  current_function_number].identifier_offset))) && -  !(Pike_compiler->new_program-> -  identifiers[ref->identifier_offset].identifier_flags & -  (IDENTIFIER_VARARGS|IDENTIFIER_SCOPE_USED)) && -  !(Pike_compiler->compiler_frame->lexical_scope & SCOPE_SCOPE_USED)) +  if(Pike_compiler->compiler_frame->is_inline || (ref->id_flags & (ID_INLINE|ID_PRIVATE)))    { -  if(Pike_compiler->compiler_frame->is_inline || (ref->id_flags & ID_INLINE)) -  { +     /* Identifier is declared inline/local    * or in inlining pass.    */ -  if ((ref->id_flags & ID_INLINE) && +  if ((ref->id_flags & (ID_INLINE|ID_PRIVATE)) &&    (!Pike_compiler->compiler_frame->is_inline)) {    /* Explicit local:: reference in first pass.    *
511:    Pike_compiler->compiler_frame->recur_label =    do_jump(F_POINTER, Pike_compiler->compiler_frame->recur_label);    } -  } else { -  emit1(F_CALL_LFUN, id); +  POP_AND_DONT_CLEANUP; +  return 1;    } -  +  else { + #ifdef USE_APPLY_N +  int nargs = count_args(args); +  if( nargs == -1 ) +  { + #endif +  PUSH_CLEANUP_FRAME(do_pop_mark, 0); +  emit0(F_MARK); +  do_docode(args,0); +  emit1(F_CALL_LFUN, id);    POP_AND_DONT_CLEANUP;    return 1; -  + #ifdef USE_APPLY_N    } -  +  else +  { +  do_docode(args,0); +  emit2(F_CALL_LFUN_N, id, nargs); +  } + #endif +  } +  return 1; + }      /*    * FIXME: this can be optimized, but is not really used
956:    * prototype. */    emit1(F_LFUN, n->u.integer.b);    } else if (IDENTIFIER_IS_CONSTANT(id->identifier_flags) && -  (ref->id_flags & ID_INLINE) && !ref->inherit_offset && +  (ref->id_flags & (ID_INLINE|ID_PRIVATE)) && !ref->inherit_offset &&    (id->func.const_info.offset >= 0)) {    /* An inline, local or final constant identifier.    * No need for vtable traversal during runtime.
1384:    } else if (!level) {    f += inh->identifier_level;    if (flags & DO_POP) { + #ifndef USE_APPLY_N    emit0(F_MARK); -  + #endif    code_expression(CAR(n), 0, "RHS");    } else {    code_expression(CAR(n), 0, "RHS"); -  + #ifndef USE_APPLY_N    emit0(F_MARK); -  + #endif    emit0(F_DUP);    } -  + #ifdef USE_APPLY_N +  emit2(F_CALL_LFUN_N, f, 1); + #else    emit1(F_CALL_LFUN, f); -  + #endif    emit0(F_POP_VALUE);    return !(flags & DO_POP);    }