Thomas Jarosch
9b51d81e99
Match compiler: Split _replaceTokenMatch() into two small functions
2013-01-07 21:39:49 +01:00
Thomas Jarosch
3918948dd5
Match compiler: Aggregate match functions with the same pattern / function call signature
...
Reduces the number of generated functions from 2290 to 1916.
2013-01-04 04:47:01 +01:00
Thomas Jarosch
5f09cb2e4d
Match compiler: Store matchFunctions and matchStrs in the class instead of passing it around
2013-01-04 03:56:21 +01:00
Thomas Jarosch
542c6e82d3
Match compiler: Cosmetic changes after running pylint
2013-01-04 03:44:04 +01:00
Thomas Jarosch
71a236b3df
Match compiler: Turn code into a python class
...
This will make passing around internal states a lot easier
2013-01-04 03:38:40 +01:00
Thomas Jarosch
f9c752667e
Match compiler: Inline generated pattern match code for Token::findmatch
...
Verified the output in build/ stayed the same
if Token::findmatch support is disabled.
2013-01-04 03:13:22 +01:00
Thomas Jarosch
4b386986fc
Match compiler: Check varid on first use like Token::Match does
2013-01-04 01:14:52 +01:00
Thomas Jarosch
5d5efdf99f
Match compiler: Add support for Token::findmatch
...
(still disabled for performance reasons)
2013-01-04 01:01:57 +01:00
Thomas Jarosch
7417144784
Match compiler: Compile Token::findsimplematch() calls
...
Disabled for now as it runs slowers than before.
2013-01-03 19:33:37 +01:00
Thomas Jarosch
62b05193c4
MC: Split convertFile() function into smaller pieces
...
Output of build/ stayed the same.
2012-12-31 15:30:27 +01:00
Thomas Jarosch
311630ac1c
Match compiler: Python syntax simplification
...
Output in build/ stayed the same
2012-12-31 15:03:00 +01:00
Thomas Jarosch
51cff0cb9b
Match compiler: Speed up Token comparison with string literals. Ticket #4451
...
"Cache" string literals as C++ std::string objects.
The string length gets cached and so we don't need to
call strlen() on the literals at runtime.
2012-12-31 14:45:16 +01:00
Thomas Jarosch
3c915b534d
Match compiler: Collect and cache plain C-strings
...
Profiler runs with gperftools showed we were spending
a lot of time in strlen() even with compiled match patterns.
If you compare a std::string with a plain C-string,
the comparison operator needs to calculate the length
of the C-string via strlen().
We can avoid this by turning all C-strings into C++ strings,
which cache the string length internally.
The match compiler has been adapted to collect all
C-strings during compilation and aggregate them.
Benchmark on the 'rpm' code base on a Core i7 920 box:
cppcheck without matchcompiler:
real 0m30.977s
cppcheck with previous matchcompiler:
real 0m28.157s
cppcheck with cached C-strings:
real 0m17.823s
2012-12-30 23:24:28 +01:00
Thomas Jarosch
fe5ee76165
Match compiler: No need to handle %num% twice
2012-12-30 20:33:49 +01:00
Thomas Jarosch
3d0b4a9f7e
Add execute permissions to matchcompiler.py on linux
2012-12-25 13:18:24 +01:00
Thomas Jarosch
a2885a1759
Python 3 compatibility for the helper scripts
...
print() is a function in python 3.
Works with pyhton 2.x, too.
2012-12-25 13:12:58 +01:00
Daniel Marjamäki
3b3fe1c616
matchcompiler: throw InternalError if Token::Match is called with the varid 0
2012-12-19 06:45:05 +01:00
Daniel Marjamäki
b6786c87b4
matchcompiler: handle %varid%
2012-12-14 16:59:37 +01:00
Daniel Marjamäki
2d8ed65d43
compiled Token::Match patterns: refactorings,improvements
2012-12-10 20:28:11 +01:00
Daniel Marjamäki
a11ec4a5ee
matchcompiler: replaced regular expression with simple code that parses the code better
2012-12-08 19:29:16 +01:00
Daniel Marjamäki
9fcfb38a1c
matchcompiler: merged regular expressions to a single expression
2012-12-08 16:22:55 +01:00
Daniel Marjamäki
bef0cf149b
matchcompiler: reverted changes so the 'make test' works again
2012-12-08 07:41:18 +01:00
Daniel Marjamäki
9bd222970e
matchcompiler: fixed hang. don't know why it hangs.
2012-12-04 23:38:49 +01:00
Daniel Marjamäki
ae7846bf7e
matchcompiler: added some selftests for findMatchPattern
2012-12-04 22:57:52 +01:00
Daniel Marjamäki
ef5eece286
Compiled Token::Match patterns: extended match patterns and refactored the script a little
2012-12-02 13:39:59 +01:00
Daniel Marjamäki
d630d34b62
Compiled Token::Match patterns. Added python script solution. Python is required to build with compiled patterns. To build cppcheck with compiled patterns use 'make LIBDIR=build'.
2012-12-02 12:36:55 +01:00