pike.git / src / program.c

version» Context lines:

pike.git/src/program.c:1:   /*   || 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: program.c,v 1.616 2007/05/26 19:14:59 mast Exp $ + || $Id: program.c,v 1.617 2007/09/04 16:45:15 grubba Exp $   */      #include "global.h"   #include "program.h"   #include "object.h"   #include "dynamic_buffer.h"   #include "pike_types.h"   #include "stralloc.h"   #include "las.h"   #include "lex.h"
pike.git/src/program.c:2013:    if (ref->inherit_offset != 0) continue;    override_identifier (ref, ID_FROM_PTR (p, ref)->name);    }       /* Ok, sort for binsearch */    for(e=i=0;i<(int)p->num_identifier_references;i++)    {    struct reference *funp;    struct identifier *fun;    funp=p->identifier_references+i; -  if(funp->id_flags & (ID_HIDDEN|ID_STATIC)) continue; +  if(funp->id_flags & ID_HIDDEN) continue;    fun=ID_FROM_PTR(p, funp);    if(funp->id_flags & ID_INHERITED)    {    int found_better=-1;    int funa_is_prototype;       if(funp->id_flags & ID_PRIVATE) continue;    funa_is_prototype = fun->func.offset == -1;   /* if(fun->func.offset == -1) continue; * prototype */       /* check for multiple definitions */    for(t=i+1;t<(int)p->num_identifier_references;t++)    {    struct reference *funpb;    struct identifier *funb;       funpb=p->identifier_references+t; -  if(funpb->id_flags & (ID_HIDDEN|ID_STATIC)) continue; +  if (funpb->id_flags & ID_HIDDEN) continue;    funb=ID_FROM_PTR(p,funpb);    /* if(funb->func.offset == -1) continue; * prototype */       if(fun->name==funb->name)    {    found_better=t;       /* FIXME: Is this stuff needed?    * It looks like it already is done by define_function(). -  +  * +  * Yes -- It's needed in case of mixin.    */    if(funa_is_prototype && (funb->func.offset != -1) &&    !(funp->id_flags & ID_INLINE))    {    funp->inherit_offset = funpb->inherit_offset;    funp->identifier_offset = funpb->identifier_offset;    }    if(!funa_is_prototype && funb->func.offset == -1)    {    funpb->inherit_offset = funp->inherit_offset;
pike.git/src/program.c:2063:    }    }    if(found_better!=-1)    continue;    }    if ((fun->func.offset == -1) && (funp->id_flags & ID_INLINE) &&    IDENTIFIER_IS_PIKE_FUNCTION(fun->identifier_flags)) {    my_yyerror("Missing definition for local function %S.",    fun->name);    } +  if (funp->id_flags & ID_STATIC) continue;    add_to_identifier_index(i);    }    fsort_program_identifier_index(p->identifier_index,    p->identifier_index +    p->num_identifier_index - 1,    p);          p->flags |= PROGRAM_FIXED;   
pike.git/src/program.c:2693: Inside #if defined(PIKE_DEBUG)
   fprintf(stderr,"All identifier references:\n");    for(e=0;e<(int)p->num_identifier_references;e++)    {    struct inherit *inh = INHERIT_FROM_INT(p,e);    fprintf(stderr,"%3d: ",e);    for(d=0;d<inh->inherit_level;d++) fprintf(stderr," ");    fprintf(stderr,"%-40s flags 0x%x",ID_FROM_INT(p,e)->name->str,    p->identifier_references[e].id_flags);    for (q = 0; q < p->num_inherits; q++)    if (p->inherits + q == inh) { -  fprintf (stderr, " inherit %d\n", q); +  fprintf(stderr, +  " inherit %d\n" +  " type: ", +  q); +  simple_describe_type(ID_FROM_INT(p, e)->type); +  fprintf(stderr, "\n");    goto inherit_found;    }    fprintf (stderr, " inherit not found!\n");    inherit_found:;    }    fprintf(stderr,"All sorted identifiers:\n");    for(q=0;q<(int)p->num_identifier_index;q++)    {    e=p->identifier_index[q];    fprintf(stderr,"%3d (%3d):",e,q);
pike.git/src/program.c:5042: Inside #if defined(PIKE_DEBUG)
   if ((lfun_type = low_mapping_string_lookup(lfun_types, name))) {   #ifdef PIKE_DEBUG    if (lfun_type->type != T_TYPE) {    Pike_fatal("Bad entry in lfun_types for key \"%s\"\n", name->str);    }   #endif /* PIKE_DEBUG */    if (!pike_types_le(type, lfun_type->u.type)) {    if (!match_types(type, lfun_type->u.type)) {    my_yyerror("Type mismatch for callback function %S:", name);    yytype_error(NULL, lfun_type->u.type, type, 0); +  Pike_fatal("Type mismatch!\n");    } else if (lex.pragmas & ID_STRICT_TYPES) {    yywarning("Type mismatch for callback function %S:", name);    yytype_error(NULL, lfun_type->u.type, type,    YYTE_IS_WARNING);    }    }    } else if ((name->len > 3) &&    (index_shared_string(name, 0) == '`') &&    (index_shared_string(name, 1) == '-') &&    (index_shared_string(name, 2) == '>')) {
pike.git/src/program.c:5652:   {    struct program_constant tmp;    volatile unsigned int e;       for(e=0;e<Pike_compiler->new_program->num_constants;e++)    {    JMP_BUF jmp;    if (SETJMP(jmp)) {    handle_compile_exception ("Error comparing constants.");    /* Assume that if `==() throws an error, the svalues aren't equal. */ +  } else { +  struct program_constant *c = Pike_compiler->new_program->constants+e; +  +  if (foo->type == c->sval.type) { +  /* Make sure only to compare within the same basic type. */ +  if (foo->type == T_OBJECT) { +  /* Special case objects -- We don't want stange LFUN effects... */ +  if ((foo->u.object == c->sval.u.object) && +  (foo->subtype == c->sval.subtype)) { +  UNSETJMP(jmp); +  return e;    } -  else { -  struct program_constant *c= Pike_compiler->new_program->constants+e; -  if((equal ? is_equal(& c->sval,foo) : is_eq(& c->sval,foo))) -  { +  } else if (foo->type == T_INT) { +  if (foo->u.integer == c->sval.u.integer) { +  if (foo->u.integer || (foo->subtype == c->sval.subtype)) {    UNSETJMP(jmp);    return e;    }    } -  +  } else if(equal ? is_equal(& c->sval,foo) : is_eq(& c->sval,foo)) {    UNSETJMP(jmp); -  +  return e;    } -  +  } +  } +  UNSETJMP(jmp); +  }    assign_svalue_no_free(&tmp.sval,foo);   #if 0    if((tmp.name=constant_name)) add_ref(constant_name);   #else /* !0 */    tmp.offset = -1;   #endif /* 0 */       add_to_constants(tmp);       return e;
pike.git/src/program.c:7594:       for(e=0;e<p->num_inherits;e++)    {    if(p->inherits[e].parent)    gc_cycle_check_object(p->inherits[e].parent, 0);       if(e && p->inherits[e].prog)    gc_cycle_check_program(p->inherits[e].prog, 0);    }    + #ifdef DEBUG_MALLOC +  for (e = 0; e < p->num_identifiers; e++) +  gc_cycle_check_type(p->identifiers[e].type, 0); + #endif +     /* Strong ref follows. It must be last. */    if(p->parent)    gc_cycle_check_program(p->parent, 0);    }    } GC_CYCLE_LEAVE;   }      static void gc_check_program(struct program *p)   {    int e;