Return-Path: Delivered-To: apmail-harmony-commits-archive@www.apache.org Received: (qmail 94524 invoked from network); 7 Dec 2006 10:27:18 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 7 Dec 2006 10:27:18 -0000 Received: (qmail 63134 invoked by uid 500); 7 Dec 2006 10:27:26 -0000 Delivered-To: apmail-harmony-commits-archive@harmony.apache.org Received: (qmail 63088 invoked by uid 500); 7 Dec 2006 10:27:26 -0000 Mailing-List: contact commits-help@harmony.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@harmony.apache.org Delivered-To: mailing list commits@harmony.apache.org Received: (qmail 63067 invoked by uid 99); 7 Dec 2006 10:27:26 -0000 Received: from herse.apache.org (HELO herse.apache.org) (140.211.11.133) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Dec 2006 02:27:26 -0800 X-ASF-Spam-Status: No, hits=-9.4 required=10.0 tests=ALL_TRUSTED,NO_REAL_NAME X-Spam-Check-By: apache.org Received: from [140.211.11.3] (HELO eris.apache.org) (140.211.11.3) by apache.org (qpsmtpd/0.29) with ESMTP; Thu, 07 Dec 2006 02:27:15 -0800 Received: by eris.apache.org (Postfix, from userid 65534) id 4E03F1A9846; Thu, 7 Dec 2006 02:26:33 -0800 (PST) Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Subject: svn commit: r483406 - in /harmony/enhanced/drlvm/trunk/vm/jitrino/src: main/CompilationContext.cpp main/CompilationContext.h main/PMF.cpp main/PMF.h optimizer/escanalyzer.cpp optimizer/inliner.cpp Date: Thu, 07 Dec 2006 10:26:33 -0000 To: commits@harmony.apache.org From: varlax@apache.org X-Mailer: svnmailer-1.1.0 Message-Id: <20061207102633.4E03F1A9846@eris.apache.org> X-Virus-Checked: Checked by ClamAV on apache.org Author: varlax Date: Thu Dec 7 02:26:31 2006 New Revision: 483406 URL: http://svn.apache.org/viewvc?view=rev&rev=483406 Log: Applied HARMONY-2016 [drlvm][jit] Jitrino PMF Logger bugs. Tested on SUSE9 Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.h harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.h harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.cpp?view=diff&rev=483406&r1=483405&r2=483406 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.cpp Thu Dec 7 02:26:31 2006 @@ -33,10 +33,25 @@ static TlsStack ccTls; CompilationContext::CompilationContext(MemoryManager& _mm, CompilationInterface* ci, JITInstanceContext* _jitContext) -: mm(_mm), compilationInterface(ci), compilationFailed(false), compilationFinished(false) -, currentLogStreams(0), pipeline(0), stageId(0) +: mm(_mm), compilationInterface(ci), jitContext(_jitContext) { - jitContext = _jitContext; + init(); +} + +CompilationContext::CompilationContext(MemoryManager& _mm, CompilationInterface* ci, const CompilationContext* cc) +: mm(_mm), compilationInterface(ci), jitContext(cc->getCurrentJITContext()) +{ + init(); + pipeline = cc->pipeline; +} + +void CompilationContext::init() +{ + compilationFailed = compilationFinished = false; + currentLogStreams = 0; + pipeline = 0; + stageId = 0; + hirm = NULL; #ifdef _IPF_ #else @@ -56,7 +71,7 @@ ccTls.pop(); #endif } - + ProfilingInterface* CompilationContext::getProfilingInterface() const { return getCurrentJITContext()->getProfilingInterface(); } Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.h?view=diff&rev=483406&r1=483405&r2=483406 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.h (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/CompilationContext.h Thu Dec 7 02:26:31 2006 @@ -46,6 +46,7 @@ // Exists only during a compilation of method // This class uses destructor and must not be created on MemoryManager CompilationContext(MemoryManager& mm, CompilationInterface* ci, JITInstanceContext* jit); + CompilationContext(MemoryManager& mm, CompilationInterface* ci, const CompilationContext* cc); ~CompilationContext(); CompilationInterface* getVMCompilationInterface() const {return compilationInterface;} @@ -102,6 +103,7 @@ LogStreams* currentLogStreams; HPipeline* pipeline; + void init(); void initCompilationMode(); public: Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.cpp?view=diff&rev=483406&r1=483405&r2=483406 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.cpp Thu Dec 7 02:26:31 2006 @@ -165,7 +165,7 @@ } -static bool compare (Str* p, Str* q, size_t count) +static bool compare (const Str* p, const Str* q, size_t count) { for (; count != 0; --count, ++p, ++q) if (!(*p == *q)) @@ -185,7 +185,11 @@ static ostream& operator << (ostream& os, const Strs& fqn) { for (size_t n = 0; n != fqn.size(); ++n) - os << fqn[n] << '.'; + { + if (n != 0) + os << '.'; + os << fqn[n]; + } return os; } #endif @@ -691,7 +695,7 @@ ss.streamname = ltemplate.streamname; if (ss.substitute(ltemplate.fmask)) {// File name doesn't require compilation context (class or method name) - AutoUnlock(pmf.files); + AutoUnlock lock(*pmf.pfiles); assign(sx, ss.result, ss.rescount); } } @@ -710,13 +714,13 @@ for (size_t sx = 0; sx != nbos; ++sx) if ((lsp = streams[sx])->enabled) { - AutoUnlock(pmf.files); + AutoUnlock lock(*pmf.pfiles); if (lsp->releaseRef()) - pmf.files[lsp->fname] = 0; + (*pmf.pfiles)[lsp->fname] = 0; #ifdef _DEBUG_PMF_STREAMS cout << "LogStreams[" << threadnb << "] depth:" << depth << " idx:" << sx << " free '" << lsp->fname - << "' closed:" << (pmf.files[lsp->fname] == 0) + << "' closed:" << ((*pmf.pfiles)[lsp->fname] == 0) << endl; #endif } @@ -758,7 +762,7 @@ << endl; #endif // change stream - use new or reuse already open stream - AutoUnlock(pmf.files); + AutoUnlock lock(*pmf.pfiles); assign(sx, ss.result, ss.rescount); } else @@ -783,17 +787,17 @@ if (sstack->back() != 0) {// Return to the saved stream - AutoUnlock(pmf.files); + AutoUnlock lock(*pmf.pfiles); // If this file no longer needed, close it but remember its name. // Next time the file will be open, it will be open in append mode. if (lsp->releaseRef()) - pmf.files[lsp->fname] = 0; + (*pmf.pfiles)[lsp->fname] = 0; #ifdef _DEBUG_PMF_STREAMS cout << "LogStreams[" << threadnb << "] depth:" << depth << " idx:" << sx << " free '" << lsp->fname - << "' closed:" << (pmf.files[lsp->fname] == 0) + << "' closed:" << ((*pmf.pfiles)[lsp->fname] == 0) << endl; #endif streams[sx] = sstack->back(); @@ -822,8 +826,8 @@ const LogTemplate& ltemplate = pmf.getLogTemplates()[sx]; LogStream* lsp; - PMF::Files::iterator ptr = pmf.files.find(fname); - if (ptr == pmf.files.end() || ptr->second == 0) + PMF::Files::iterator ptr = pmf.pfiles->find(fname); + if (ptr == pmf.pfiles->end() || ptr->second == 0) {// There is no file open with this name. lsp = new (pmf.mm) LogStream(); @@ -834,14 +838,14 @@ lsp->mutexp = new (mm) Mutex(); lsp->append = ltemplate.append; - if (!ltemplate.append && ptr != pmf.files.end()) + if (!ltemplate.append && ptr != pmf.pfiles->end()) lsp->append = true; // the file was opened before lsp->enabled = lsp->pending_open = true; lsp->fname = new (mm) char[fnamesz]; memcpy(lsp->fname, fname, fnamesz); - pmf.files[lsp->fname] = lsp; + (*pmf.pfiles)[lsp->fname] = lsp; // Special case of rt stream - only the single instance of LogStream object can exist if (ltemplate.sid == LogStream::RT) @@ -850,7 +854,7 @@ #ifdef _DEBUG_PMF_STREAMS cout << "LogStreams[" << threadnb << "] depth:" << depth << " idx:" << sx << " new '" << lsp->fname - << "' seen before:" << (ptr != pmf.files.end()) + << "' seen before:" << (ptr != pmf.pfiles->end()) << endl; #endif } @@ -1044,7 +1048,7 @@ //------ PMF::Args implementation -------------------------------------------// -void PMF::Args::add (const char* key, const char* value, int strength, bool filterspec) +void PMF::Args::add (const char* key, const char* value, int strength, Cmd* cmdp) { Store::iterator end = store.end(), ptr = find(store.begin(), end, key); @@ -1054,14 +1058,14 @@ arg.key = key, arg.value = value; arg.strength = strength; - arg.filterspec = filterspec; + arg.cmdp = cmdp; store.push_back(arg); } else if (strength >= ptr->strength) { ptr->value = value, ptr->strength = strength; - ptr->filterspec = filterspec; + ptr->cmdp = cmdp; } } @@ -1367,11 +1371,16 @@ } +PMF::Files* PMF::pfiles = 0; + + PMF::PMF (MemoryManager& m, JITInstanceContext& jit) :initialized(false),mm(m), jitInstanceContext(jit) -,cmds(mm), logtemplates(mm), files(mm), pipelines(mm) +,cmds(mm), logtemplates(mm), pipelines(mm) { jitname.init(jitInstanceContext.getJITName().c_str()); + if (pfiles == 0) + pfiles = new (mm) Files(mm); } @@ -1626,7 +1635,7 @@ bool filterspec = false; if (step.args != 0) for (Args::Store::iterator m = step.args->store.begin(); m != step.args->store.end(); ++m) - if (m->filterspec) + if (!m->cmdp->filtername.empty()) { filterspec = true; break; @@ -1699,7 +1708,6 @@ for (size_t sid = 0; sid < step.logs->streamidxs.size(); ++sid) { size_t idx = step.logs->streamidxs.at(sid); - LogTemplate& lt = logtemplates.at(idx); cout << " sid#" << sid << " idx#" << idx << endl; @@ -1943,24 +1951,9 @@ for (StrTokenizer tokens('.', key, key + strlen(key)); tokens.next();) keys.push_back(tokens.token); - const Cmd* cmdp; - for (Cmds::const_iterator it = cmds.begin(); it != cmds.end(); ++it) - if ((cmdp = *it) != 0 && cmdp->arg) - { - if (hpipe == 0 || hpipe->name.empty()) - { - if (!cmdp->filtername.empty()) - continue; - } - else - { - if (cmdp->filtername.empty() || !(cmdp->filtername == hpipe->name)) - continue; - } - if (cmdp->left->size() - cmdp->xkeyword - 1 == keys.size()) - if (compare(&cmdp->left->at(cmdp->xkeyword + 1), &keys.at(0), keys.size())) - return cmdp->right.ptr; - } + const Cmd* cmdp = lookArg(hpipe, &keys[0], keys.size()); + if (cmdp != 0) + return cmdp->right.ptr; return 0; } @@ -1997,7 +1990,7 @@ //cout << "walk " << fqname << endl;; bool goon = (child.type != Pipeline::Alias::Child::DEFOFF); - Cmd* cmdp = lookArg(pipeline, fqname); + const Cmd* cmdp = lookArg(&pipeline, &fqname[0], fqname.size()); if (cmdp != 0) { if (cmdp->right == "on") @@ -2034,31 +2027,31 @@ } -PMF::Cmd* PMF::lookArg (Pipeline& pipeline, Strs& fqname) +const PMF::Cmd* PMF::lookArg (Pipeline* pipeline, const Str* fqname, size_t fqsize) const { - Cmd* cmdp = 0; + const Cmd* cmdp = 0; int sx = 0; - for (Cmds::iterator it = cmds.begin(); it != cmds.end(); ++it) + for (Cmds::const_iterator it = cmds.begin(); it != cmds.end(); ++it) if (*it != 0 && (*it)->arg) { - Cmd& cmd = **it; + const Cmd& cmd = **it; - if (pipeline.name.empty()) + if (pipeline == 0 || pipeline->name.empty()) { if (!cmd.filtername.empty()) continue; } else { - if (!cmd.filtername.empty() && !(cmd.filtername == pipeline.name)) + if (!cmd.filtername.empty() && !(cmd.filtername == pipeline->name)) continue; } - if (cmd.left->size() - cmd.xkeyword -1 != fqname.size()) + if (cmd.left->size() - cmd.xkeyword -1 != fqsize) continue; - if (!compare(&cmd.left->at(cmd.xkeyword+1), &fqname[0], fqname.size())) + if (!compare(&cmd.left->at(cmd.xkeyword+1), fqname, fqsize)) continue; int s = cmd.strength(); @@ -2125,7 +2118,7 @@ (*it)->showHelp(os); } - + void PMF::summTimes (SummTimes& summtimes) { Pipelines::iterator pptr = pipelines.begin(), @@ -2139,7 +2132,7 @@ } } - + //------ Pipeline implementation --------------------------------------------// @@ -2250,7 +2243,7 @@ const char* key = c_str(cmd.left->at(cmd.left->size() - 1)); const char* value = c_str(cmd.right); int strength = cmd.strength(cmd.left->size() - cmd.xkeyword - 1); - args->add(key, value, strength, !cmd.filtername.empty()); + args->add(key, value, strength, &cmd); } // all templates in scope for this step @@ -2267,10 +2260,14 @@ if (!(lt.filtername == pipeline->name)) continue; - if (lt.pathp->size() > fqname->size()) + const size_t pathsz = lt.pathp->size(); + + if (pathsz > fqname->size()) continue; - if (lt.pathp->size() != 0 && !compare(<.pathp->at(0), &fqname->at(0), lt.pathp->size())) + if (pathsz == 1 && lt.pathp->at(0) == factory->getName()) + ; + else if (pathsz != 0 && !compare(<.pathp->at(0), &fqname->at(0), lt.pathp->size())) continue; vector::iterator it, end = acts.end(); @@ -2281,7 +2278,7 @@ if (it == end) acts.push_back(<); else if (cmd_strength(false, !(*it)->filtername.empty(), (*it)->pathp->size()) - < cmd_strength(false, !lt.filtername.empty(), lt.pathp->size())) + < cmd_strength(false, !lt.filtername.empty(), pathsz)) *it = < // this definition is the strongest } Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.h URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.h?view=diff&rev=483406&r1=483405&r2=483406 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.h (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/main/PMF.h Thu Dec 7 02:26:31 2006 @@ -202,7 +202,7 @@ const char* key; const char* value; int strength; // relative strength of this argument - bool filterspec; // true if this argument is filter specific + Cmd* cmdp; bool operator == (const char* k) const {return strcmp(key, k) == 0;} }; @@ -212,7 +212,7 @@ Args (MemoryManager& mm) : store(mm) {} - void add (const char* key, const char* value, int strength, bool filterspec); + void add (const char* key, const char* value, int strength, Cmd*); const char* get (const char* key) const; }; @@ -224,7 +224,7 @@ Files (MemoryManager& mm) : FilesDictionary(mm) {} }; - Files files; + static Files* pfiles; public: @@ -283,7 +283,7 @@ void initStreams (); LogTemplate& lookStream (Str& streamname, Cmd* cmdp, size_t xpath, size_t xlog); void walk (Pipeline&, Pipeline::Alias*, Strs&); - Cmd* lookArg (Pipeline&, Strs&); + const Cmd* lookArg (Pipeline* pipeline, const Str* fqname, size_t fqsize) const; Pipeline* lookup (Str* filtername, bool create = false); public: @@ -339,7 +339,7 @@ JITInstanceContext& getJITInstanceContext () const {return jitInstanceContext;} void summTimes (SummTimes&); static Action* getAction (HPipeline, const char* path); - static void showHelp (std::ostream&); + static void showHelp (std::ostream&); HPipeline selectPipeline (const char* classname, const char* methname, const char* sig) const; Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp?view=diff&rev=483406&r1=483405&r2=483406 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/escanalyzer.cpp Thu Dec 7 02:26:31 2006 @@ -1905,7 +1905,7 @@ ci.setBCMapInfoRequired(false); } - CompilationContext inlineCC(irManager.getMemoryManager(), &ci, ci.getCompilationContext()->getCurrentJITContext()); + CompilationContext inlineCC(irManager.getMemoryManager(), &ci, ci.getCompilationContext()); inlineCC.setHIRManager(inlinedIRM); runTranslatorSession(inlineCC); Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp?view=diff&rev=483406&r1=483405&r2=483406 ============================================================================== --- harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp (original) +++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/inliner.cpp Thu Dec 7 02:26:31 2006 @@ -1115,7 +1115,6 @@ CompilationContext* cc = getCompilationContext(); MemoryManager& mm = cc->getCompilationLevelMemoryManager() ; CompilationInterface* ci = cc->getVMCompilationInterface(); - JITInstanceContext* jit = cc->getCurrentJITContext(); // Set up Inliner bool connectEarly = getBoolArg("connect_early", true); @@ -1128,8 +1127,7 @@ // Inline calls do { - CompilationContext inlineCC(mm, ci, jit); - inlineCC.setPipeline(cc->getPipeline()); + CompilationContext inlineCC(mm, ci, cc); InlineNode* regionNode = inliner.getNextRegionToInline(inlineCC); if (regionNode == NULL) { break;