Commit Graph

151 Commits

Author SHA1 Message Date
Oswald Buddenhagen
aa61af1493 make the evaluator (even more) thread-safe
the async re-parsing code breaks the assumption that project
parsing only ever starts with a single non-concurrent evaluation
(of the top-level project file), so the population of the base
values in the shared ProFileOption was happily causing crashes.

Reviewed-by: dt
Task-number: QTCREATORBUG-1569
2010-06-04 17:57:04 +02:00
Oswald Buddenhagen
f269f86982 don't double-expand for() arguments
unlike in qmake, the arguments are already expanded at this point
(which is strictly speaking a bug for the iterator variable name),
so it is plain wrong to call doVariableReplace on them.
2010-04-20 12:02:10 +02:00
Oswald Buddenhagen
2af6e73c59 avoid detaching
amazingly enough, qlist::{first,last}() have non-const versions,
which are of course used when you least expect it ...
2010-04-20 12:02:10 +02:00
Oswald Buddenhagen
f26019bed8 fix location info in parsing-error messages 2010-04-20 12:02:10 +02:00
dt
9663067357 Fix deadlock in .pro file evaluation.
We used to indicate that the cache for a file is up to date by having a
Entry with ent->locker == 0. But we first wake up all threads and only
after all the threads who waited for that parse to complete we set
ent->locker to zero. Thus a different thread could get the impression
that it needs to wait for the parse thread, yet get no wake up.

We need a different flag to indicate that we are actually already done
parsing and the cache can simply be used instead of waiting for a wake
up.

Reviewed-By: ossi
2010-03-17 16:27:50 +01:00
hjk
9595504bda Long live the king! 2010-03-05 11:28:13 +01:00
Oswald Buddenhagen
e22e8035c6 make profile cache thread safe
Reviewed-by: thiago
2010-02-26 13:09:20 +01:00
Oswald Buddenhagen
66780cf198 cache failed parses as well 2010-02-26 13:09:20 +01:00
Oswald Buddenhagen
8bb90d47bd fix include() parseInto implementation
the "namespace" created by the prefix is supposed to be cleared before
new values are added.
2010-02-15 17:14:25 +01:00
Oswald Buddenhagen
1d39b04041 add legacy variable name mapping
we are so fast now, we can burn a few cycles again ... :}

variable names are mapped as soon as they become known (and not when
using them). that sprinkles map() calls everywhere, but it's faster.
2010-02-12 14:32:20 +01:00
Oswald Buddenhagen
6060bb5b9e cut down code dupe in count() impl 2010-02-12 14:32:20 +01:00
Oswald Buddenhagen
081f27e3ea process second arg of include() 2010-02-12 14:32:20 +01:00
Oswald Buddenhagen
07abc847e8 expand $()-style env vars in some more places like qmake does
Task-number: QTCREATORBUG-229
2010-02-12 14:32:20 +01:00
Oswald Buddenhagen
35bc0f3609 simplify exists() implementation 2010-02-12 14:32:20 +01:00
Oswald Buddenhagen
5d0f65fc91 don't assert on $$files(/foo) 2010-02-10 16:20:41 +01:00
Oswald Buddenhagen
caedef35e2 fix conditionals on the qmakespec
- match just the spec name without a possible path
- resolve the default spec
2010-02-10 15:40:53 +01:00
Oswald Buddenhagen
e0e4c4d3bf properly evaluate one-arg-variant of CONFIG() 2010-02-10 15:40:53 +01:00
Oswald Buddenhagen
46bc5a80ac make $$files() qmake-compliant again
unfortunately, the efforts to use only absolute paths internally became
externally visible ...
2010-02-10 15:40:53 +01:00
Oswald Buddenhagen
0e6fe766dd optimize function scoping
previously, the entire value hash was simply pushed on a stack upon
entering a custom function. the problem with that was that setting the
function's argument already detached (i.e., copied) the entire hash.
so instead store only actually modified values in nested scopes and let
lookups cascade to parent scopes.

improvement: 2% for qt, 15% for creator ...
2010-02-09 20:48:34 +01:00
Oswald Buddenhagen
62270c1c5b do not scope the per-file variable values
it is extremely unlikely that a function would change one of the
interesting variables (all types of source file lists) but not re-export
them subsequently. thus the scoping only complicates matters and burns
cpu cycles.

we ignore the tiny possibility that this could illegitimately reset a
list while doing exact parsing - the subsequent cumulative parsing would
most likely catch these files again anyway.
2010-02-09 20:48:33 +01:00
Oswald Buddenhagen
de3d24741d simplify parameter passing to insertUnique and removeEach 2010-02-09 20:48:33 +01:00
Oswald Buddenhagen
bc4e63a310 simplify returning per-file variable values
these values do not require evaluating magic variables. the semantics
would be totally unclear anyway.
2010-02-09 20:48:33 +01:00
Oswald Buddenhagen
4c9aca0cfc optimization: turn more constants into global statics 2010-02-08 17:24:18 +01:00
Oswald Buddenhagen
1f088a70ba make profile evaluator re-entrant
the last step was moving the statics to a common class which is
initialized at startup.
2010-02-08 17:24:18 +01:00
Oswald Buddenhagen
a4e4c44ac2 re-entrancy: $$list() counter cannot be static 2010-02-08 17:24:18 +01:00
Oswald Buddenhagen
cfa6203e52 BlockCursor was meant to be a Q_MOVABLE_TYPE ... 2010-02-08 17:24:18 +01:00
Kai Koehne
6c4b9ba227 Reapply unconnected changes from reverted commit
Only revert stuff that is linked to fast string concat.
2010-02-08 11:13:55 +01:00
Kai Koehne
999c73ad9d Revert "compile everything with QT_USE_FAST_CONCATENATION"
This reverts commit e70530c5ad. It
did break builds on older gcc versions (gcc 4.1.2 64 bit Linux,
gcc 4.0.1 on Mac OS X):

parser/qmljsgrammar_p.h: In static member function ???static int
QmlJSGrammar::nt_action(int, int)???:
parser/qmljsgrammar_p.h:188: error: ???QmlJSGrammar::<anonymous enum>???
is/uses anonymous type
parser/qmljsgrammar_p.h:188: error:   trying to instantiate
???template<class T> struct QConcatenable???
...
2010-02-08 10:56:50 +01:00
Oswald Buddenhagen
7cdb15e7fc try hard to ensure that feature paths are absolute 2010-02-05 19:25:43 +01:00
Robert Loehning
a5252a4463 Compile fixes.
Reviewed-by: Oswald Buddenhagen
2010-02-05 16:20:33 +01:00
Oswald Buddenhagen
e70530c5ad compile everything with QT_USE_FAST_CONCATENATION 2010-02-05 15:20:25 +01:00
Oswald Buddenhagen
7df3082b6c optimize $$unique() 2010-02-05 15:20:25 +01:00
Oswald Buddenhagen
938fb0af10 do not change current working directory while evaluating files
this makes the i/o part of the evaluator thread-safe.
for safety, assert absolute paths in IoUtils::exists().

on the way, i "stole" some code i wrote for KDE. there have been no
copyright-worthy contributions from others to it, so this is legal.
2010-02-05 15:20:25 +01:00
Oswald Buddenhagen
b309f9449a directly link ProItems instead of using QList<ProItem*>
somewhat faster again
2010-02-05 15:20:25 +01:00
Oswald Buddenhagen
42fd31fb12 remove unused functions 2010-02-05 15:20:25 +01:00
Oswald Buddenhagen
a2dbeecdec remove visitor pattern
it's overengineered for our purpose and would just get in the way of
planned optimizations.
2010-02-05 15:20:25 +01:00
Oswald Buddenhagen
b891afbe27 optimize values()
use a hash of magic variable names to ints, which allows fast lookup
followed by a jump table dispatch
2010-02-05 15:20:25 +01:00
Oswald Buddenhagen
45cc9df8a2 eliminate duplicates from qmake spec and feature paths
potentially reduces the number of file::exists() calls
2010-01-25 16:53:56 +01:00
Oswald Buddenhagen
b5fd00955f get rid of lots of qfileinfo and qfile calls
partly by removing unnecessary calls, partly by providing minimalistic
reimplementations.
this gives a quite incredible performance boost ...
2010-01-25 16:53:56 +01:00
Oswald Buddenhagen
18a515652a drastically cut down qregexp use
this gives a rather impressive speed boost.
if qmake wasn't trying to be so clever, we could get even more
out of this.
2010-01-25 16:53:56 +01:00
Oswald Buddenhagen
3cdecdd9e1 integrate function argument splitting into expandVariableReferences()
that way we save the creation of a temporary stringlist
2010-01-25 16:53:56 +01:00
Oswald Buddenhagen
9b8a09b881 get rid of m_proitem
now that we know the size of the entire file, we can use a single fixed
buffer instead of growing one on-demand - in the case where we just read
the file, we can even re-use the file buffer itself.
this should improve performance for files with very many line
continuations, but the practical impact drowns in the noise.
anyway, the code is nicer, as we don't abuse qstring that obviously any
more.
2010-01-25 16:53:56 +01:00
Oswald Buddenhagen
cac522b761 read file at once instead of line-wise
again several percent faster ...
2010-01-25 16:53:56 +01:00
Oswald Buddenhagen
cc635e2642 avoid QChar::unicode() calls in debug builds
in release mode they expand to nothing ... not so in debug mode.
2010-01-25 16:53:56 +01:00
Oswald Buddenhagen
714e981c69 optimize expandVariableReferences()
- nest conditionals properly to avoid unnecessary tests
- avoid usage of QString::append(QChar) to save allocations
2010-01-25 16:53:56 +01:00
Oswald Buddenhagen
48d15b8a66 don't split value list right before expanding variables
the latter will do it anyway.
this eradicates the performance penalty from the previous commit at its
root.
2010-01-25 16:53:56 +01:00
Oswald Buddenhagen
9c7d803aec don't pre-split RHS of variable assignments
creating tons of items is a tad allocation-intensive and thus slow.

this is probably slower for often-included files, as now the splitting
is done in every evaluation pass.
2010-01-25 16:53:56 +01:00
Oswald Buddenhagen
61772da250 omit comments from the "AST"
now that the tree will not be written out any more, we can save some
cpu and memory by not recording the information.
2010-01-25 16:53:56 +01:00
Oswald Buddenhagen
f9d955eb6c cache parsed pri & prf files
no point in re-parsing them over and over during the scan of a bigger
project ...

shaves off another 20% of the loading time of Qt 4.6.
2009-12-08 17:36:41 +01:00
Oswald Buddenhagen
0682dae77c ProfileEvaluator::Option => ProfileOption
makes forward delcs in headers possible
2009-12-08 17:36:41 +01:00