Mercurial > hg > truffle
annotate mx/outputparser.py @ 9126:bc26f978b0ce
HotSpotResolvedObjectType: implement hasFinalizeSubclass() correctly
don't use the (wrong) cached value, but ask the runtime on each request.
Fixes regression on xml.* benchmarks @ specjvm2008. The problem was:
After the constructor of Object was deoptimized due to an assumption violation,
it was recompiled again after some time. However, on recompilation, the value
of hasFinalizeSubclass for the class was not updated and it was compiled again
with a, now wrong, assumption, which then triggers deoptimization again.
This was repeated until it hit the recompilation limit (defined by
PerMethodRecompilationCutoff), and therefore only executed by the interpreter
from now on, causing the performance regression.
author | Bernhard Urban <bernhard.urban@jku.at> |
---|---|
date | Mon, 15 Apr 2013 19:54:58 +0200 |
parents | 2025455e7d80 |
children | dc3c8df55905 |
rev | line source |
---|---|
4225
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
1 # ---------------------------------------------------------------------------------------------------- |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
2 # |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
3 # Copyright (c) 2007, 2012, Oracle and/or its affiliates. All rights reserved. |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
4 # DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
5 # |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
6 # This code is free software; you can redistribute it and/or modify it |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
7 # under the terms of the GNU General Public License version 2 only, as |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
8 # published by the Free Software Foundation. |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
9 # |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
10 # This code is distributed in the hope that it will be useful, but WITHOUT |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
11 # ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
12 # FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
13 # version 2 for more details (a copy is included in the LICENSE file that |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
14 # accompanied this code). |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
15 # |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
16 # You should have received a copy of the GNU General Public License version |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
17 # 2 along with this work; if not, write to the Free Software Foundation, |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
18 # Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
19 # |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
20 # Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
21 # or visit www.oracle.com if you need additional information or have any |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
22 # questions. |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
23 # |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
24 # ---------------------------------------------------------------------------------------------------- |
339cf8d4904d
Made mx.run work properly when stderr is redirected to stdout.
Doug Simon <doug.simon@oracle.com>
parents:
4219
diff
changeset
|
25 |
7570
2025455e7d80
added collection of compilation speed metric for C1 and C2 to bench command
Doug Simon <doug.simon@oracle.com>
parents:
7567
diff
changeset
|
26 import re |
2025455e7d80
added collection of compilation speed metric for C1 and C2 to bench command
Doug Simon <doug.simon@oracle.com>
parents:
7567
diff
changeset
|
27 |
4151 | 28 class OutputParser: |
29 | |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
4282
diff
changeset
|
30 def __init__(self): |
4151 | 31 self.matchers = [] |
32 | |
33 def addMatcher(self, matcher): | |
34 self.matchers.append(matcher) | |
35 | |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
4282
diff
changeset
|
36 def parse(self, output): |
7567
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
37 valueMaps = [] |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
4282
diff
changeset
|
38 for matcher in self.matchers: |
7567
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
39 matcher.parse(output, valueMaps) |
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
40 return valueMaps |
4151 | 41 |
7564
c420a487b10f
changed convention for specifying constants versus named groups in a template for a value to extract from the output of a benchmark execution
Doug Simon <doug.simon@oracle.com>
parents:
7563
diff
changeset
|
42 """ |
7567
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
43 Produces a value map for each match of a given regular expression |
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
44 in some text. The value map is specified by a template map |
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
45 where each key and value in the template map is either a constant |
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
46 value or a named group in the regular expression. The latter is |
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
47 given as the group name enclosed in '<' and '>'. |
7564
c420a487b10f
changed convention for specifying constants versus named groups in a template for a value to extract from the output of a benchmark execution
Doug Simon <doug.simon@oracle.com>
parents:
7563
diff
changeset
|
48 """ |
c420a487b10f
changed convention for specifying constants versus named groups in a template for a value to extract from the output of a benchmark execution
Doug Simon <doug.simon@oracle.com>
parents:
7563
diff
changeset
|
49 class ValuesMatcher: |
4151 | 50 |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
4282
diff
changeset
|
51 def __init__(self, regex, valuesTemplate): |
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
4282
diff
changeset
|
52 assert isinstance(valuesTemplate, dict) |
4151 | 53 self.regex = regex |
7563
3aab15f42934
moved execution of a benchmark out of OutputParser
Doug Simon <doug.simon@oracle.com>
parents:
4282
diff
changeset
|
54 self.valuesTemplate = valuesTemplate |
4151 | 55 |
7567
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
56 def parse(self, text, valueMaps): |
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
57 for match in self.regex.finditer(text): |
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
58 valueMap = {} |
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
59 for keyTemplate, valueTemplate in self.valuesTemplate.items(): |
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
60 key = self.get_template_value(match, keyTemplate) |
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
61 value = self.get_template_value(match, valueTemplate) |
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
62 assert not valueMap.has_key(key), key |
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
63 valueMap[key] = value |
a8bc60aeacb8
fix bug in parsing of SPECjvm2008 output
Doug Simon <doug.simon@oracle.com>
parents:
7564
diff
changeset
|
64 valueMaps.append(valueMap) |
4151 | 65 |
7564
c420a487b10f
changed convention for specifying constants versus named groups in a template for a value to extract from the output of a benchmark execution
Doug Simon <doug.simon@oracle.com>
parents:
7563
diff
changeset
|
66 def get_template_value(self, match, template): |
7570
2025455e7d80
added collection of compilation speed metric for C1 and C2 to bench command
Doug Simon <doug.simon@oracle.com>
parents:
7567
diff
changeset
|
67 def replace_var(m): |
2025455e7d80
added collection of compilation speed metric for C1 and C2 to bench command
Doug Simon <doug.simon@oracle.com>
parents:
7567
diff
changeset
|
68 groupName = m.group(1) |
7564
c420a487b10f
changed convention for specifying constants versus named groups in a template for a value to extract from the output of a benchmark execution
Doug Simon <doug.simon@oracle.com>
parents:
7563
diff
changeset
|
69 return match.group(groupName) |
7570
2025455e7d80
added collection of compilation speed metric for C1 and C2 to bench command
Doug Simon <doug.simon@oracle.com>
parents:
7567
diff
changeset
|
70 |
2025455e7d80
added collection of compilation speed metric for C1 and C2 to bench command
Doug Simon <doug.simon@oracle.com>
parents:
7567
diff
changeset
|
71 return re.sub(r'<([\w]+)>', replace_var, template) |