diff --git a/uppsrc/CppBase/cpp.cpp b/uppsrc/CppBase/cpp.cpp index 49c28edca..9b95793cd 100644 --- a/uppsrc/CppBase/cpp.cpp +++ b/uppsrc/CppBase/cpp.cpp @@ -2,7 +2,7 @@ NAMESPACE_UPP -#define LTIMING(x) RTIMING(x) +#define LTIMING(x) // RTIMING(x) #define LLOG(x) // DLOG(x) void Cpp::ParamAdd(Vector& param, const char *s, const char *e) @@ -156,7 +156,7 @@ bool Cpp::Preprocess(const String& sourcefile, Stream& in, const String& current bool get_macros) { LLOG("===== Preprocess " << sourcefile << " <- " << currentfile); - LTIMING("Cpp::Preprocess"); + RTIMING("Cpp::Preprocess"); macro.Clear(); macro.Reserve(1000); segment_id.Clear(); @@ -192,6 +192,7 @@ bool Cpp::Preprocess(const String& sourcefile, Stream& in, const String& current void Cpp::DoFlatInclude(const String& header_path) { + RTIMING("DoFlatInclude"); LLOG("Flat include " << header_path); if(header_path.GetCount()) { const PPFile& pp = GetFlatPPFile(header_path); @@ -223,6 +224,7 @@ void Cpp::Do(const String& sourcefile, Stream& in, const String& currentfile, String current_folder = GetFileFolder(currentfile); bool notthefile = sourcefile != currentfile; if(notthefile || get_macros) { + RTIMING("DO2"); const PPFile& pp = GetPPFile(currentfile); for(int i = 0; i < pp.item.GetCount() && !done; i++) { const PPItem& m = pp.item[i]; @@ -268,7 +270,7 @@ void Cpp::Do(const String& sourcefile, Stream& in, const String& currentfile, namespaces = Join(namespace_stack, ";"); if(!get_macros) { - LTIMING("Expand"); + RTIMING("Expand"); incomment = false; prefix_macro.Clear(); StringBuffer result; diff --git a/uppsrc/CppBase/ppfile.cpp b/uppsrc/CppBase/ppfile.cpp index 801998c38..6f8a418d0 100644 --- a/uppsrc/CppBase/ppfile.cpp +++ b/uppsrc/CppBase/ppfile.cpp @@ -2,7 +2,7 @@ NAMESPACE_UPP -#define LTIMING(x) RTIMING(x) +#define LTIMING(x) // RTIMING(x) #define LLOG(x) // LOG(x) bool IsCPPFile(const String& path) @@ -394,12 +394,13 @@ Time GetFileTimeCached(const String& p) String GetIncludePath(const String& s, const String& filedir) { - LTIMING("GetIncludePath"); + RTIMING("GetIncludePath"); String key; - key << s << "#" << filedir << "#" << GetIncludePath(); + key << s << "#" << filedir; int q = sIncludePath.Find(key); if(q >= 0) return sIncludePath[q]; + RTIMING("GetIncludePath 2"); String p = GetIncludePath0(s, filedir); sIncludePath.Add(key, p); return p; @@ -407,11 +408,12 @@ String GetIncludePath(const String& s, const String& filedir) const PPFile& GetPPFile(const char *path) { + RTIMING("GetPPFile"); Time tm = GetFileTimeCached(path); PPFile& f = sPPfile.GetPut(path); if(f.filetime != tm) { f.filetime = tm; - LTIMING("PP read"); + RTIMING("PP read"); FileIn in(path); f.Parse(in); } @@ -423,14 +425,18 @@ bool IsSameFile(const String& f1, const String& f2) return NormalizePath(f1) == NormalizePath(f2); } -bool IncludesFile(const String& parent_path, const String& path, Index& visited) +bool IncludesFile0(const String& parent_path, const String& path, Index& visited) { - HITCOUNT("IncludesFile0"); + RHITCOUNT("IncludesFile0"); if(visited.Find(parent_path) >= 0) return false; visited.Add(parent_path); if(IsSameFile(parent_path, path)) return true; + { + RTIMING("GetPPFile"); + GetPPFile(parent_path); + } const PPFile& f = GetPPFile(parent_path); for(int i = 0; i < f.includes.GetCount(); i++) { String key = path + "#" + f.includes[i]; @@ -443,7 +449,7 @@ bool IncludesFile(const String& parent_path, const String& path, Index& else { HITCOUNT("IncludesFile getpath"); String p = GetIncludePath(f.includes[i], GetFileFolder(parent_path)); - bool b = p.GetCount() && IncludesFile(p, path, visited); + bool b = p.GetCount() && IncludesFile0(p, path, visited); sIncludes.Add(key, b); if(b) return true; @@ -454,9 +460,15 @@ bool IncludesFile(const String& parent_path, const String& path, Index& bool IncludesFile(const String& parent_path, const String& path) { - LTIMING("IncludesFile"); + RTIMING("IncludesFile"); Index visited; - return IncludesFile(parent_path, path, visited); + String key = path + "#" + parent_path; + int q = sIncludes.Find(key); + if(q >= 0) + return sIncludes[q]; + bool b = IncludesFile0(parent_path, path, visited); + sIncludes.Add(key, b); + return b; } void CreateFlatPP(PPFile& fp, const char *path, Index& visited) @@ -481,6 +493,7 @@ void CreateFlatPP(PPFile& fp, const char *path, Index& visited) const PPFile& GetFlatPPFile(const char *path, Index& visited) { + RTIMING("GetFlatPPFile"); LLOG("GetFlatPPFile " << path); int q = sFlatPP.Find(path); if(q >= 0) diff --git a/uppsrc/ide/Browser/Base.cpp b/uppsrc/ide/Browser/Base.cpp index 590150f92..347c733a1 100644 --- a/uppsrc/ide/Browser/Base.cpp +++ b/uppsrc/ide/Browser/Base.cpp @@ -195,7 +195,7 @@ String GetSourceFilePath(int file) bool CheckFile(const SourceFileInfo& f, const String& path) { - LTIMING("CheckFile"); + RTIMING("CheckFile"); LDUMP(f.time); LDUMP(FileGetTime(path)); if(f.time != FileGetTime(path)) diff --git a/uppsrc/ide/Browser/Iml.cpp b/uppsrc/ide/Browser/Iml.cpp index ad42f87db..301ace51d 100644 --- a/uppsrc/ide/Browser/Iml.cpp +++ b/uppsrc/ide/Browser/Iml.cpp @@ -32,7 +32,7 @@ String PreprocessImlFile(const char *fn) } catch(CParser::Error) {} - String r; + String r = "using Upp;"; r << "struct " << GetFileTitle(fn) << "Img {\n"; if(iml.GetCount()) r << "enum {" << i_ml << "};\n" << iml; diff --git a/uppsrc/ide/Browser/Sch.cpp b/uppsrc/ide/Browser/Sch.cpp index 342daf526..71f7f8edb 100644 --- a/uppsrc/ide/Browser/Sch.cpp +++ b/uppsrc/ide/Browser/Sch.cpp @@ -19,7 +19,8 @@ Vector PreprocessSchFile(const char *fn) { String s = LoadFile(fn); CParser p(s); - String r, rr; + String r = "using Upp;"; + String rr = "using Upp;"; String S_name; int line; while(!p.IsEof())