From 264a0a31ce72908575cc676ff6e6e3f9e81a255d Mon Sep 17 00:00:00 2001 From: cxl Date: Sun, 17 May 2015 11:58:37 +0000 Subject: [PATCH] .cpp git-svn-id: svn://ultimatepp.org/upp/trunk@8456 f0d560ea-af0d-0410-9eb7-867de7ffcac7 --- uppsrc/CppBase/CppBase.h | 23 ++++- uppsrc/CppBase/CppBase.upp | 1 + uppsrc/CppBase/cpp.cpp | 195 +++-------------------------------- uppsrc/CppBase/ppfile.cpp | 32 ++++-- uppsrc/CppBase/srcfiles.cpp | 61 +++++++++++ uppsrc/ide/Browser/Base.cpp | 98 ++++++++++-------- uppsrc/ide/Browser/Browser.h | 6 +- uppsrc/ide/Browser/todo.txt | 52 ++++++++++ uppsrc/ide/ide.cpp | 5 + uppsrc/ide/ide.h | 2 + uppsrc/ide/idebar.cpp | 2 +- uppsrc/ide/idetool.cpp | 6 ++ uppsrc/ide/idewin.cpp | 4 + 13 files changed, 249 insertions(+), 238 deletions(-) create mode 100644 uppsrc/CppBase/srcfiles.cpp create mode 100644 uppsrc/ide/Browser/todo.txt diff --git a/uppsrc/CppBase/CppBase.h b/uppsrc/CppBase/CppBase.h index 23c8f048c..c76803a7c 100644 --- a/uppsrc/CppBase/CppBase.h +++ b/uppsrc/CppBase/CppBase.h @@ -93,9 +93,25 @@ String GetSegmentFile(int segment_id); const PPFile& GetPPFile(const char *path); +void InvalidateFileTimeCache(); +void InvalidateFileTimeCache(const String& path); +Time GetFileTimeCached(const String& path); + String GetIncludePath(const String& s, const String& filedir); bool IncludesFile(const String& parent_path, const String& header_path); -const PPFile& GetFlatPPFile(const char *path); // with #includes resolved + +struct FlatPP { + Index segment_id; + Index usings; + Index includes; +}; + +const FlatPP& GetFlatPPFile(const char *path); // with #includes resolved + +void ClearSources(); +const Index& GetAllSources(); +void GatherSources(const String& master_path, const String& path_); +String GetMasterFile(const String& file); struct Cpp { static Index kw; @@ -103,6 +119,8 @@ struct Cpp { bool incomment; bool done; + Index visited; + Index segment_id; // segments of included macros VectorMap macro; // macros defined int std_macros; // standard macros (keywords and trick - fixed) @@ -125,8 +143,7 @@ struct Cpp { void ParamAdd(Vector& param, const char *b, const char *e); String Expand(const char *s); void DoFlatInclude(const String& header_path); - void Do(const String& sourcefile, Stream& in, const String& currentfile, - Index& visited, bool get_macros); + void Do(const String& sourcefile, Stream& in, const String& currentfile, bool get_macros); bool Preprocess(const String& sourcefile, Stream& in, const String& currentfile, bool just_get_macros = false); diff --git a/uppsrc/CppBase/CppBase.upp b/uppsrc/CppBase/CppBase.upp index 06663c078..7df05bbf9 100644 --- a/uppsrc/CppBase/CppBase.upp +++ b/uppsrc/CppBase/CppBase.upp @@ -11,6 +11,7 @@ file ppconfig.cpp, macro.cpp, ppfile.cpp, + srcfiles.cpp, cpp.cpp, Pre.cpp, cpplex.cpp, diff --git a/uppsrc/CppBase/cpp.cpp b/uppsrc/CppBase/cpp.cpp index ddbefe6ae..230a0d428 100644 --- a/uppsrc/CppBase/cpp.cpp +++ b/uppsrc/CppBase/cpp.cpp @@ -155,8 +155,12 @@ void Cpp::DoFlatInclude(const String& header_path) RTIMING("DoFlatInclude"); LLOG("Flat include " << header_path); if(header_path.GetCount()) { + if(visited.Find(header_path) >= 0) + return; + visited.Add(header_path); const PPFile& pp = GetFlatPPFile(header_path); - LLOG("DoFlatInclude " << header_path << ", " << pp.item.GetCount() << " items"); + DLOG("DoFlatInclude " << header_path << ", " << pp.item.GetCount() << " items"); + RTIMING("DoFlatInclude2"); for(int i = 0; i < pp.item.GetCount(); i++) { const PPItem& m = pp.item[i]; if(m.type == PP_DEFINES) { @@ -169,12 +173,12 @@ void Cpp::DoFlatInclude(const String& header_path) usings << ";" << m.text; } } + for(int i = 0; i < pp.includes.GetCount(); i++) + visited.FindAdd(pp.includes[i]); } } -#if 0 -void Cpp::Do(const String& sourcefile, Stream& in, const String& currentfile, - Index& visited, bool get_macros) +void Cpp::Do(const String& sourcefile, Stream& in, const String& currentfile, bool get_macros) { if(visited.Find(currentfile) >= 0 || visited.GetCount() > 20000) return; @@ -195,9 +199,9 @@ void Cpp::Do(const String& sourcefile, Stream& in, const String& currentfile, if(m.type == PP_INCLUDE) { String s = GetIncludePath(m.text, current_folder); if(s.GetCount()) { - if(notthefile && IncludesFile(s, sourcefile)) { + if(notthefile && (s == sourcefile || IncludesFile(s, sourcefile))) { LLOG("Include IN " << s); - Do(sourcefile, in, s, visited, get_macros); + Do(sourcefile, in, s, get_macros); RHITCOUNT("Include IN"); } else { @@ -317,184 +321,13 @@ void Cpp::Do(const String& sourcefile, Stream& in, const String& currentfile, } done = true; } -#endif - -static String sReadCppName(CParser& p) -{ - String id; - for(;;) - if(p.IsId()) - id.Cat(p.ReadId()); - else - if(p.Char2(':', ':')) - id.Cat("::"); - else - break; - return id; -} - -void Cpp::Do(const String& sourcefile, Stream& in, const String& currentfile, - Index& visited, bool get_macros) -{ - if(visited.Find(currentfile) >= 0 || visited.GetCount() > 100) // TODO: Remove? - return; - visited.Add(currentfile); - String current_folder = GetFileFolder(currentfile); - bool finalfile = sourcefile == currentfile; - - if(finalfile) { // Need to recognize usings and namespaces - done = true; - CParser p(output); - DDUMP(output); - try { // TODO: Add grounding (to namespace level) - Vector namespace_block; - while(!p.IsEof()) { - int plvl = 0; - if(p.Id("using") && p.Id("namespace")) { - do { - String id = sReadCppName(p); - if(id.GetCount()) - namespace_using.FindAdd(id); - } - while(p.Char(',')); - } - else - if(p.Id("namespace")) { - String id = sReadCppName(p); - if(id.GetCount()) { - namespace_stack.Add(id); - namespace_block.Add(plvl); - } - } - else - if(p.Char('{')) - plvl++; - else - if(p.Char('}')) { - if(namespace_block.GetCount() && namespace_block.Top() == plvl) { - namespace_stack.Drop(); - namespace_block.Drop(); - } - plvl--; - } - else - p.SkipTerm(); - } - } - catch(CParser::Error) {} - namespaces = Join(namespace_stack, ";"); - DDUMP(namespace_stack); - DDUMP(namespace_using); - output.Clear(); - } - - RTIMING("Expand"); - incomment = false; - prefix_macro.Clear(); - output.Reserve(8192); - int lineno = 0; - bool incomment = false; - int segment_serial = 0; - segment_id.Add(--segment_serial); - -#ifdef IGNORE_ELSE - int ignore_else = 0; -#endif - - while(!in.IsEof()) { - String l = prefix_macro + in.GetLine(); - prefix_macro.Clear(); - lineno++; - int el = 0; - while(*l.Last() == '\\' && !in.IsEof()) { - el++; - l.Trim(l.GetLength() - 1); - l.Cat(in.GetLine()); - } - RemoveComments(l, incomment); - CParser p(l); - if(p.Char('#')) { - if(p.Id("define")) { - output.Cat(l + "\n"); - CppMacro m; - String id = m.Define(p.GetPtr()); - if(id.GetCount()) { - PPMacro& pp = macro.Add(id); - pp.macro = m; - pp.segment_id = segment_serial; - notmacro.Trim(kw.GetCount()); - } - } - else - if(p.Id("undef")) { - output.Cat(l + "\n"); - if(p.IsId()) { - segment_id.Add(--segment_serial); - PPMacro& m = macro.Add(p.ReadId()); - m.segment_id = segment_serial; - m.macro.SetUndef(); - notmacro.Trim(kw.GetCount()); - segment_id.Add(--segment_serial); - } - } - else { - output.Cat('\n'); - #ifdef IGNORE_ELSE - if(ignore_else) { - if(p.Id("if") || p.Id("ifdef") || p.Id("ifndef")) - ignore_else++; - else - if(p.Id("endif")) - ignore_else--; - } - else { - if(p.Id("else") || p.Id("elif")) - ignore_else = 1; - } - #endif - if(p.Id("include")) { - LTIMING("Expand include"); - String s = GetIncludePath(p.GetPtr(), current_folder); - DLOG("#include " << s); - if(s.GetCount()) { - DDUMP(IncludesFile(s, sourcefile)); - if(!finalfile && IncludesFile(s, sourcefile)) { - DLOG("Include IN " << s); - RHITCOUNT("Include IN"); - Do(sourcefile, in, s, visited, get_macros); - return; - } - else { - DLOG("Include FLAT " << s); - RHITCOUNT("Include FLAT"); - DoFlatInclude(s); - segment_id.Add(--segment_serial); - includes << ';' << s; - } - } - } - } - } - else { - LTIMING("Expand expand"); - #ifdef IGNORE_ELSE - if(ignore_else) - output.Cat('\n'); - else - #endif - output.Cat(Expand(l) + "\n"); - } - while(el--) - output.Cat("\n"); - } -} Index Cpp::kw; bool Cpp::Preprocess(const String& sourcefile, Stream& in, const String& currentfile, bool get_macros) { - DLOG("===== Preprocess " << sourcefile << " <- " << currentfile); + LLOG("===== Preprocess " << sourcefile << " <- " << currentfile); RTIMING("Cpp::Preprocess"); macro.Clear(); macro.Reserve(1000); @@ -525,8 +358,8 @@ bool Cpp::Preprocess(const String& sourcefile, Stream& in, const String& current done = false; incomment = false; output.Clear(); - Index visited; - Do(NormalizePath(sourcefile), in, NormalizePath(currentfile), visited, get_macros); + visited.Clear(); + Do(NormalizePath(sourcefile), in, NormalizePath(currentfile), get_macros); if(!done) output.Clear(); return done; @@ -557,7 +390,7 @@ String Cpp::GetIncludedMacroValues(const Vector& m) if(mm.GetCount()) r << '#' << m[i] << '\n' << mm << '\n'; } -#ifdef DEBUG +#ifdef _DEBUG return r; #else return MD5String(r); diff --git a/uppsrc/CppBase/ppfile.cpp b/uppsrc/CppBase/ppfile.cpp index 09f2b9fac..8a9290168 100644 --- a/uppsrc/CppBase/ppfile.cpp +++ b/uppsrc/CppBase/ppfile.cpp @@ -250,7 +250,6 @@ void PPFile::Parse(Stream& in) next_segment = true; m.type = type; m.text = id; - DLOG("namespace " << id); } } was_namespace = was_using = false; @@ -326,7 +325,6 @@ void PPFile::Dump() const DUMPC(includes); } -static VectorMap sPathFileTime; static VectorMap sIncludePath; static VectorMap sIncludes; static ArrayMap sFlatPP; @@ -334,7 +332,6 @@ static String sInclude_Path; void PPSync(const String& include_path) { - sPathFileTime.Clear(); sIncludePath.Clear(); sIncludes.Clear(); sFlatPP.Clear(); @@ -371,6 +368,18 @@ String GetIncludePath0(const char *s, const char *filedir) return Null; } +static VectorMap sPathFileTime; + +void InvalidateFileTimeCache() +{ + sPathFileTime.Clear(); +} + +void InvalidateFileTimeCache(const String& path) +{ + sPathFileTime.UnlinkKey(path); +} + Time GetFileTimeCached(const String& p) { LTIMING("GetFileTimeCached"); @@ -378,7 +387,7 @@ Time GetFileTimeCached(const String& p) if(q >= 0) return sPathFileTime[q]; Time m = FileGetTime(p); - sPathFileTime.Add(p, m); + sPathFileTime.Put(p, m); return m; } @@ -448,6 +457,7 @@ bool IncludesFile0(const String& parent_path, const String& path, Index& return false; } +#if 0 // TODO: remove? bool IncludesFile(const String& parent_path, const String& path) { RTIMING("IncludesFile"); @@ -481,29 +491,37 @@ void CreateFlatPP(PPFile& fp, const char *path, Index& visited) LLOG(LOG_END); } +#endif + const PPFile& GetFlatPPFile(const char *path, Index& visited) { RTIMING("GetFlatPPFile"); - LLOG("GetFlatPPFile " << path); + DLOG("GetFlatPPFile " << path); + LOGBEGIN(); int q = sFlatPP.Find(path); if(q >= 0) return sFlatPP[q]; - PPFile& fp = sFlatPP.Add(path); + FlatPP& fp = sFlatPP.Add(path); const PPFile& pp = GetPPFile(path); for(int i = 0; i < pp.item.GetCount(); i++) { const PPItem& m = pp.item[i]; if(m.type == PP_INCLUDE) { String s = GetIncludePath(m.text, GetFileFolder(path)); + DLOG("#include " << m.text << " -> " << s); if(s.GetCount() && visited.Find(s) < 0) { visited.Add(s); - const PPFile& pp = GetFlatPPFile(s, visited); + const FlatPP& pp = GetFlatPPFile(s, visited); for(int i = 0; i < pp.item.GetCount(); i++) fp.item.Add(pp.item[i]); + fp.includes.Add(s); + for(int i = 0; i < pp.includes.GetCount(); i++) + fp.includes.FindAdd(pp.includes[i]); } } else fp.item.Add(m); } + LOGEND(); return fp; } diff --git a/uppsrc/CppBase/srcfiles.cpp b/uppsrc/CppBase/srcfiles.cpp new file mode 100644 index 000000000..6a8e64830 --- /dev/null +++ b/uppsrc/CppBase/srcfiles.cpp @@ -0,0 +1,61 @@ +#include "CppBase.h" + +NAMESPACE_UPP + +#define LTIMING(x) RTIMING(x) + +static VectorMap sSrcFile; +static Index sIncludes; + +void ClearSources() +{ + sSrcFile.Clear(); + sIncludes.Clear(); +} + +const Index& GetAllSources() +{ + return sSrcFile.GetIndex(); +} + +void GatherSources(const String& master_path, const String& path_, Vector& parents) +{ + RHITCOUNT("GatherSources"); + String path = NormalizePath(path_); + if(sSrcFile.Find(path) >= 0) + return; + int ii = sSrcFile.GetCount(); + for(int i = 0; i < parents.GetCount(); i++) + sIncludes.Add(MAKEQWORD(parents[i], ii)); + sSrcFile.Add(path, master_path); + parents.Add(ii); + const PPFile& f = GetPPFile(path); + for(int i = 0; i < f.includes.GetCount(); i++) { + String p = GetIncludePath(f.includes[i], GetFileFolder(path)); + if(p.GetCount()) + GatherSources(master_path, p, parents); + } + parents.Drop(); +} + +void GatherSources(const String& master_path, const String& path) +{ + LTIMING("GatherSources"); + Vector parents; + GatherSources(master_path, path, parents); +} + +String GetMasterFile(const String& file) +{ + return sSrcFile.Get(file, Null); +} + +bool IncludesFile(const String& parent_path, const String& header_path) +{ + LTIMING("IncludesFile"); + int pi = sSrcFile.Find(parent_path); + int i = sSrcFile.Find(header_path); + return pi >= 0 && i >= 0 && sIncludes.Find(MAKEQWORD(pi, i)) >= 0; +} + +END_UPP_NAMESPACE diff --git a/uppsrc/ide/Browser/Base.cpp b/uppsrc/ide/Browser/Base.cpp index f095ef401..55154dead 100644 --- a/uppsrc/ide/Browser/Base.cpp +++ b/uppsrc/ide/Browser/Base.cpp @@ -8,14 +8,16 @@ #define LDUMP(x) // DDUMP(x) - -VectorMap sSrcFile; ArrayMap source_file; void SourceFileInfo::Serialize(Stream& s) { s % time % check_info % ids % included_id_macros % namespace_info % using_info % defined_macros % defined_namespace_info % includes; + if(s.IsLoading()) { + depends.Clear(); + depends_time = Null; + } } String CodeBaseCacheDir() @@ -136,27 +138,12 @@ void FinishCodeBase() Qualify(CodeBase()); } -void GatherSources(const String& master_path, const String& path_) -{ - RHITCOUNT("GatherSources"); - String path = NormalizePath(path_); - if(sSrcFile.Find(path) >= 0) - return; - sSrcFile.Add(path, master_path); - const PPFile& f = GetPPFile(path); - for(int i = 0; i < f.includes.GetCount(); i++) { - String p = GetIncludePath(f.includes[i], GetFileFolder(path)); - if(p.GetCount()) - GatherSources(master_path, p); - } -} - void BaseInfoSync(Progress& pi) { // clears temporary caches (file times etc..) PPSync(TheIde()->IdeGetIncludePath()); LTIMESTOP("Gathering files"); - sSrcFile.Clear(); + ClearSources(); const Workspace& wspc = GetIdeWorkspace(); LTIMING("Gathering files"); pi.SetText("Gathering files"); @@ -174,12 +161,7 @@ void BaseInfoSync(Progress& pi) } } - SweepPPFiles(sSrcFile.GetIndex()); -} - -String GetMasterFile(const String& file) -{ - return sSrcFile.Get(file, Null); + SweepPPFiles(GetAllSources()); } int GetSourceFileIndex(const String& path) @@ -194,29 +176,56 @@ String GetSourceFilePath(int file) return source_file.GetKey(file); } -bool CheckFile(const SourceFileInfo& f, const String& path) +Index sTimePath; + +Time GetDependsTime(const Vector& file) +{ + RTIMING("CreateTimePrint"); + static Index path; + String r; + Time tm = Time::Low(); + for(int i = 0; i < file.GetCount(); i++) + if(file[i] < sTimePath.GetCount()) + tm = max(tm, GetFileTimeCached(sTimePath[file[i]])); + return tm; +} + +bool CheckFile(SourceFileInfo& f, const String& path) { RTIMING("CheckFile"); LDUMP(f.time); LDUMP(FileGetTime(path)); - if(f.time != FileGetTime(path)) { - DLOG("Wrong time: " << path); + if(f.time != FileGetTime(path)) return false; - } if(!f.check_info) return true; + if(!IsNull(f.depends_time) && f.depends_time == GetDependsTime(f.depends)) + return true; Cpp pp; FileIn in(path); pp.Preprocess(path, in, GetMasterFile(path), true); + DLOG("CheckFile " << path); + DDUMP(f.ids.GetKeys()); String included_id_macros = pp.GetIncludedMacroValues(f.ids.GetKeys()); - LDUMP(included_id_macros); - LDUMP(f.included_id_macros); + DDUMP(included_id_macros); +#ifdef _DEBUG if(f.included_id_macros != included_id_macros) { - DLOG("Other reason: " << path); - DDUMP(f.included_id_macros); - DDUMP(included_id_macros); + LLOG("Other reason: " << path); + LDUMP(f.included_id_macros); + LDUMP(included_id_macros); } - return f.included_id_macros == included_id_macros; +#endif + if(f.included_id_macros != included_id_macros) { + f.depends_time = Null; + f.depends.Clear(); + return false; + } + + RTIMING("VISITED ADD"); + for(int i = 0; i < pp.visited.GetCount(); i++) + f.depends.Add(sTimePath.FindAdd(pp.visited[i])); + f.depends_time = GetDependsTime(f.depends); + return true; } void ParseFiles(Progress& pi, const Index& parse_file) @@ -241,20 +250,22 @@ void UpdateCodeBase2(Progress& pi) const Workspace& wspc = GetIdeWorkspace(); pi.SetText("Checking source files"); - pi.SetTotal(sSrcFile.GetCount()); pi.SetPos(0); Index keep_file; Index parse_file; - for(int i = 0; i < sSrcFile.GetCount(); i++) { + const Index& src = GetAllSources(); + pi.SetTotal(src.GetCount()); + for(int i = 0; i < src.GetCount(); i++) { pi.Step(); - String path = sSrcFile.GetKey(i); + String path = src[i]; int q = GetSourceFileIndex(path); - const SourceFileInfo& f = source_file[q]; - LLOG("== CHECK == " << q << ": " << path); + SourceFileInfo& f = source_file[q]; + DLOG("== CHECK == " << q << ": " << path); if(CheckFile(f, path)) keep_file.Add(q); else { LLOG("PARSE!"); + DLOG("PARSE: " << path); parse_file.Add(q); } } @@ -369,6 +380,7 @@ void CodeBaseScanFile(Stream& in, const String& fn, bool check_macros) { LLOG("===== CodeBaseScanFile " << fn); + InvalidateFileTimeCache(fn); PPSync(TheIde()->IdeGetIncludePath()); LTIMING("CodeBaseScan"); @@ -434,7 +446,7 @@ void SyncCodeBase() { LTIMING("SyncCodeBase"); LTIMESTOP("SyncCodeBase"); - DLOG("============= Sync code base"); + LLOG("============= Sync code base"); Progress pi; pi.Title("Parsing source files"); UpdateCodeBase(pi); @@ -448,11 +460,11 @@ void NewCodeBase() if(start) return; start++; LoadCodeBase(); - LOG("NewCodeBase loaded " << CodeBase().GetCount()); + LLOG("NewCodeBase loaded " << CodeBase().GetCount()); SyncCodeBase(); - LOG("NewCodeBase synced " << CodeBase().GetCount()); + LLOG("NewCodeBase synced " << CodeBase().GetCount()); SaveCodeBase(); - LOG("NewCodeBase saved " << CodeBase().GetCount()); + LLOG("NewCodeBase saved " << CodeBase().GetCount()); start--; } diff --git a/uppsrc/ide/Browser/Browser.h b/uppsrc/ide/Browser/Browser.h index f293df48a..16be4570f 100644 --- a/uppsrc/ide/Browser/Browser.h +++ b/uppsrc/ide/Browser/Browser.h @@ -16,8 +16,6 @@ class Browser; -String GetMasterFile(const String& file); - CppBase& CodeBase(); struct SourceFileInfo { @@ -30,10 +28,12 @@ struct SourceFileInfo { VectorMap defined_macros; // macros defined by the file (to detect changes) String defined_namespace_info; // set of usings and namespaces in the file (to detect changes) String includes; // includes in the file (to detect changes) + Vector depends; // indicies of file this files depends on, for time-check + Time depends_time; void Serialize(Stream& s); - SourceFileInfo() { time = Null; check_info = false; } + SourceFileInfo() { time = Null; check_info = false; depends_time = Null; } }; void NewCodeBase(); diff --git a/uppsrc/ide/Browser/todo.txt b/uppsrc/ide/Browser/todo.txt new file mode 100644 index 000000000..c4c97cdca --- /dev/null +++ b/uppsrc/ide/Browser/todo.txt @@ -0,0 +1,52 @@ +TIMING IncludesFile : 2.75 ms - 746.50 ns ( 3.00 ms / 3688 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 3688 +TIMING GetUsedMacroValues: 242.82 ms - 92.54 us (243.00 ms / 2624 ), min: 0.00 ns, max: 2.00 ms, nesting: 1 - 2624 +TIMING GetFlatPPFile : 59.65 ms - 11.43 us (60.00 ms / 5220 ), min: 0.00 ns, max: 8.00 ms, nesting: 16 - 6836 +TIMING DoFlatInclude : 1.04 s - 198.59 us ( 1.04 s / 5220 ), min: 0.00 ns, max: 8.00 ms, nesting: 1 - 5220 +HITCOUNT Include FLAT: hit count = 5220 +TIMING DO2 : 1.08 s - 411.14 us ( 1.08 s / 2624 ), min: 0.00 ns, max: 8.00 ms, nesting: 1 - 2624 +TIMING Cpp::Preprocess: 1.46 s - 555.95 us ( 1.46 s / 2624 ), min: 0.00 ns, max: 8.00 ms, nesting: 1 - 2624 +TIMING CheckFile : 2.34 s - 879.45 us ( 2.34 s / 2656 ), min: 0.00 ns, max: 8.00 ms, nesting: 1 - 2656 +TIMING GetIncludePath 2: 399.84 ms - 167.72 us (400.00 ms / 2384 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 2384 +TIMING GetIncludePath : 438.06 ms - 31.22 us (439.00 ms / 14032 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 14032 +TIMING GetPPFile : 159.54 ms - 23.45 us (160.00 ms / 6804 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 6804 +HITCOUNT GatherSources: hit count = 5988 +TIMING GatherSources : 604.89 ms - 362.64 us (605.00 ms / 1668 ), min: 0.00 ns, max: 111.00 ms, nesting: 18 - 5988 +TIMING FileGetTime : 391.49 ms - 51.53 us (392.00 ms / 7598 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 7598 +=========================== +TIMING Expand : 1.50 s - 11.73 ms ( 1.50 s / 128 ), min: 0.00 ns, max: 801.00 ms, nesting: 1 - 128 +HITCOUNT IncludesFile cached: hit count = 270819 +HITCOUNT IncludesFile getpath: hit count = 237840 +TIMING GetPPFile : 581.12 ms - 2.54 us (596.00 ms / 228534 ), min: 0.00 ns, max: 3.00 ms, nesting: 1 - 228534 +HITCOUNT Include IN: hit count = 7294 +HITCOUNT IncludesFile0: hit count = 255333 +TIMING IncludesFile : 5.51 s - 114.39 us ( 5.52 s / 48201 ), min: 0.00 ns, max: 17.00 ms, nesting: 1 - 48201 +TIMING GetUsedMacroValues: 235.86 ms - 112.53 us (236.00 ms / 2096 ), min: 0.00 ns, max: 2.00 ms, nesting: 1 - 2096 +TIMING GetFlatPPFile : 77.09 ms - 1.73 us (80.00 ms / 44688 ), min: 0.00 ns, max: 7.00 ms, nesting: 16 - 45900 +TIMING DoFlatInclude : 925.09 ms - 20.69 us (928.00 ms / 44705 ), min: 0.00 ns, max: 8.00 ms, nesting: 1 - 44705 +HITCOUNT Include FLAT: hit count = 44567 +TIMING DO2 : 8.14 s - 3.88 ms ( 8.14 s / 2096 ), min: 0.00 ns, max: 802.00 ms, nesting: 17 - 9172 +TIMING Cpp::Preprocess: 8.45 s - 4.03 ms ( 8.45 s / 2096 ), min: 0.00 ns, max: 802.00 ms, nesting: 1 - 2096 +TIMING CheckFile : 7.48 s - 3.75 ms ( 7.48 s / 1992 ), min: 0.00 ns, max: 18.00 ms, nesting: 1 - 1992 +TIMING GetIncludePath 2: 275.88 ms - 154.30 us (276.00 ms / 1788 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 1788 +TIMING GetIncludePath : 697.10 ms - 2.28 us (717.00 ms / 305613 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 305613 +TIMING GetPPFile : 1.16 s - 2.46 us ( 1.19 s / 469375 ), min: 0.00 ns, max: 3.00 ms, nesting: 1 - 469375 +HITCOUNT GatherSources: hit count = 4491 +TIMING GatherSources : 412.92 ms - 330.07 us (413.00 ms / 1251 ), min: 0.00 ns, max: 81.00 ms, nesting: 18 - 4491 +TIMING FileGetTime : 324.56 ms - 47.59 us (325.00 ms / 6820 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 6820 +====================== +TIMING IncludesFile : 48.75 ms - 573.26 ns (54.00 ms / 85038 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 85038 +HITCOUNT Include IN: hit count = 14508 +TIMING GetUsedMacroValues: 498.76 ms - 126.72 us (499.00 ms / 3936 ), min: 0.00 ns, max: 2.00 ms, nesting: 1 - 3936 +TIMING DoFlatInclude2 : 1.88 s - 31.30 us ( 1.88 s / 59952 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 59952 +TIMING GetFlatPPFile : 180.30 ms - 3.01 us (184.00 ms / 59952 ), min: 0.00 ns, max: 9.00 ms, nesting: 16 - 62376 +TIMING DoFlatInclude : 2.35 s - 29.15 us ( 2.35 s / 80436 ), min: 0.00 ns, max: 11.00 ms, nesting: 1 - 80436 +HITCOUNT Include FLAT: hit count = 80436 +TIMING DO2 : 2.75 s - 697.85 us ( 2.75 s / 3936 ), min: 0.00 ns, max: 11.00 ms, nesting: 17 - 17970 +TIMING Cpp::Preprocess: 3.33 s - 844.96 us ( 3.33 s / 3936 ), min: 0.00 ns, max: 11.00 ms, nesting: 1 - 3936 +TIMING CheckFile : 4.74 s - 1.19 ms ( 4.74 s / 3984 ), min: 0.00 ns, max: 11.00 ms, nesting: 1 - 3984 +TIMING GetIncludePath 2: 598.78 ms - 167.44 us (599.00 ms / 3576 ), min: 0.00 ns, max: 2.00 ms, nesting: 1 - 3576 +TIMING GetIncludePath : 781.26 ms - 6.23 us (789.00 ms / 125388 ), min: 0.00 ns, max: 3.00 ms, nesting: 1 - 125388 +TIMING GetPPFile : 266.50 ms - 10.99 us (268.00 ms / 24240 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 24240 +HITCOUNT GatherSources: hit count = 8982 +TIMING GatherSources : 1.01 s - 403.62 us ( 1.01 s / 2502 ), min: 0.00 ns, max: 137.00 ms, nesting: 1 - 2502 +TIMING FileGetTime : 516.36 ms - 50.15 us (517.00 ms / 10297 ), min: 0.00 ns, max: 1.00 ms, nesting: 1 - 10297 diff --git a/uppsrc/ide/ide.cpp b/uppsrc/ide/ide.cpp index cb7ae0483..79d6a6553 100644 --- a/uppsrc/ide/ide.cpp +++ b/uppsrc/ide/ide.cpp @@ -363,6 +363,11 @@ void Ide::Deactivate() } } +void Ide::Activate() +{ + InvalidateFileTimeCache(); +} + bool Ide::Key(dword key, int count) { dword *k = IdeKeys::AK_DELLINE().key; if(key == k[0] || key == k[1]) { diff --git a/uppsrc/ide/ide.h b/uppsrc/ide/ide.h index eda6355c2..85fa7f9ea 100644 --- a/uppsrc/ide/ide.h +++ b/uppsrc/ide/ide.h @@ -330,6 +330,7 @@ public: virtual bool FileRemove(); virtual void DragAndDrop(Point p, PasteClip& d); virtual void Deactivate(); + virtual void Activate(); virtual void Layout(); virtual void PutConsole(const char *s); @@ -870,6 +871,7 @@ public: void Abbreviations(); void BrowseMenu(Bar& menu); + void CheckCodeBase(); void RescanCode(); void QueryId(); void OpenTopic(const String& topic, const String& createafter, bool before); diff --git a/uppsrc/ide/idebar.cpp b/uppsrc/ide/idebar.cpp index 1eb74461d..d43d85242 100644 --- a/uppsrc/ide/idebar.cpp +++ b/uppsrc/ide/idebar.cpp @@ -577,7 +577,7 @@ void Ide::BrowseMenu(Bar& menu) menu.Add(!designer, AK_ABBR, callback(&editor, &AssistEditor::Abbr)); menu.Add(!designer, "Insert", THISBACK(InsertMenu)); menu.MenuSeparator(); - menu.Add("Check source files for changes", callback(SyncCodeBase)); + menu.Add("Check source files for changes", THISBACK(CheckCodeBase)); menu.Add("Reparse source files", THISBACK(RescanCode)); menu.MenuSeparator(); } diff --git a/uppsrc/ide/idetool.cpp b/uppsrc/ide/idetool.cpp index 87c39f626..3ca205f1c 100644 --- a/uppsrc/ide/idetool.cpp +++ b/uppsrc/ide/idetool.cpp @@ -60,6 +60,12 @@ void Ide::GotoCpp(const CppItem& pos) GotoPos(GetSourceFilePath(pos.file), pos.line); } +void Ide::CheckCodeBase() +{ + InvalidateFileTimeCache(); + SyncCodeBase(); +} + void Ide::RescanCode() { /* diff --git a/uppsrc/ide/idewin.cpp b/uppsrc/ide/idewin.cpp index d0dcf0a13..e9c612d28 100644 --- a/uppsrc/ide/idewin.cpp +++ b/uppsrc/ide/idewin.cpp @@ -724,6 +724,10 @@ void AppMain___() bool firstinstall = false; +#ifdef _DEBUG + SetVppLogSizeLimit(100000000); +#endif + #ifdef PLATFORM_POSIX LoadUpdaterCfg();