annotate ProblemsIdeas.txt @ 3225:7610d0b83fd1

Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
author Gilles Duboscq <gilles.duboscq@oracle.com>
date Tue, 19 Jul 2011 13:48:43 +0200
parents
children 8793d44991fd
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
3225
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
1 Problems
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
2 ========
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
3
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
4 * -Xcomp + synchronized method + unresolved type => deopt to bci -1
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
5 Example : try "runfop.sh -G:-Inline -Xcomp" should fail on the compilation of org.apache.xmlgraphics.util.Service.providers(java.lang.Class, boolean)
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
6
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
7 The first bytecode of the method is NEW (java.lang.StringBuffer)it will deopt because java.lang.StringBuffer is not resolved, the logic in append(FixedNode) will go back until the start node, detaching the MonitorEnter from the start node and attaching the Deopt instead.
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
8 Deopt will now get the FrameState generated by LIRGenerator in setOperandsForLocals which is bci -1 for a synchronized method.
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
9
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
10 Can interpreter handle bci -1 for synchronized methods ? if this is the case, the corresponding assert in LIRGenerator.visitDeoptimize should be removed as bci -1 should now only be used for synchronized entry points and not for exception handling or anything else
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
11
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
12
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
13 * Deopt caused by profiling can interfer with later optimisations
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
14 Exmple : have a look to some of the visit methods in avrora.arch.legacy.LegacyInterpreter sometimes if constructs which are used to materialize some booleans have a Deopt branch which prevents us from detecting an opportunity for a MaterilizeNode canonicalization. As long as the MaterializeNode itself doesnt get canonicalized away and in the end translates to jumps in the final assembly this doesnt really matter but it may if we optimise the emitted assembly
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
15
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
16 Ideas
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
17 =====
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
18
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
19 * Always inline 'specialization' methods
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
20 Example :
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
21 public void foo(int a) {
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
22 foo(a, 1); // invoke 1
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
23 }
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
24
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
25 public void foo(int a, int b) {
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
26 foo(a, b, false); // invoke 2
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
27 }
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
28
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
29 public void foo(int a, int b, boolean c) {
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
30 // ...
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
31 }
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
32
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
33 Here invoke 1 and 2 should always be inlined regardless of the size of the inlined graph/method size and without increasing the inlining depth
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
34
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
35
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
36 * 'computable' slots in Framstates/debug info
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
37
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
38 Framestates/debug info will keep some values live for longer than they should because the values are needed for exemple for a very unlikely Deopt, this increases the pressure on register allocator.
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
39 In the current system Deopt is the unlikely/slow path so maybe we can make it a bit slower to avoid this problem and increase fast path performances.
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
40 An idea would be to insert an 'expression' in some slots instead of value referances, the expression would use values that have to be live at this point for program semantics reasons.
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
41 Expressions would then be evaluated by the runtime when the framestate values are needed. Expression operators probably have to be kept simple (non-trapping arithmetics)
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
42 This could be done by deopting to some deopt handler that will fixup the computable slots, this would probably require less runtime hacking. For exemple an object containing the informations necessary to fixup the framestate could be inserted in one of the framestate solts and then used by a deopt handler called in the same way than the deopt handler example.
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
43
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
44
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
45 * Profilable expressions
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
46
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
47 Some optimizations may benefit from knowing is some assumption can be done. For exemple some loop optimisations may want to know the likelyhood of 2 values being aliased so that it can know if inserting a deopt-if-aliased guard is really beneficial.
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
48 This kind of information can not always be derived just from branch probabilities and it would be interesting to be able to ask the runtime to profile an expression, the simplest version would be to generate a boolean expression and get the probability for it being true.
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
49 This requires going through the compiler and asking for further profiling there are 2 main options here :
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
50 - Reprofile the method in interpreter with the new profiled expression (we may modify the method bytecode to insert a conditional branch on the expression we want to profile, thus using the classical branch probability infrastructure)
7610d0b83fd1 Canonicalize Compare if x valueEquals y, make EndNode return an empty list for cfgSux if it has no merge instead of retruning a list conatining null, make runjython executable, add a ProblemsIdeas.txt file
Gilles Duboscq <gilles.duboscq@oracle.com>
parents:
diff changeset
51 - insert a profiling snippet in the compiled code and ask runtime to recompile the method after N executions