pike.git / src / encode.c

version» Context lines:

pike.git/src/encode.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: encode.c,v 1.251 2008/02/02 21:39:44 grubba Exp $ + || $Id: encode.c,v 1.252 2008/02/06 12:38:17 grubba Exp $   */      #include "global.h"   #include "stralloc.h"   #include "pike_macros.h"   #include "object.h"   #include "constants.h"   #include "interpret.h"   #include "svalue.h"   #include "mapping.h"
pike.git/src/encode.c:430:    break;    }    }   }      static void zap_unfinished_program(struct program *p)   {    int e;    debug_malloc_touch(p);    if(p->flags & PROGRAM_FIXED) return; /* allow natural zapping */ +  debug_malloc_touch(p);    if(p->parent)    {    free_program(p->parent);    p->parent=0;    }    for(e=0;e<p->num_constants;e++)    {    free_svalue(& p->constants[e].sval);    mark_free_svalue (&p->constants[e].sval);    }
pike.git/src/encode.c:997:    if (!(val->u.program->flags & PROGRAM_FIXED))    Pike_error("Encoding of unfixated programs not supported.\n");    check_stack(1);    push_svalue(val);    apply(data->codec,"nameof", 1);    if(Pike_sp[-1].type == val->type)    Pike_error("Error in master()->nameof(), same type returned.\n");    if(Pike_sp[-1].type == T_INT && Pike_sp[-1].subtype == NUMBER_UNDEFINED)    {    struct program *p=val->u.program; +  debug_malloc_touch(p);    pop_stack();    if( (p->flags & PROGRAM_HAS_C_METHODS) || p->event_handler )    {    if(p->parent)    {    /* We have to remove ourselves from the cache for now */    struct svalue tmp = entry_id;    map_delete(data->encoded, val);       code_entry(TAG_PROGRAM, 2, data);
pike.git/src/encode.c:1385:    code_number(ref->id_flags, data);       /* inherit_offset */    code_number(ref->inherit_offset, data);       /* identifier_offset */    /* Find the corresponding identifier reference    * in the inherit. */    {    struct program *p2 = p->inherits[ref->inherit_offset].prog; +  debug_malloc_touch(p); +  debug_malloc_touch(p2);    int i;    for (i=0; i < p2->num_identifier_references; i++) {    struct reference *ref2 = p2->identifier_references + i;    if (!(ref2->inherit_offset) &&    !(ref2->id_flags & ID_HIDDEN) &&    (ref2->identifier_offset == ref->identifier_offset)) {    ref_no = i;    break;    }    }
pike.git/src/encode.c:2271:    case T_FUNCTION:    {    struct program *prog;    if (Pike_sp[-1].subtype == FUNCTION_BUILTIN) {    Pike_error("Failed to decode object type.\n");    }    prog = program_from_svalue(Pike_sp-1);    if (!prog) {    Pike_error("Failed to decode object type.\n");    } +  debug_malloc_touch(prog);    push_object_type_backwards(flag, prog->id);    }    break;       default:    Pike_error("Failed to decode type "    "(object(%s), expected object(zero|program)).\n",    get_name_of_type(Pike_sp[-1].type));    }    pop_stack();
pike.git/src/encode.c:2336:      /* This really needs to disable threads.... */   #define decode_type(X,data) do { \    type_stack_mark(); \    low_decode_type(data); \    (X)=pop_unfinished_type(); \   } while(0)      static void cleanup_new_program_decode (int *orig_compilation_depth)   { +  debug_malloc_touch(Pike_compiler->new_program);    end_first_pass(0);    compilation_depth = *orig_compilation_depth;   }      static void set_lex_pragmas(ptrdiff_t old_pragmas)   {    lex.pragmas = DO_NOT_WARN((INT32)old_pragmas);   }      static DECLSPEC(noreturn) void decode_error (struct svalue *decoding,
pike.git/src/encode.c:2398:    */   static INT32 decode_portable_bytecode(INT32 string_no)   {    struct program *p = Pike_compiler->new_program;    struct pike_string *bytecode;    struct pike_string *current_file=NULL;    INT32 current_line=0;    int e;    ONERROR err;    +  debug_malloc_touch(p);    if ((string_no < 0) || (string_no >= p->num_strings)) {    Pike_error("Bad bytecode string number: %d (expected 0 - %d).\n",    string_no, p->num_strings-1);    }       bytecode = p->strings[string_no];       if (bytecode->len % 3) {    Pike_error("Bad bytecode string length: "    "%"PRINTPTRDIFFT"d (expected multiple of 3).\n",
pike.git/src/encode.c:2863:    decode_error(NULL, Pike_sp - 1,    "Failed to decode function identifier. Got: ");       if (Pike_sp[-2].type == T_OBJECT &&    Pike_sp[-1].type == T_STRING &&    (p = Pike_sp[-2].u.object->prog)) {    int f = really_low_find_shared_string_identifier(    Pike_sp[-1].u.string,    p->inherits[Pike_sp[-2].subtype].prog,    SEE_STATIC|SEE_PRIVATE); +  debug_malloc_touch(p);    if (f >= 0) {    struct svalue func;    low_object_index_no_free(&func, Pike_sp[-2].u.object, f);   #ifdef PIKE_SECURITY    /* FIXME: Check access to the function. */   #endif -  +  debug_malloc_touch(p);    pop_n_elems(2);    *Pike_sp++ = func;    dmalloc_touch_svalue(Pike_sp-1);    break;    }    else if (data->pickyness) { -  +  debug_malloc_touch(p);    if (Pike_sp[-1].u.string->size_shift)    decode_error(NULL, Pike_sp - 2, "Couldn't find identifier in ");    else    decode_error(NULL, Pike_sp - 2, "Couldn't find identifier %s in ",    Pike_sp[-1].u.string->str);    } -  +  debug_malloc_touch(p);    }    pop_stack();    break;    }       default:    Pike_error("Function coding not compatible.\n");    break;    }   
pike.git/src/encode.c:2951:       fprintf (stderr, "Warning: Using old-style encoding\n");       EDB(2,fprintf(stderr, "%*sDecoding a program to <%d>: ",    data->depth, "", entry_id.u.integer);    print_svalue(stderr, &entry_id);    fputc('\n', stderr););       SETUP_DECODE_MEMOBJ(T_PROGRAM, program, p, low_allocate_program(),;);    +  debug_malloc_touch(p);    SET_ONERROR(err3, zap_unfinished_program, p);       if(data->pass == 1)    {   #if TWO_PASS_DECODE_WORKS    if(! data->supporter.prog)    data->supporter.prog = p;   #endif       debug_malloc_touch(p);
pike.git/src/encode.c:3615:    delayed_enc_val->u.program->flags != PROGRAM_VIRGIN) {    decode_error (NULL, delayed_enc_val,    "Didn't get program embryo "    "for delay encoded program <%"PRINTPIKEINT"d>: ",    entry_id.u.integer);    }    /* No new ref here; low_start_new_program will add one for    * Pike_compiler->new_program and we want ride on that one    * just like when it's created there. */    p = delayed_enc_val->u.program; +  debug_malloc_touch(p);    }    else    p = NULL;       /* We don't want to be affected by #pragma save_parent or    * __pragma_save_parent__.    */    lex.pragmas = (old_pragmas & ~ID_SAVE_PARENT)|ID_DONT_SAVE_PARENT;    SET_ONERROR(err2, set_lex_pragmas, (ptrdiff_t) old_pragmas);   
pike.git/src/encode.c:3653:       if (!delayed_enc_val) {    struct svalue prog;    prog.type=T_PROGRAM;    prog.u.program=p;    EDB(2,fprintf(stderr, "%*sDecoding a program to <%d>: ",    data->depth, "", entry_id.u.integer);    print_svalue(stderr, &prog);    fputc('\n', stderr););    mapping_insert(data->decoded, &entry_id, &prog); +  debug_malloc_touch(p);    }       debug_malloc_touch(p);       /* Check the version. */    decode_value2(data);    push_compact_version();    if(!is_eq(Pike_sp-1,Pike_sp-2))    Pike_error("Cannot decode programs encoded with other pike version.\n");    pop_n_elems(2);       debug_malloc_touch(p);       data->pickyness++;       /* parent */    decode_value2(data);    if (Pike_sp[-1].type == T_PROGRAM) {    p->parent = Pike_sp[-1].u.program; -  +  debug_malloc_touch(p->parent);    } else if ((Pike_sp[-1].type == T_INT) &&    (!Pike_sp[-1].u.integer)) {    p->parent = NULL;    } else {    Pike_error("Bad type for parent program (%s)\n",    get_name_of_type(Pike_sp[-1].type));    }    dmalloc_touch_svalue(Pike_sp-1);    Pike_sp--;