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.668 2008/04/19 10:11:20 grubba Exp $ + || $Id: program.c,v 1.669 2008/04/19 13:52:45 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:2741:    dmfree(p->NAME); \    break; \    }   #include "program_areas.h"    } while(0);   #else /* PIKE_USE_MACHINE_CODE */    if(p->program) {    dmfree(p->program);    }   #endif /* PIKE_USE_MACHINE_CODE */ - #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) p->NAME=0; + #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) do { \ +  p->NAME=0; \ +  } while(0); +    #include "program_areas.h"    }else{   #ifdef PIKE_USE_MACHINE_CODE   #define BAR(NUMTYPE,TYPE,ARGTYPE,NAME) \ -  if(p->NAME) { mexec_free((char *)p->NAME); p->NAME=0; } +  if(p->NAME) { \ +  mexec_free((char *)p->NAME); p->NAME=0; \ +  }   #endif /* PIKE_USE_MACHINE_CODE */   #define FOO(NUMTYPE,TYPE,ARGTYPE,NAME) \ -  if(p->NAME) { dmfree((char *)p->NAME); p->NAME=0; } +  if(p->NAME) { \ +  dmfree((char *)p->NAME); p->NAME=0; \ +  }   #include "program_areas.h"    }       EXIT_PIKE_MEMOBJ(p);       GC_FREE(p);   }      #ifdef PIKE_DEBUG   void dump_program_desc(struct program *p)
pike.git/src/program.c:7266:    c->handler = NULL;    }    if(c->compat_handler) {    free_object(c->compat_handler);    c->compat_handler = NULL;    }    if(c->target) {    free_program(c->target);    c->target = NULL;    } +  if(c->p) { +  free_program(c->p); +  c->p = NULL; +  }    if(c->placeholder) {    free_object(c->placeholder);    c->placeholder = NULL;    }    if(c->lex.current_file) {    free_string(c->lex.current_file);    c->lex.current_file = NULL;    }    free_svalue(& c->default_module);    c->default_module.type = T_INT;
pike.git/src/program.c:7461:    debug_malloc_name(Pike_compiler->new_program, c->lex.current_file->str, 0);   #endif    }       CDFPRINTF((stderr, "th(%ld) %p run_pass1() done for %s\n",    (long)th_self(), Pike_compiler->new_program,    c->lex.current_file->str));       ret=unlink_current_supporter(& c->supporter);    -  c->p=end_first_pass(0); +  c->p=debug_malloc_pass(end_first_pass(0));       run_exit(c);       if(c->placeholder)    {    if(!c->p || (c->placeholder->storage))    {    debug_malloc_touch(c->placeholder);    zap_placeholder(c);    } else {
pike.git/src/program.c:7522:    verify_supporters();       do_yyparse(); /* Parse da program */       CDFPRINTF((stderr, "th(%ld) %p run_pass2() done for %s\n",    (long)th_self(), Pike_compiler->new_program,    c->lex.current_file->str));       verify_supporters();    -  c->p=end_program(); +  c->p=debug_malloc_pass(end_program());       run_exit(c);   }      static void run_cleanup(struct compilation *c, int delayed)   {    debug_malloc_touch(c);    debug_malloc_touch(c->placeholder);   #if 0 /* FIXME */    if (threads_disabled != c->saved_threads_disabled) {
pike.git/src/program.c:7653:       debug_malloc_touch(cc);      #ifdef PIKE_DEBUG    if(cc->supporter.dependants)    Pike_fatal("Que???\n");   #endif    if(cc->p) {    ok = finish;    free_program(cc->p); /* later */ +  cc->p = NULL;    }       CDFPRINTF((stderr, "th(%ld) %p delayed compile %s.\n",    (long) th_self(), cc->target, ok ? "done" : "failed"));       verify_supporters();       return ok;   }   
pike.git/src/program.c:7881:    *!    *! This function compiles the current Pike source code    *! into a clonable program.    *!    *! @seealso    *! @[compile_string()], @[compile_file()], @[cpp()], @[master()],    *! @[CompilationHandler], @[create()]    */   static void f_compilation_compile(INT32 args)   { -  struct pike_string *aprog; -  struct object *ahandler = NULL;/* error handler */ -  int amajor = -1; -  int aminor = -1; -  struct program *atarget = NULL; -  struct object *aplaceholder = NULL; +     int delay, dependants_ok = 1;    struct program *ret;   #ifdef PIKE_DEBUG    ONERROR tmp;   #endif    struct compilation *c = THIS_COMPILATION;       if (c->flags & COMPILER_BUSY) {    Pike_error("CompilationEnvironment in use.\n");    }
pike.git/src/program.c:7954:    UNSET_ONERROR(tmp);   #endif       if(delay)    {    CDFPRINTF((stderr, "th(%ld) %p compile() finish later, placeholder=%p.\n",    (long) th_self(), c->target, c->placeholder));    /* finish later */    verify_supporters();    /* We're hanging in the supporter. */ -  ret = c->p; +  ret = debug_malloc_pass(c->p);    }else{    /* finish now */    run_pass2(c);    debug_malloc_touch(c);    run_cleanup(c,0);    -  ret = c->p; +  ret = debug_malloc_pass(c->p);       debug_malloc_touch(c);       if (!dependants_ok) {    CDFPRINTF((stderr, "th(%ld) %p compile() reporting failure "    "since a dependant failed.\n",    (long) th_self(), c->target));    if (ret) free_program(ret);    throw_error_object(low_clone(compilation_error_program), 0, 0, 0,    "Compilation failed.\n");
pike.git/src/program.c:8279:    PIKE_MAP_VARIABLE("compat_handler", OFFSETOF(compilation, compat_handler),    tObj, PIKE_T_OBJECT, 0);    PIKE_MAP_VARIABLE("target", OFFSETOF(compilation, target),    tPrg(tObj), PIKE_T_PROGRAM, ID_HIDDEN);    PIKE_MAP_VARIABLE("placeholder", OFFSETOF(compilation, placeholder),    tObj, PIKE_T_PROGRAM, ID_HIDDEN);    PIKE_MAP_VARIABLE("p", OFFSETOF(compilation, p),    tPrg(tObj), PIKE_T_PROGRAM, ID_HIDDEN);    PIKE_MAP_VARIABLE("current_file", OFFSETOF(compilation, lex.current_file),    tStr, PIKE_T_STRING, ID_HIDDEN); +  PIKE_MAP_VARIABLE("default_module", OFFSETOF(compilation, default_module), +  tOr(tMap(tStr,tMix),tObj), PIKE_T_MIXED, 0);       /* end_class()/end_program() adds the parent_info storage once more.    * Remove the one we added above, so that we don't get it double.    */    p2->xstorage = 0;       end_class("PikeCompiler", 0);    /* end_class()/end_program() has zapped the inherit once again,    * so we need to repair the frame pointer.    */