pike.git / lib / master.pike.in

version» Context lines:

pike.git/lib/master.pike.in:1035:   #define AUTORELOAD_BEGIN() \    int ___newest=newest; \    newest=0      #define AUTORELOAD_CHECK_FILE(X) do { \    if(autoreload_on) \    if(Stat s=master_file_stat(X)) \    if(s->mtime>newest) newest=[int]s->mtime; \    } while(0)    + #define AUTORELOAD_CHECK_PRECOMPILED_FILE(X) do { \ +  if(autoreload_on) { \ +  int mtime = get_precompiled_mtime (X); \ +  if (mtime >= 0 && mtime > newest) \ +  if(s->mtime>newest) newest=[int]s->mtime; \ +  } \ +  } while(0) +    #define AUTORELOAD_FINISH(VAR, CACHE, FILE) \    if(autoreload_on) { \    mixed val = CACHE[FILE]; \    if(!zero_type (val) && val != no_value && \    newest <= load_time[FILE]) { \    VAR = val; \    } \    } \    load_time[FILE] = newest; \    if(___newest > newest) newest=___newest;
pike.git/lib/master.pike.in:1437:    foreach (fc; string path; mixed obj)    if (obj == no_value)    m_delete (fc, obj);    else    rev_fc[obj] = path;    }    return rev_fc[obj];   }      array(string) query_precompiled_names(string fname) + //! Returns identifiers (e.g. file names) of potentially precompiled + //! files in priority order.   { -  // Filenames of potential precompiled files in priority order. +    #ifdef PRECOMPILED_SEARCH_MORE    // Search for precompiled files in all module directories, not just    // in the one where the source file is. This is useful when running    // pike directly from the build directory.    fname = fakeroot (fname);    // FIXME: Not sure if this works correctly with the fakeroot and    // module relocation stuff.    foreach (pike_module_path, string path)    if (has_prefix (fname, path))    return map (pike_module_path, `+, "/", fname[sizeof (path)..], ".o");   #endif    return ({ fname + ".o" });   }    -  + int get_precompiled_mtime (string id) + //! Given an identifier returned by query_precompiled_names, returns + //! the mtime of the precompiled entry. Returns -1 if there is no + //! entry. + { +  Stat s = master_file_stat (fakeroot (id)); +  return s && s->isreg ? s->mtime : -1; + } +  + string read_precompiled (string id) + //! Given an identifier returned by query_precompiled_names, returns + //! the precompiled entry. Can assume the entry exists. + { +  return master_read_file (id); + } +    protected class CompileCallbackError   {    inherit _static_modules.Builtin.GenericError;    constant is_generic_error = 1;    constant is_compile_callback_error = 1;    constant is_cpp_or_compilation_error = 1;   }      protected void compile_cb_error (string msg, mixed ... args)   // Use this to throw errors that should be converted to plain compile
pike.git/lib/master.pike.in:1717:    resolv_debug ("low_findprog %s: returning cached (autoreload)\n", fname);    return ret;    }   #endif       switch(ext)    {    case "":    case ".pike":    foreach(query_precompiled_names(fname), string oname) { -  if(Stat s2=master_file_stat(fakeroot(oname))) -  { -  if(s2->isreg && s2->mtime >= s->mtime) -  { +  int o_mtime = get_precompiled_mtime (oname); +  if (o_mtime >= 0) { +  if (o_mtime >= s->mtime) {    mixed err=catch {    object|program decoded; -  AUTORELOAD_CHECK_FILE(oname); +  AUTORELOAD_CHECK_PRECOMPILED_FILE (oname);    resolv_debug ("low_findprog %s: decoding dumped\n", fname);    INC_RESOLV_MSG_DEPTH(); -  decoded = decode_value(master_read_file(oname), +  decoded = decode_value(read_precompiled (oname),    (handler && handler->get_codec ||    get_codec)(fname, mkobj, handler));    DEC_RESOLV_MSG_DEPTH();    resolv_debug ("low_findprog %s: dump decode ok\n", fname);    if (decoded && decoded->this_program_does_not_exist) {    resolv_debug ("low_findprog %s: program claims not to exist\n",    fname);    return programs[fname] = 0;    }    else {