pike.git / src / docode.c

version» Context lines:

pike.git/src/docode.c:587:    }   #endif    }    return 1;   }      /*    * FIXME: this can be optimized, but is not really used    * enough to be worth it yet.    */ - static void emit_apply_builtin(char *func) + static void low_emit_apply_builtin(char *func, char *fallback)   {    INT32 tmp1;    struct compilation *c = THIS_COMPILATION;    struct pike_string *n1=make_shared_string(func);    node *n=find_module_identifier(n1,0);    free_string(n1);    -  +  if (!n && fallback) { +  func = fallback; +  n1 = make_shared_string(func); +  n = find_module_identifier(n1, 0); +  free_string(n1); +  } +     switch(n?n->token:0)    {    case F_CONSTANT:    tmp1=store_constant(&n->u.sval,    !(n->tree_info & OPT_EXTERNAL_DEPEND),    n->name);    if(TYPEOF(n->u.sval) == T_FUNCTION &&    SUBTYPEOF(n->u.sval) == FUNCTION_BUILTIN)    emit1(F_CALL_BUILTIN, (INT32)tmp1);    else    emit1(F_APPLY, (INT32)tmp1);    break;       default:    my_yyerror("docode: Failed to make call to %s",func);    }    free_node(n);   }    - static void emit_automap_marker(void) + static void emit_apply_builtin(char *func)   { -  if (master_object) { -  emit_apply_builtin("__builtin.automap_marker"); -  } else { -  emit_apply_builtin("_static_modules.Builtin.automap_marker"); +  low_emit_apply_builtin(func, NULL);   } -  +  + static void emit_automap_marker(int depth) + { +  struct compilation *c = THIS_COMPILATION; +  emit1(F_NUMBER, depth); +  +  /* NB: __builtin is not available without a full master. +  * In particular it is not available when compiling +  * the main master. +  */ +  low_emit_apply_builtin("__builtin.automap_marker", +  "_static_modules.Builtin.automap_marker");   }      static int do_encode_automap_arg_list(node *n,    int flags)   {    struct compilation *c = THIS_COMPILATION;    int stack_depth_save = current_stack_depth;    if(!n) return 0;    switch(n->token)    {
pike.git/src/docode.c:655:    {    int depth=0;    while(n->token == F_AUTO_MAP_MARKER)    {    n=CAR(n);    depth++;    }    emit0(F_MARK);    PUSH_CLEANUP_FRAME(do_pop_mark, 0);    code_expression(n, 0, "[*]"); -  emit1(F_NUMBER, depth); -  emit_automap_marker(); +  emit_automap_marker(depth);    POP_AND_DONT_CLEANUP;    return 1;    }    }   }      static void emit_builtin_svalue(char *func)   {    INT32 tmp1;    struct compilation *c = THIS_COMPILATION;
pike.git/src/docode.c:1634: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    if(tmp1 != 2)    Pike_fatal("HELP! FATAL INTERNAL COMPILER ERROR (1)\n");   #endif       PUSH_CLEANUP_FRAME(do_pop_mark, 0);    emit0(F_MARK);    PUSH_CLEANUP_FRAME(do_pop_mark, 0);    emit0(F_MARK);    emit0(F_LTOSVAL); -  emit1(F_NUMBER, depth); -  emit_automap_marker(); +  emit_automap_marker(depth);    POP_AND_DONT_CLEANUP;    emit_builtin_svalue("`+");    emit2(F_REARRANGE,1,1);    emit1(F_NUMBER, 1);    emit_apply_builtin("__automap__");    POP_AND_DONT_CLEANUP;       if(flags & DO_POP)    {    emit0(F_ASSIGN_AND_POP);
pike.git/src/docode.c:1700: Inside #if defined(PIKE_DEBUG)
  #ifdef PIKE_DEBUG    if(tmp1 != 2)    Pike_fatal("HELP! FATAL INTERNAL COMPILER ERROR (1)\n");   #endif       PUSH_CLEANUP_FRAME(do_pop_mark, 0);    emit0(F_MARK);    PUSH_CLEANUP_FRAME(do_pop_mark, 0);    emit0(F_MARK);    emit0(F_LTOSVAL); -  emit1(F_NUMBER, depth); -  emit_automap_marker(); +  emit_automap_marker(depth);    POP_AND_DONT_CLEANUP;    emit_builtin_svalue("`-");    emit2(F_REARRANGE,1,1);    emit1(F_NUMBER, 1);    emit_apply_builtin("__automap__");    POP_AND_DONT_CLEANUP;       if(flags & DO_POP)    {    emit0(F_ASSIGN_AND_POP);