annotate graal/com.oracle.graal.java/src/com/oracle/graal/java/AbstractBytecodeParser.java @ 20901:c4691265275a

made ReplacementContext and IntrinsicContext top level classes
author Doug Simon <doug.simon@oracle.com>
date Fri, 10 Apr 2015 13:21:33 +0200
parents 1bc27c390bce
children 0f289b082d3d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
14854
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
1 /*
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
2 * Copyright (c) 2014, 2014, Oracle and/or its affiliates. All rights reserved.
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
4 *
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
7 * published by the Free Software Foundation.
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
8 *
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
13 * accompanied this code).
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
14 *
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
15 * You should have received a copy of the GNU General Public License version
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
18 *
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
21 * questions.
64e6a5484cac Fix style issues.
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
22 */
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.java;
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
24
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
25 import static com.oracle.graal.api.code.TypeCheckHints.*;
19239
637ca4d37bca Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19147
diff changeset
26 import static com.oracle.graal.api.meta.DeoptimizationReason.*;
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
27 import static com.oracle.graal.bytecode.Bytecodes.*;
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
28 import static com.oracle.graal.java.AbstractBytecodeParser.Options.*;
19808
73dddd2d8710 moved bytecode paring options to AbstractBytecodeParser.Options
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
29
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
30 import java.util.*;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
31
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
32 import com.oracle.graal.api.code.*;
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
33 import com.oracle.graal.api.meta.*;
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
34 import com.oracle.graal.bytecode.*;
15193
96bb07a5d667 Spit up and move GraalInternalError.
Josef Eisl <josef.eisl@jku.at>
parents: 15031
diff changeset
35 import com.oracle.graal.compiler.common.*;
15200
97eed257999b Move Condition to graal.compiler.common.
Josef Eisl <josef.eisl@jku.at>
parents: 15193
diff changeset
36 import com.oracle.graal.compiler.common.calc.*;
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
37 import com.oracle.graal.debug.*;
19883
4d33cd6e0c8f refactored GraphBuilderConfiguration (and its component classes) into a separate project
Doug Simon <doug.simon@oracle.com>
parents: 19838
diff changeset
38 import com.oracle.graal.graphbuilderconf.*;
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
39 import com.oracle.graal.java.BciBlockMapping.BciBlock;
19111
0b15114268c8 Draft for LoadFieldPlugin.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19050
diff changeset
40 import com.oracle.graal.nodes.*;
19962
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
41 import com.oracle.graal.nodes.type.*;
14922
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
42 import com.oracle.graal.options.*;
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
43 import com.oracle.graal.phases.*;
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
44
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
45 public abstract class AbstractBytecodeParser {
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
46
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
47 public static class Options {
14922
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
48 // @formatter:off
18674
ecb9d0cedbab First draft of option classification.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18490
diff changeset
49 @Option(help = "The trace level for the bytecode parser used when building a graph from bytecode", type = OptionType.Debug)
14922
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
50 public static final OptionValue<Integer> TraceBytecodeParserLevel = new OptionValue<>(0);
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
51
19808
73dddd2d8710 moved bytecode paring options to AbstractBytecodeParser.Options
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
52 @Option(help = "Inlines trivial methods during bytecode parsing.", type = OptionType.Expert)
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
53 public static final StableOptionValue<Boolean> InlineDuringParsing = new StableOptionValue<>(false);
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
54
20091
1bc27c390bce add InlineIntrinsicsDuringParsing option with a default value of true
Doug Simon <doug.simon@oracle.com>
parents: 19994
diff changeset
55 @Option(help = "Inlines intrinsic methods during bytecode parsing.", type = OptionType.Expert)
1bc27c390bce add InlineIntrinsicsDuringParsing option with a default value of true
Doug Simon <doug.simon@oracle.com>
parents: 19994
diff changeset
56 public static final StableOptionValue<Boolean> InlineIntrinsicsDuringParsing = new StableOptionValue<>(true);
1bc27c390bce add InlineIntrinsicsDuringParsing option with a default value of true
Doug Simon <doug.simon@oracle.com>
parents: 19994
diff changeset
57
19808
73dddd2d8710 moved bytecode paring options to AbstractBytecodeParser.Options
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
58 @Option(help = "Traces inlining performed during bytecode parsing.", type = OptionType.Debug)
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
59 public static final StableOptionValue<Boolean> TraceInlineDuringParsing = new StableOptionValue<>(false);
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
60
19808
73dddd2d8710 moved bytecode paring options to AbstractBytecodeParser.Options
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
61 @Option(help = "Traces use of plugins during bytecode parsing.", type = OptionType.Debug)
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
62 public static final StableOptionValue<Boolean> TraceParserPlugins = new StableOptionValue<>(false);
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
63
19808
73dddd2d8710 moved bytecode paring options to AbstractBytecodeParser.Options
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
64 @Option(help = "Maximum depth when inlining during bytecode parsing.", type = OptionType.Debug)
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
65 public static final StableOptionValue<Integer> InlineDuringParsingMaxDepth = new StableOptionValue<>(10);
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
66
19808
73dddd2d8710 moved bytecode paring options to AbstractBytecodeParser.Options
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
67 @Option(help = "Dump graphs after non-trivial changes during bytecode parsing.", type = OptionType.Debug)
73dddd2d8710 moved bytecode paring options to AbstractBytecodeParser.Options
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
68 public static final StableOptionValue<Boolean> DumpDuringGraphBuilding = new StableOptionValue<>(false);
73dddd2d8710 moved bytecode paring options to AbstractBytecodeParser.Options
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
69
73dddd2d8710 moved bytecode paring options to AbstractBytecodeParser.Options
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
70 @Option(help = "Max number of loop explosions per method.", type = OptionType.Debug)
73dddd2d8710 moved bytecode paring options to AbstractBytecodeParser.Options
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
71 public static final OptionValue<Integer> MaximumLoopExplosionCount = new OptionValue<>(10000);
73dddd2d8710 moved bytecode paring options to AbstractBytecodeParser.Options
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
72
73dddd2d8710 moved bytecode paring options to AbstractBytecodeParser.Options
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
73 @Option(help = "Do not bail out but throw an exception on failed loop explosion.", type = OptionType.Debug)
73dddd2d8710 moved bytecode paring options to AbstractBytecodeParser.Options
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
74 public static final OptionValue<Boolean> FailedLoopExplosionIsFatal = new OptionValue<>(false);
73dddd2d8710 moved bytecode paring options to AbstractBytecodeParser.Options
Doug Simon <doug.simon@oracle.com>
parents: 19791
diff changeset
75
14922
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
76 // @formatter:on
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
77 }
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
78
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
79 /**
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
80 * The minimum value to which {@link Options#TraceBytecodeParserLevel} must be set to trace the
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
81 * bytecode instructions as they are parsed.
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
82 */
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
83 public static final int TRACELEVEL_INSTRUCTIONS = 1;
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
84
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
85 /**
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
86 * The minimum value to which {@link Options#TraceBytecodeParserLevel} must be set to trace the
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
87 * frame state before each bytecode instruction as it is parsed.
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
88 */
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
89 public static final int TRACELEVEL_STATE = 2;
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
90
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
91 protected HIRFrameStateBuilder frameState;
14900
be4c28683c08 Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents: 14899
diff changeset
92 protected BciBlock currentBlock;
18918
e8fd0342d9c4 GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18917
diff changeset
93
e8fd0342d9c4 GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18917
diff changeset
94 protected final BytecodeStream stream;
e8fd0342d9c4 GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18917
diff changeset
95 protected final GraphBuilderConfiguration graphBuilderConfig;
e8fd0342d9c4 GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18917
diff changeset
96 protected final ResolvedJavaMethod method;
e8fd0342d9c4 GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18917
diff changeset
97 protected final ProfilingInfo profilingInfo;
e8fd0342d9c4 GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18917
diff changeset
98 protected final OptimisticOptimizations optimisticOpts;
e8fd0342d9c4 GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18917
diff changeset
99 protected final ConstantPool constantPool;
18935
07f2a49f0bfb Various adjustments to simplify future merges
Paul Woegerer <paul.woegerer@oracle.com>
parents: 18920
diff changeset
100 protected final MetaAccessProvider metaAccess;
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
101
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
102 protected final ReplacementContext replacementContext;
19409
1307b475f10d added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents: 19390
diff changeset
103
1307b475f10d added BytecodeParser.parsingReplacement field to distinguish parsing method replacements (or snippets) from normal method parsing
Doug Simon <doug.simon@oracle.com>
parents: 19390
diff changeset
104 /**
14922
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
105 * Meters the number of actual bytecodes parsed.
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
106 */
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
107 public static final DebugMetric BytecodesParsed = Debug.metric("BytecodesParsed");
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
108
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
109 public AbstractBytecodeParser(MetaAccessProvider metaAccess, ResolvedJavaMethod method, GraphBuilderConfiguration graphBuilderConfig, OptimisticOptimizations optimisticOpts,
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
110 ReplacementContext replacementContext) {
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
111 this.graphBuilderConfig = graphBuilderConfig;
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
112 this.optimisticOpts = optimisticOpts;
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
113 this.metaAccess = metaAccess;
18918
e8fd0342d9c4 GraphBuilder simplifications.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18917
diff changeset
114 this.stream = new BytecodeStream(method.getCode());
19439
5be35dd0a9dd Disable use of profiling information during partial evaluation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19390
diff changeset
115 this.profilingInfo = (graphBuilderConfig.getUseProfiling() ? method.getProfilingInfo() : null);
18917
323ac2b4d988 Small simplification for BaselineBytecodeParser.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18825
diff changeset
116 this.constantPool = method.getConstantPool();
14900
be4c28683c08 Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents: 14899
diff changeset
117 this.method = method;
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
118 this.replacementContext = replacementContext;
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
119 assert metaAccess != null;
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
120 }
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
121
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
122 public void setCurrentFrameState(HIRFrameStateBuilder frameState) {
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
123 this.frameState = frameState;
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
124 }
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
125
14900
be4c28683c08 Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents: 14899
diff changeset
126 protected final BytecodeStream getStream() {
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
127 return stream;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
128 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
129
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
130 public int bci() {
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
131 return stream.currentBCI();
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
132 }
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
133
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
134 public void loadLocal(int index, Kind kind) {
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
135 frameState.push(kind, frameState.loadLocal(index));
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
136 }
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
137
14895
d76fce67b49d Created BaselineCompiler BytecodeParser inner class.
Josef Eisl <josef.eisl@jku.at>
parents: 14894
diff changeset
138 public void storeLocal(Kind kind, int index) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
139 ValueNode value;
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
140 if (kind == Kind.Object) {
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
141 value = frameState.xpop();
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
142 // astore and astore_<n> may be used to store a returnAddress (jsr)
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
143 assert parsingReplacement() || (value.getKind() == Kind.Object || value.getKind() == Kind.Int) : value + ":" + value.getKind();
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
144 } else {
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
145 value = frameState.pop(kind);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
146 }
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
147 frameState.storeLocal(index, value, kind);
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
148 }
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
149
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
150 /**
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
151 * @param type the unresolved type of the constant
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
152 */
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
153 protected abstract void handleUnresolvedLoadConstant(JavaType type);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
154
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
155 /**
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
156 * @param type the unresolved type of the type check
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
157 * @param object the object value whose type is being checked against {@code type}
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
158 */
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
159 protected abstract void handleUnresolvedCheckCast(JavaType type, ValueNode object);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
160
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
161 /**
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
162 * @param type the unresolved type of the type check
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
163 * @param object the object value whose type is being checked against {@code type}
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
164 */
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
165 protected abstract void handleUnresolvedInstanceOf(JavaType type, ValueNode object);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
166
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
167 /**
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
168 * @param type the type being instantiated
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
169 */
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
170 protected abstract void handleUnresolvedNewInstance(JavaType type);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
171
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
172 /**
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
173 * @param type the type of the array being instantiated
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
174 * @param length the length of the array
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
175 */
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
176 protected abstract void handleUnresolvedNewObjectArray(JavaType type, ValueNode length);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
177
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
178 /**
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
179 * @param type the type being instantiated
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
180 * @param dims the dimensions for the multi-array
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
181 */
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
182 protected abstract void handleUnresolvedNewMultiArray(JavaType type, List<ValueNode> dims);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
183
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
184 /**
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
185 * @param field the unresolved field
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
186 * @param receiver the object containing the field or {@code null} if {@code field} is static
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
187 */
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
188 protected abstract void handleUnresolvedLoadField(JavaField field, ValueNode receiver);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
189
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
190 /**
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
191 * @param field the unresolved field
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
192 * @param value the value being stored to the field
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
193 * @param receiver the object containing the field or {@code null} if {@code field} is static
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
194 */
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
195 protected abstract void handleUnresolvedStoreField(JavaField field, ValueNode value, ValueNode receiver);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
196
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
197 /**
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
198 * @param type
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
199 */
18361
6ac7e9c85be6 Split getEncoding into two methods.
Roland Schatz <roland.schatz@oracle.com>
parents: 18187
diff changeset
200 protected abstract void handleUnresolvedExceptionType(JavaType type);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
201
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
202 // protected abstract void handleUnresolvedInvoke(JavaMethod javaMethod, InvokeKind invokeKind);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
203
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
204 // protected abstract DispatchBeginNode handleException(ValueNode exceptionObject, int bci);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
205
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
206 private void genLoadConstant(int cpi, int opcode) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
207 Object con = lookupConstant(cpi, opcode);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
208
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
209 if (con instanceof JavaType) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
210 // this is a load of class constant which might be unresolved
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
211 JavaType type = (JavaType) con;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
212 if (type instanceof ResolvedJavaType) {
18361
6ac7e9c85be6 Split getEncoding into two methods.
Roland Schatz <roland.schatz@oracle.com>
parents: 18187
diff changeset
213 frameState.push(Kind.Object, appendConstant(((ResolvedJavaType) type).getJavaClass()));
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
214 } else {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
215 handleUnresolvedLoadConstant(type);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
216 }
18187
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 17341
diff changeset
217 } else if (con instanceof JavaConstant) {
9619ba4daf4c Rename Constant to JavaConstant.
Roland Schatz <roland.schatz@oracle.com>
parents: 17341
diff changeset
218 JavaConstant constant = (JavaConstant) con;
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
219 frameState.push(constant.getKind().getStackKind(), appendConstant(constant));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
220 } else {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
221 throw new Error("lookupConstant returned an object of incorrect type");
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
222 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
223 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
224
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
225 protected abstract ValueNode genLoadIndexed(ValueNode index, ValueNode array, Kind kind);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
226
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
227 private void genLoadIndexed(Kind kind) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
228 ValueNode index = frameState.ipop();
19962
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
229 ValueNode array = emitExplicitExceptions(frameState.apop(), index);
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
230 if (!tryLoadIndexedPlugin(kind, index, array)) {
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
231 frameState.push(kind.getStackKind(), append(genLoadIndexed(array, index, kind)));
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
232 }
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
233 }
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
234
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
235 protected abstract void traceWithContext(String format, Object... args);
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
236
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
237 protected boolean tryLoadIndexedPlugin(Kind kind, ValueNode index, ValueNode array) {
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
238 LoadIndexedPlugin loadIndexedPlugin = graphBuilderConfig.getPlugins().getLoadIndexedPlugin();
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
239 if (loadIndexedPlugin != null && loadIndexedPlugin.apply((GraphBuilderContext) this, array, index, kind)) {
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
240 if (TraceParserPlugins.getValue()) {
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
241 traceWithContext("used load indexed plugin");
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
242 }
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
243 return true;
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
244 } else {
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
245 return false;
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
246 }
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
247 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
248
19854
4178f9830a27 Assign the state after when appending the node and not automatically in the main graph builder loop.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19838
diff changeset
249 protected abstract void genStoreIndexed(ValueNode array, ValueNode index, Kind kind, ValueNode value);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
250
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
251 private void genStoreIndexed(Kind kind) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
252 ValueNode value = frameState.pop(kind.getStackKind());
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
253 ValueNode index = frameState.ipop();
19962
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
254 ValueNode array = emitExplicitExceptions(frameState.apop(), index);
19854
4178f9830a27 Assign the state after when appending the node and not automatically in the main graph builder loop.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19838
diff changeset
255 genStoreIndexed(array, index, kind, value);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
256 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
257
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
258 private void stackOp(int opcode) {
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
259 switch (opcode) {
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
260 case DUP_X1: {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
261 ValueNode w1 = frameState.xpop();
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
262 ValueNode w2 = frameState.xpop();
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
263 frameState.xpush(w1);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
264 frameState.xpush(w2);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
265 frameState.xpush(w1);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
266 break;
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
267 }
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
268 case DUP_X2: {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
269 ValueNode w1 = frameState.xpop();
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
270 ValueNode w2 = frameState.xpop();
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
271 ValueNode w3 = frameState.xpop();
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
272 frameState.xpush(w1);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
273 frameState.xpush(w3);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
274 frameState.xpush(w2);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
275 frameState.xpush(w1);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
276 break;
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
277 }
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
278 case DUP2: {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
279 ValueNode w1 = frameState.xpop();
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
280 ValueNode w2 = frameState.xpop();
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
281 frameState.xpush(w2);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
282 frameState.xpush(w1);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
283 frameState.xpush(w2);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
284 frameState.xpush(w1);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
285 break;
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
286 }
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
287 case DUP2_X1: {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
288 ValueNode w1 = frameState.xpop();
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
289 ValueNode w2 = frameState.xpop();
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
290 ValueNode w3 = frameState.xpop();
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
291 frameState.xpush(w2);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
292 frameState.xpush(w1);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
293 frameState.xpush(w3);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
294 frameState.xpush(w2);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
295 frameState.xpush(w1);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
296 break;
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
297 }
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
298 case DUP2_X2: {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
299 ValueNode w1 = frameState.xpop();
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
300 ValueNode w2 = frameState.xpop();
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
301 ValueNode w3 = frameState.xpop();
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
302 ValueNode w4 = frameState.xpop();
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
303 frameState.xpush(w2);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
304 frameState.xpush(w1);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
305 frameState.xpush(w4);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
306 frameState.xpush(w3);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
307 frameState.xpush(w2);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
308 frameState.xpush(w1);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
309 break;
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
310 }
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
311 case SWAP: {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
312 ValueNode w1 = frameState.xpop();
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
313 ValueNode w2 = frameState.xpop();
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
314 frameState.xpush(w1);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
315 frameState.xpush(w2);
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
316 break;
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
317 }
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
318 default:
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
319 throw GraalInternalError.shouldNotReachHere();
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
320 }
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
321 }
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
322
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
323 protected abstract ValueNode genIntegerAdd(Kind kind, ValueNode x, ValueNode y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
324
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
325 protected abstract ValueNode genIntegerSub(Kind kind, ValueNode x, ValueNode y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
326
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
327 protected abstract ValueNode genIntegerMul(Kind kind, ValueNode x, ValueNode y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
328
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
329 protected abstract ValueNode genFloatAdd(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
330
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
331 protected abstract ValueNode genFloatSub(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
332
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
333 protected abstract ValueNode genFloatMul(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
334
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
335 protected abstract ValueNode genFloatDiv(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
336
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
337 protected abstract ValueNode genFloatRem(Kind kind, ValueNode x, ValueNode y, boolean isStrictFP);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
338
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
339 private void genArithmeticOp(Kind result, int opcode) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
340 ValueNode y = frameState.pop(result);
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
341 ValueNode x = frameState.pop(result);
15311
820c6d353358 added ModifiersProvider as superinterface for ResolvedJava[Method|Field|Type] and implemented all checks against modifiers as default methods
Doug Simon <doug.simon@oracle.com>
parents: 15294
diff changeset
342 boolean isStrictFP = method.isStrict();
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
343 ValueNode v;
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
344 switch (opcode) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
345 case IADD:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
346 case LADD:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
347 v = genIntegerAdd(result, x, y);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
348 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
349 case FADD:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
350 case DADD:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
351 v = genFloatAdd(result, x, y, isStrictFP);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
352 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
353 case ISUB:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
354 case LSUB:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
355 v = genIntegerSub(result, x, y);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
356 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
357 case FSUB:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
358 case DSUB:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
359 v = genFloatSub(result, x, y, isStrictFP);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
360 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
361 case IMUL:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
362 case LMUL:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
363 v = genIntegerMul(result, x, y);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
364 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
365 case FMUL:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
366 case DMUL:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
367 v = genFloatMul(result, x, y, isStrictFP);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
368 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
369 case FDIV:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
370 case DDIV:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
371 v = genFloatDiv(result, x, y, isStrictFP);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
372 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
373 case FREM:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
374 case DREM:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
375 v = genFloatRem(result, x, y, isStrictFP);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
376 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
377 default:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
378 throw new GraalInternalError("should not reach");
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
379 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
380 frameState.push(result, append(v));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
381 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
382
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
383 protected abstract ValueNode genIntegerDiv(Kind kind, ValueNode x, ValueNode y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
384
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
385 protected abstract ValueNode genIntegerRem(Kind kind, ValueNode x, ValueNode y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
386
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
387 private void genIntegerDivOp(Kind result, int opcode) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
388 ValueNode y = frameState.pop(result);
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
389 ValueNode x = frameState.pop(result);
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
390 ValueNode v;
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
391 switch (opcode) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
392 case IDIV:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
393 case LDIV:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
394 v = genIntegerDiv(result, x, y);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
395 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
396 case IREM:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
397 case LREM:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
398 v = genIntegerRem(result, x, y);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
399 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
400 default:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
401 throw new GraalInternalError("should not reach");
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
402 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
403 frameState.push(result, append(v));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
404 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
405
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
406 protected abstract ValueNode genNegateOp(ValueNode x);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
407
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
408 private void genNegateOp(Kind kind) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
409 frameState.push(kind, append(genNegateOp(frameState.pop(kind))));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
410 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
411
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
412 protected abstract ValueNode genLeftShift(Kind kind, ValueNode x, ValueNode y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
413
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
414 protected abstract ValueNode genRightShift(Kind kind, ValueNode x, ValueNode y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
415
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
416 protected abstract ValueNode genUnsignedRightShift(Kind kind, ValueNode x, ValueNode y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
417
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
418 private void genShiftOp(Kind kind, int opcode) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
419 ValueNode s = frameState.ipop();
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
420 ValueNode x = frameState.pop(kind);
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
421 ValueNode v;
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
422 switch (opcode) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
423 case ISHL:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
424 case LSHL:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
425 v = genLeftShift(kind, x, s);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
426 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
427 case ISHR:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
428 case LSHR:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
429 v = genRightShift(kind, x, s);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
430 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
431 case IUSHR:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
432 case LUSHR:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
433 v = genUnsignedRightShift(kind, x, s);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
434 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
435 default:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
436 throw new GraalInternalError("should not reach");
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
437 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
438 frameState.push(kind, append(v));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
439 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
440
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
441 protected abstract ValueNode genAnd(Kind kind, ValueNode x, ValueNode y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
442
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
443 protected abstract ValueNode genOr(Kind kind, ValueNode x, ValueNode y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
444
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
445 protected abstract ValueNode genXor(Kind kind, ValueNode x, ValueNode y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
446
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
447 private void genLogicOp(Kind kind, int opcode) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
448 ValueNode y = frameState.pop(kind);
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
449 ValueNode x = frameState.pop(kind);
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
450 ValueNode v;
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
451 switch (opcode) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
452 case IAND:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
453 case LAND:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
454 v = genAnd(kind, x, y);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
455 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
456 case IOR:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
457 case LOR:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
458 v = genOr(kind, x, y);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
459 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
460 case IXOR:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
461 case LXOR:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
462 v = genXor(kind, x, y);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
463 break;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
464 default:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
465 throw new GraalInternalError("should not reach");
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
466 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
467 frameState.push(kind, append(v));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
468 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
469
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
470 protected abstract ValueNode genNormalizeCompare(ValueNode x, ValueNode y, boolean isUnorderedLess);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
471
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
472 private void genCompareOp(Kind kind, boolean isUnorderedLess) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
473 ValueNode y = frameState.pop(kind);
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
474 ValueNode x = frameState.pop(kind);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
475 frameState.ipush(append(genNormalizeCompare(x, y, isUnorderedLess)));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
476 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
477
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
478 protected abstract ValueNode genFloatConvert(FloatConvert op, ValueNode input);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
479
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
480 private void genFloatConvert(FloatConvert op, Kind from, Kind to) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
481 ValueNode input = frameState.pop(from.getStackKind());
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
482 frameState.push(to.getStackKind(), append(genFloatConvert(op, input)));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
483 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
484
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
485 protected abstract ValueNode genNarrow(ValueNode input, int bitCount);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
486
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
487 protected abstract ValueNode genSignExtend(ValueNode input, int bitCount);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
488
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
489 protected abstract ValueNode genZeroExtend(ValueNode input, int bitCount);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
490
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
491 private void genSignExtend(Kind from, Kind to) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
492 ValueNode input = frameState.pop(from.getStackKind());
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
493 if (from != from.getStackKind()) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
494 input = append(genNarrow(input, from.getBitCount()));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
495 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
496 frameState.push(to.getStackKind(), append(genSignExtend(input, to.getBitCount())));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
497 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
498
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
499 private void genZeroExtend(Kind from, Kind to) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
500 ValueNode input = frameState.pop(from.getStackKind());
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
501 if (from != from.getStackKind()) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
502 input = append(genNarrow(input, from.getBitCount()));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
503 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
504 frameState.push(to.getStackKind(), append(genZeroExtend(input, to.getBitCount())));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
505 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
506
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
507 private void genNarrow(Kind from, Kind to) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
508 ValueNode input = frameState.pop(from.getStackKind());
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
509 frameState.push(to.getStackKind(), append(genNarrow(input, to.getBitCount())));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
510 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
511
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
512 private void genIncrement() {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
513 int index = getStream().readLocalIndex();
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
514 int delta = getStream().readIncrement();
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
515 ValueNode x = frameState.loadLocal(index);
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
516 ValueNode y = appendConstant(JavaConstant.forInt(delta));
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
517 frameState.storeLocal(index, append(genIntegerAdd(Kind.Int, x, y)));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
518 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
519
15030
e098038093d5 AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents: 15029
diff changeset
520 protected abstract void genGoto();
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
521
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
522 protected abstract ValueNode genObjectEquals(ValueNode x, ValueNode y);
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
523
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
524 protected abstract ValueNode genIntegerEquals(ValueNode x, ValueNode y);
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
525
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
526 protected abstract ValueNode genIntegerLessThan(ValueNode x, ValueNode y);
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
527
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
528 protected abstract ValueNode genUnique(ValueNode x);
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
529
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
530 protected abstract void genIf(ValueNode x, Condition cond, ValueNode y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
531
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
532 private void genIfZero(Condition cond) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
533 ValueNode y = appendConstant(JavaConstant.INT_0);
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
534 ValueNode x = frameState.ipop();
14948
bc72e5ed9752 AbstractBytecodeParser: rename ifNode to genIf.
Josef Eisl <josef.eisl@jku.at>
parents: 14947
diff changeset
535 genIf(x, cond, y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
536 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
537
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
538 private void genIfNull(Condition cond) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
539 ValueNode y = appendConstant(JavaConstant.NULL_POINTER);
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
540 ValueNode x = frameState.apop();
14948
bc72e5ed9752 AbstractBytecodeParser: rename ifNode to genIf.
Josef Eisl <josef.eisl@jku.at>
parents: 14947
diff changeset
541 genIf(x, cond, y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
542 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
543
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
544 private void genIfSame(Kind kind, Condition cond) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
545 ValueNode y = frameState.pop(kind);
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
546 ValueNode x = frameState.pop(kind);
14948
bc72e5ed9752 AbstractBytecodeParser: rename ifNode to genIf.
Josef Eisl <josef.eisl@jku.at>
parents: 14947
diff changeset
547 genIf(x, cond, y);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
548 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
549
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
550 protected abstract void genThrow();
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
551
14900
be4c28683c08 Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents: 14899
diff changeset
552 protected JavaType lookupType(int cpi, int bytecode) {
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
553 maybeEagerlyResolve(cpi, bytecode);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
554 JavaType result = constantPool.lookupType(cpi, bytecode);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
555 assert !graphBuilderConfig.unresolvedIsError() || result instanceof ResolvedJavaType;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
556 return result;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
557 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
558
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
559 private JavaMethod lookupMethod(int cpi, int opcode) {
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
560 maybeEagerlyResolve(cpi, opcode);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
561 JavaMethod result = constantPool.lookupMethod(cpi, opcode);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
562 /*
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
563 * In general, one cannot assume that the declaring class being initialized is useful, since
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
564 * the actual concrete receiver may be a different class (except for static calls). Also,
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
565 * interfaces are initialized only under special circumstances, so that this assertion would
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
566 * often fail for interface calls.
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
567 */
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
568 assert !graphBuilderConfig.unresolvedIsError() || (result instanceof ResolvedJavaMethod && (opcode != INVOKESTATIC || ((ResolvedJavaMethod) result).getDeclaringClass().isInitialized())) : result;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
569 return result;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
570 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
571
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
572 private JavaField lookupField(int cpi, int opcode) {
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
573 maybeEagerlyResolve(cpi, opcode);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
574 JavaField result = constantPool.lookupField(cpi, opcode);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
575 assert !graphBuilderConfig.unresolvedIsError() || (result instanceof ResolvedJavaField && ((ResolvedJavaField) result).getDeclaringClass().isInitialized()) : result;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
576 return result;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
577 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
578
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
579 private Object lookupConstant(int cpi, int opcode) {
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
580 maybeEagerlyResolve(cpi, opcode);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
581 Object result = constantPool.lookupConstant(cpi);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
582 assert !graphBuilderConfig.eagerResolving() || !(result instanceof JavaType) || (result instanceof ResolvedJavaType) : result;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
583 return result;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
584 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
585
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
586 private void maybeEagerlyResolve(int cpi, int bytecode) {
19838
5e27aa02bb92 only do eager resolving for replacements that are intrinsics
Doug Simon <doug.simon@oracle.com>
parents: 19811
diff changeset
587 if (graphBuilderConfig.eagerResolving() || replacementContext instanceof IntrinsicContext) {
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
588 constantPool.loadReferencedType(cpi, bytecode);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
589 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
590 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
591
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
592 private JavaTypeProfile getProfileForTypeCheck(ResolvedJavaType type) {
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
593 if (parsingReplacement() || profilingInfo == null || !optimisticOpts.useTypeCheckHints() || !canHaveSubtype(type)) {
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
594 return null;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
595 } else {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
596 return profilingInfo.getTypeProfile(bci());
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
597 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
598 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
599
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
600 protected abstract ValueNode createCheckCast(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck, boolean forStoreCheck);
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
601
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
602 private void genCheckCast() {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
603 int cpi = getStream().readCPI();
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
604 JavaType type = lookupType(cpi, CHECKCAST);
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
605 ValueNode object = frameState.apop();
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
606 if (type instanceof ResolvedJavaType) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
607 JavaTypeProfile profileForTypeCheck = getProfileForTypeCheck((ResolvedJavaType) type);
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
608 ValueNode checkCastNode = append(createCheckCast((ResolvedJavaType) type, object, profileForTypeCheck, false));
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
609 frameState.apush(checkCastNode);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
610 } else {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
611 handleUnresolvedCheckCast(type, object);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
612 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
613 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
614
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
615 protected abstract ValueNode createInstanceOf(ResolvedJavaType type, ValueNode object, JavaTypeProfile profileForTypeCheck);
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
616
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
617 protected abstract ValueNode genConditional(ValueNode x);
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
618
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
619 private void genInstanceOf() {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
620 int cpi = getStream().readCPI();
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
621 JavaType type = lookupType(cpi, INSTANCEOF);
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
622 ValueNode object = frameState.apop();
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
623 if (type instanceof ResolvedJavaType) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
624 ResolvedJavaType resolvedType = (ResolvedJavaType) type;
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
625 ValueNode instanceOfNode = createInstanceOf((ResolvedJavaType) type, object, getProfileForTypeCheck(resolvedType));
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
626 frameState.ipush(append(genConditional(genUnique(instanceOfNode))));
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
627 } else {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
628 handleUnresolvedInstanceOf(type, object);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
629 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
630 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
631
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
632 protected abstract ValueNode createNewInstance(ResolvedJavaType type, boolean fillContents);
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
633
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
634 void genNewInstance(int cpi) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
635 JavaType type = lookupType(cpi, NEW);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
636 if (type instanceof ResolvedJavaType && ((ResolvedJavaType) type).isInitialized()) {
19239
637ca4d37bca Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19147
diff changeset
637 ResolvedJavaType[] skippedExceptionTypes = this.graphBuilderConfig.getSkippedExceptionTypes();
637ca4d37bca Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19147
diff changeset
638 if (skippedExceptionTypes != null) {
637ca4d37bca Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19147
diff changeset
639 for (ResolvedJavaType exceptionType : skippedExceptionTypes) {
637ca4d37bca Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19147
diff changeset
640 if (exceptionType.isAssignableFrom((ResolvedJavaType) type)) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
641 append(new DeoptimizeNode(DeoptimizationAction.None, TransferToInterpreter));
19239
637ca4d37bca Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19147
diff changeset
642 return;
637ca4d37bca Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19147
diff changeset
643 }
637ca4d37bca Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19147
diff changeset
644 }
637ca4d37bca Extensions and fixes to inline and canonicalize during parsing.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19147
diff changeset
645 }
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
646 frameState.apush(append(createNewInstance((ResolvedJavaType) type, true)));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
647 } else {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
648 handleUnresolvedNewInstance(type);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
649 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
650 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
651
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
652 /**
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
653 * Gets the kind of array elements for the array type code that appears in a
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
654 * {@link Bytecodes#NEWARRAY} bytecode.
14899
e2a5528599e0 Merge (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14854 14896
diff changeset
655 *
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
656 * @param code the array type code
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
657 * @return the kind from the array type code
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
658 */
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
659 public static Class<?> arrayTypeCodeToClass(int code) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
660 // Checkstyle: stop
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
661 switch (code) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
662 case 4:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
663 return boolean.class;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
664 case 5:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
665 return char.class;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
666 case 6:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
667 return float.class;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
668 case 7:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
669 return double.class;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
670 case 8:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
671 return byte.class;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
672 case 9:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
673 return short.class;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
674 case 10:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
675 return int.class;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
676 case 11:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
677 return long.class;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
678 default:
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
679 throw new IllegalArgumentException("unknown array type code: " + code);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
680 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
681 // Checkstyle: resume
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
682 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
683
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
684 private void genNewPrimitiveArray(int typeCode) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
685 Class<?> clazz = arrayTypeCodeToClass(typeCode);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
686 ResolvedJavaType elementType = metaAccess.lookupJavaType(clazz);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
687 frameState.apush(append(createNewArray(elementType, frameState.ipop(), true)));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
688 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
689
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
690 private void genNewObjectArray(int cpi) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
691 JavaType type = lookupType(cpi, ANEWARRAY);
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
692 ValueNode length = frameState.ipop();
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
693 if (type instanceof ResolvedJavaType) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
694 frameState.apush(append(createNewArray((ResolvedJavaType) type, length, true)));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
695 } else {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
696 handleUnresolvedNewObjectArray(type, length);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
697 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
698
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
699 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
700
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
701 protected abstract ValueNode createNewArray(ResolvedJavaType elementType, ValueNode length, boolean fillContents);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
702
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
703 private void genNewMultiArray(int cpi) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
704 JavaType type = lookupType(cpi, MULTIANEWARRAY);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
705 int rank = getStream().readUByte(bci() + 3);
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
706 List<ValueNode> dims = new ArrayList<>(Collections.nCopies(rank, null));
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
707 for (int i = rank - 1; i >= 0; i--) {
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
708 dims.set(i, frameState.ipop());
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
709 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
710 if (type instanceof ResolvedJavaType) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
711 frameState.apush(append(createNewMultiArray((ResolvedJavaType) type, dims)));
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
712 } else {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
713 handleUnresolvedNewMultiArray(type, dims);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
714 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
715 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
716
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
717 protected abstract ValueNode createNewMultiArray(ResolvedJavaType type, List<ValueNode> dims);
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
718
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
719 protected abstract ValueNode genLoadField(ValueNode receiver, ResolvedJavaField field);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
720
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
721 private void genGetField(JavaField field) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
722 Kind kind = field.getKind();
19962
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
723 ValueNode receiver = emitExplicitExceptions(frameState.apop(), null);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
724 if ((field instanceof ResolvedJavaField) && ((ResolvedJavaField) field).getDeclaringClass().isInitialized()) {
19787
7117697d11e1 refactored graph builder plugins into a separate class
Doug Simon <doug.simon@oracle.com>
parents: 19717
diff changeset
725 LoadFieldPlugin loadFieldPlugin = this.graphBuilderConfig.getPlugins().getLoadFieldPlugin();
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
726 if (loadFieldPlugin == null || !loadFieldPlugin.apply((GraphBuilderContext) this, receiver, (ResolvedJavaField) field)) {
19111
0b15114268c8 Draft for LoadFieldPlugin.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19050
diff changeset
727 appendOptimizedLoadField(kind, genLoadField(receiver, (ResolvedJavaField) field));
0b15114268c8 Draft for LoadFieldPlugin.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19050
diff changeset
728 }
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
729 } else {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
730 handleUnresolvedLoadField(field, receiver);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
731 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
732 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
733
19962
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
734 /**
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
735 * Emits control flow to null check a receiver if it's stamp does not indicate it is
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
736 * {@linkplain StampTool#isPointerNonNull always non-null}.
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
737 *
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
738 * @return the receiver with a stamp indicating non-nullness
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
739 */
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
740 protected abstract ValueNode emitExplicitNullCheck(ValueNode receiver);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
741
19962
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
742 /**
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
743 * Emits control flow to check an array index is within bounds of an array's length.
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
744 *
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
745 * @param index the index to check
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
746 * @param length the length of the array being indexed
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
747 */
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
748 protected abstract void emitExplicitBoundsCheck(ValueNode index, ValueNode length);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
749
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
750 private static final DebugMetric EXPLICIT_EXCEPTIONS = Debug.metric("ExplicitExceptions");
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
751
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
752 protected abstract ValueNode genArrayLength(ValueNode x);
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
753
19962
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
754 /**
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
755 * @param receiver the receiver of an object based operation
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
756 * @param index the index of an array based operation that is to be tested for out of bounds.
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
757 * This is null for a non-array operation.
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
758 * @return the receiver value possibly modified to have a tighter stamp
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
759 */
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
760 protected ValueNode emitExplicitExceptions(ValueNode receiver, ValueNode index) {
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
761 assert receiver != null;
19439
5be35dd0a9dd Disable use of profiling information during partial evaluation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19390
diff changeset
762 if (graphBuilderConfig.omitAllExceptionEdges() || profilingInfo == null ||
18825
bf382ef59838 Avoid using placeholder nodes when emitting explicit exceptions. Introduce StressExplictExceptionCode flag for debugging.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18818
diff changeset
763 (optimisticOpts.useExceptionProbabilityForOperations() && profilingInfo.getExceptionSeen(bci()) == TriState.FALSE && !GraalOptions.StressExplicitExceptionCode.getValue())) {
19962
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
764 return receiver;
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
765 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
766
19962
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
767 ValueNode nonNullReceiver = emitExplicitNullCheck(receiver);
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
768 if (index != null) {
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
769 ValueNode length = append(genArrayLength(nonNullReceiver));
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
770 emitExplicitBoundsCheck(index, length);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
771 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
772 EXPLICIT_EXCEPTIONS.increment();
19962
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
773 return nonNullReceiver;
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
774 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
775
19854
4178f9830a27 Assign the state after when appending the node and not automatically in the main graph builder loop.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19838
diff changeset
776 protected abstract void genStoreField(ValueNode receiver, ResolvedJavaField field, ValueNode value);
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
777
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
778 private void genPutField(JavaField field) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
779 ValueNode value = frameState.pop(field.getKind().getStackKind());
19962
9b669776bf8a added null checking for the receiver when inlining or applying an InvocationPlugin during graph parsing
Doug Simon <doug.simon@oracle.com>
parents: 19951
diff changeset
780 ValueNode receiver = emitExplicitExceptions(frameState.apop(), null);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
781 if (field instanceof ResolvedJavaField && ((ResolvedJavaField) field).getDeclaringClass().isInitialized()) {
19854
4178f9830a27 Assign the state after when appending the node and not automatically in the main graph builder loop.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19838
diff changeset
782 genStoreField(receiver, (ResolvedJavaField) field, value);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
783 } else {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
784 handleUnresolvedStoreField(field, value, receiver);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
785 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
786 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
787
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
788 private void genGetStatic(JavaField field) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
789 Kind kind = field.getKind();
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
790 if (field instanceof ResolvedJavaField && ((ResolvedJavaType) field.getDeclaringClass()).isInitialized()) {
19787
7117697d11e1 refactored graph builder plugins into a separate class
Doug Simon <doug.simon@oracle.com>
parents: 19717
diff changeset
791 LoadFieldPlugin loadFieldPlugin = this.graphBuilderConfig.getPlugins().getLoadFieldPlugin();
19147
609480dfa0d8 Create ExplodeLoop plugin prototype. Special sort for blocks from bci block map builder for explode loop methods. Graph builder plugin for customizing static field accesses. New Truffle option TruffleExcludeAssertions default true that excludes assertion code from being partial evaluated in the new partial evaluator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19111
diff changeset
792 if (loadFieldPlugin == null || !loadFieldPlugin.apply((GraphBuilderContext) this, (ResolvedJavaField) field)) {
609480dfa0d8 Create ExplodeLoop plugin prototype. Special sort for blocks from bci block map builder for explode loop methods. Graph builder plugin for customizing static field accesses. New Truffle option TruffleExcludeAssertions default true that excludes assertion code from being partial evaluated in the new partial evaluator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19111
diff changeset
793 appendOptimizedLoadField(kind, genLoadField(null, (ResolvedJavaField) field));
609480dfa0d8 Create ExplodeLoop plugin prototype. Special sort for blocks from bci block map builder for explode loop methods. Graph builder plugin for customizing static field accesses. New Truffle option TruffleExcludeAssertions default true that excludes assertion code from being partial evaluated in the new partial evaluator.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19111
diff changeset
794 }
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
795 } else {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
796 handleUnresolvedLoadField(field, null);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
797 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
798 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
799
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
800 public boolean tryLoadFieldPlugin(JavaField field, LoadFieldPlugin loadFieldPlugin) {
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
801 return loadFieldPlugin.apply((GraphBuilderContext) this, (ResolvedJavaField) field);
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
802 }
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
803
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
804 private void genPutStatic(JavaField field) {
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
805 ValueNode value = frameState.pop(field.getKind().getStackKind());
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
806 if (field instanceof ResolvedJavaField && ((ResolvedJavaType) field.getDeclaringClass()).isInitialized()) {
19854
4178f9830a27 Assign the state after when appending the node and not automatically in the main graph builder loop.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19838
diff changeset
807 genStoreField(null, (ResolvedJavaField) field, value);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
808 } else {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
809 handleUnresolvedStoreField(field, value, null);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
810 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
811 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
812
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
813 protected void appendOptimizedLoadField(Kind kind, ValueNode load) {
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
814 // append the load to the instruction
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
815 ValueNode optimized = append(load);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
816 frameState.push(kind.getStackKind(), optimized);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
817 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
818
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
819 protected abstract void genInvokeStatic(JavaMethod target);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
820
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
821 protected abstract void genInvokeInterface(JavaMethod target);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
822
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
823 protected abstract void genInvokeDynamic(JavaMethod target);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
824
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
825 protected abstract void genInvokeVirtual(JavaMethod target);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
826
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
827 protected abstract void genInvokeSpecial(JavaMethod target);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
828
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
829 protected abstract void genReturn(ValueNode x, Kind kind);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
830
19854
4178f9830a27 Assign the state after when appending the node and not automatically in the main graph builder loop.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19838
diff changeset
831 protected abstract void genMonitorEnter(ValueNode x, int bci);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
832
19854
4178f9830a27 Assign the state after when appending the node and not automatically in the main graph builder loop.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19838
diff changeset
833 protected abstract void genMonitorExit(ValueNode x, ValueNode returnValue, int bci);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
834
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
835 protected abstract void genJsr(int dest);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
836
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
837 protected abstract void genRet(int localIndex);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
838
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
839 private double[] switchProbability(int numberOfCases, int bci) {
19439
5be35dd0a9dd Disable use of profiling information during partial evaluation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19390
diff changeset
840 double[] prob = (profilingInfo == null ? null : profilingInfo.getSwitchProbabilities(bci));
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
841 if (prob != null) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
842 assert prob.length == numberOfCases;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
843 } else {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
844 Debug.log("Missing probability (switch) in %s at bci %d", method, bci);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
845 prob = new double[numberOfCases];
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
846 for (int i = 0; i < numberOfCases; i++) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
847 prob[i] = 1.0d / numberOfCases;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
848 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
849 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
850 assert allPositive(prob);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
851 return prob;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
852 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
853
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
854 private static boolean allPositive(double[] a) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
855 for (double d : a) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
856 if (d < 0) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
857 return false;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
858 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
859 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
860 return true;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
861 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
862
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
863 /**
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
864 * Helper function that sums up the probabilities of all keys that lead to a specific successor.
14899
e2a5528599e0 Merge (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14854 14896
diff changeset
865 *
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
866 * @return an array of size successorCount with the accumulated probability for each successor.
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
867 */
15028
7ee9decb2784 AbstractBytecodeParser: rework genIntegerSwitch.
Josef Eisl <josef.eisl@jku.at>
parents: 15027
diff changeset
868 public static double[] successorProbabilites(int successorCount, int[] keySuccessors, double[] keyProbabilities) {
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
869 double[] probability = new double[successorCount];
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
870 for (int i = 0; i < keySuccessors.length; i++) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
871 probability[keySuccessors[i]] += keyProbabilities[i];
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
872 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
873 return probability;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
874 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
875
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
876 private void genSwitch(BytecodeSwitch bs) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
877 int bci = bci();
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
878 ValueNode value = frameState.ipop();
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
879
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
880 int nofCases = bs.numberOfCases();
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
881 double[] keyProbabilities = switchProbability(nofCases + 1, bci);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
882
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
883 Map<Integer, SuccessorInfo> bciToBlockSuccessorIndex = new HashMap<>();
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
884 for (int i = 0; i < currentBlock.getSuccessorCount(); i++) {
19333
ae87324c37d6 Do not extend AbstractBlockBase with BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19239
diff changeset
885 assert !bciToBlockSuccessorIndex.containsKey(currentBlock.getSuccessor(i).startBci);
ae87324c37d6 Do not extend AbstractBlockBase with BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19239
diff changeset
886 if (!bciToBlockSuccessorIndex.containsKey(currentBlock.getSuccessor(i).startBci)) {
ae87324c37d6 Do not extend AbstractBlockBase with BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19239
diff changeset
887 bciToBlockSuccessorIndex.put(currentBlock.getSuccessor(i).startBci, new SuccessorInfo(i));
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
888 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
889 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
890
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
891 ArrayList<BciBlock> actualSuccessors = new ArrayList<>();
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
892 int[] keys = new int[nofCases];
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
893 int[] keySuccessors = new int[nofCases + 1];
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
894 int deoptSuccessorIndex = -1;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
895 int nextSuccessorIndex = 0;
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
896 boolean constantValue = value.isConstant();
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
897 for (int i = 0; i < nofCases + 1; i++) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
898 if (i < nofCases) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
899 keys[i] = bs.keyAt(i);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
900 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
901
19512
7f168e4c5dde Added flag FailedLoopExplosionIsFatal. Added support for graph builder canonicalization of integer switches.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19496
diff changeset
902 if (!constantValue && isNeverExecutedCode(keyProbabilities[i])) {
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
903 if (deoptSuccessorIndex < 0) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
904 deoptSuccessorIndex = nextSuccessorIndex++;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
905 actualSuccessors.add(null);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
906 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
907 keySuccessors[i] = deoptSuccessorIndex;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
908 } else {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
909 int targetBci = i >= nofCases ? bs.defaultTarget() : bs.targetAt(i);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
910 SuccessorInfo info = bciToBlockSuccessorIndex.get(targetBci);
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
911 if (info.actualIndex < 0) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
912 info.actualIndex = nextSuccessorIndex++;
19333
ae87324c37d6 Do not extend AbstractBlockBase with BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19239
diff changeset
913 actualSuccessors.add(currentBlock.getSuccessor(info.blockIndex));
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
914 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
915 keySuccessors[i] = info.actualIndex;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
916 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
917 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
918
15028
7ee9decb2784 AbstractBytecodeParser: rework genIntegerSwitch.
Josef Eisl <josef.eisl@jku.at>
parents: 15027
diff changeset
919 genIntegerSwitch(value, actualSuccessors, keys, keyProbabilities, keySuccessors);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
920
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
921 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
922
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
923 protected abstract void genIntegerSwitch(ValueNode value, ArrayList<BciBlock> actualSuccessors, int[] keys, double[] keyProbabilities, int[] keySuccessors);
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
924
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
925 private static class SuccessorInfo {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
926
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
927 int blockIndex;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
928 int actualIndex;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
929
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
930 public SuccessorInfo(int blockSuccessorIndex) {
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
931 this.blockIndex = blockSuccessorIndex;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
932 actualIndex = -1;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
933 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
934 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
935
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
936 protected abstract ValueNode appendConstant(JavaConstant constant);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
937
19951
a252927dfbfd Fix an issue when the result of canonicalization is appended in the graph builder. Introduce GraphBuilderPhase#recursiveAppend.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19886
diff changeset
938 protected abstract <T extends ValueNode> T append(T v);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
939
15030
e098038093d5 AbstractBytecodeParser: move createTarget to GraphBuilderPhase.
Josef Eisl <josef.eisl@jku.at>
parents: 15029
diff changeset
940 protected boolean isNeverExecutedCode(double probability) {
18920
4af661af76fd Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18918
diff changeset
941 return probability == 0 && optimisticOpts.removeNeverExecutedCode();
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
942 }
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
943
16886
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
944 protected double branchProbability() {
19439
5be35dd0a9dd Disable use of profiling information during partial evaluation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19390
diff changeset
945 if (profilingInfo == null) {
5be35dd0a9dd Disable use of profiling information during partial evaluation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19390
diff changeset
946 return 0.5;
5be35dd0a9dd Disable use of profiling information during partial evaluation.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19390
diff changeset
947 }
19456
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
948 assert assertAtIfBytecode();
16886
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
949 double probability = profilingInfo.getBranchTakenProbability(bci());
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
950 if (probability < 0) {
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
951 assert probability == -1 : "invalid probability";
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
952 Debug.log("missing probability in %s at bci %d", method, bci());
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
953 probability = 0.5;
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
954 }
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
955
18920
4af661af76fd Restructuring in the GraphBuilder to have less fields in the phase instance.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18918
diff changeset
956 if (!optimisticOpts.removeNeverExecutedCode()) {
16886
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
957 if (probability == 0) {
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
958 probability = 0.0000001;
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
959 } else if (probability == 1) {
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
960 probability = 0.999999;
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
961 }
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
962 }
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
963 return probability;
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
964 }
b61b88c9c103 Make handling of removeNeverExecutedCode more consistent
Tom Rodriguez <tom.rodriguez@oracle.com>
parents: 16841
diff changeset
965
19456
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
966 private boolean assertAtIfBytecode() {
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
967 int bytecode = stream.currentBC();
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
968 switch (bytecode) {
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
969 case IFEQ:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
970 case IFNE:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
971 case IFLT:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
972 case IFGE:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
973 case IFGT:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
974 case IFLE:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
975 case IF_ICMPEQ:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
976 case IF_ICMPNE:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
977 case IF_ICMPLT:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
978 case IF_ICMPGE:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
979 case IF_ICMPGT:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
980 case IF_ICMPLE:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
981 case IF_ACMPEQ:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
982 case IF_ACMPNE:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
983 case IFNULL:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
984 case IFNONNULL:
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
985 return true;
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
986 }
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
987 assert false : String.format("%x is not an if bytecode", bytecode);
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
988 return true;
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
989 }
f04d2a9f2020 Assert that current bci points to an if Java bytecode when branch taken probability is requested.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19440
diff changeset
990
14894
3676333a46bb Use BciBlock in BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents: 14893
diff changeset
991 protected abstract void iterateBytecodesForBlock(BciBlock block);
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
992
18817
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
993 public final void processBytecode(int bci, int opcode) {
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
994 int cpi;
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
995
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
996 // Checkstyle: stop
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
997 // @formatter:off
19994
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
998 switch (opcode) {
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
999 case NOP : /* nothing to do */ break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1000 case ACONST_NULL : frameState.apush(appendConstant(JavaConstant.NULL_POINTER)); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1001 case ICONST_M1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1002 case ICONST_0 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1003 case ICONST_1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1004 case ICONST_2 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1005 case ICONST_3 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1006 case ICONST_4 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1007 case ICONST_5 : frameState.ipush(appendConstant(JavaConstant.forInt(opcode - ICONST_0))); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1008 case LCONST_0 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1009 case LCONST_1 : frameState.lpush(appendConstant(JavaConstant.forLong(opcode - LCONST_0))); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1010 case FCONST_0 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1011 case FCONST_1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1012 case FCONST_2 : frameState.fpush(appendConstant(JavaConstant.forFloat(opcode - FCONST_0))); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1013 case DCONST_0 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1014 case DCONST_1 : frameState.dpush(appendConstant(JavaConstant.forDouble(opcode - DCONST_0))); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1015 case BIPUSH : frameState.ipush(appendConstant(JavaConstant.forInt(stream.readByte()))); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1016 case SIPUSH : frameState.ipush(appendConstant(JavaConstant.forInt(stream.readShort()))); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1017 case LDC : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1018 case LDC_W : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1019 case LDC2_W : genLoadConstant(stream.readCPI(), opcode); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1020 case ILOAD : loadLocal(stream.readLocalIndex(), Kind.Int); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1021 case LLOAD : loadLocal(stream.readLocalIndex(), Kind.Long); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1022 case FLOAD : loadLocal(stream.readLocalIndex(), Kind.Float); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1023 case DLOAD : loadLocal(stream.readLocalIndex(), Kind.Double); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1024 case ALOAD : loadLocal(stream.readLocalIndex(), Kind.Object); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1025 case ILOAD_0 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1026 case ILOAD_1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1027 case ILOAD_2 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1028 case ILOAD_3 : loadLocal(opcode - ILOAD_0, Kind.Int); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1029 case LLOAD_0 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1030 case LLOAD_1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1031 case LLOAD_2 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1032 case LLOAD_3 : loadLocal(opcode - LLOAD_0, Kind.Long); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1033 case FLOAD_0 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1034 case FLOAD_1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1035 case FLOAD_2 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1036 case FLOAD_3 : loadLocal(opcode - FLOAD_0, Kind.Float); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1037 case DLOAD_0 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1038 case DLOAD_1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1039 case DLOAD_2 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1040 case DLOAD_3 : loadLocal(opcode - DLOAD_0, Kind.Double); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1041 case ALOAD_0 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1042 case ALOAD_1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1043 case ALOAD_2 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1044 case ALOAD_3 : loadLocal(opcode - ALOAD_0, Kind.Object); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1045 case IALOAD : genLoadIndexed(Kind.Int ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1046 case LALOAD : genLoadIndexed(Kind.Long ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1047 case FALOAD : genLoadIndexed(Kind.Float ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1048 case DALOAD : genLoadIndexed(Kind.Double); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1049 case AALOAD : genLoadIndexed(Kind.Object); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1050 case BALOAD : genLoadIndexed(Kind.Byte ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1051 case CALOAD : genLoadIndexed(Kind.Char ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1052 case SALOAD : genLoadIndexed(Kind.Short ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1053 case ISTORE : storeLocal(Kind.Int, stream.readLocalIndex()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1054 case LSTORE : storeLocal(Kind.Long, stream.readLocalIndex()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1055 case FSTORE : storeLocal(Kind.Float, stream.readLocalIndex()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1056 case DSTORE : storeLocal(Kind.Double, stream.readLocalIndex()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1057 case ASTORE : storeLocal(Kind.Object, stream.readLocalIndex()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1058 case ISTORE_0 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1059 case ISTORE_1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1060 case ISTORE_2 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1061 case ISTORE_3 : storeLocal(Kind.Int, opcode - ISTORE_0); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1062 case LSTORE_0 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1063 case LSTORE_1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1064 case LSTORE_2 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1065 case LSTORE_3 : storeLocal(Kind.Long, opcode - LSTORE_0); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1066 case FSTORE_0 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1067 case FSTORE_1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1068 case FSTORE_2 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1069 case FSTORE_3 : storeLocal(Kind.Float, opcode - FSTORE_0); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1070 case DSTORE_0 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1071 case DSTORE_1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1072 case DSTORE_2 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1073 case DSTORE_3 : storeLocal(Kind.Double, opcode - DSTORE_0); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1074 case ASTORE_0 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1075 case ASTORE_1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1076 case ASTORE_2 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1077 case ASTORE_3 : storeLocal(Kind.Object, opcode - ASTORE_0); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1078 case IASTORE : genStoreIndexed(Kind.Int ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1079 case LASTORE : genStoreIndexed(Kind.Long ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1080 case FASTORE : genStoreIndexed(Kind.Float ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1081 case DASTORE : genStoreIndexed(Kind.Double); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1082 case AASTORE : genStoreIndexed(Kind.Object); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1083 case BASTORE : genStoreIndexed(Kind.Byte ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1084 case CASTORE : genStoreIndexed(Kind.Char ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1085 case SASTORE : genStoreIndexed(Kind.Short ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1086 case POP : frameState.xpop(); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1087 case POP2 : frameState.xpop(); frameState.xpop(); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1088 case DUP : frameState.xpush(frameState.xpeek()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1089 case DUP_X1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1090 case DUP_X2 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1091 case DUP2 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1092 case DUP2_X1 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1093 case DUP2_X2 : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1094 case SWAP : stackOp(opcode); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1095 case IADD : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1096 case ISUB : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1097 case IMUL : genArithmeticOp(Kind.Int, opcode); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1098 case IDIV : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1099 case IREM : genIntegerDivOp(Kind.Int, opcode); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1100 case LADD : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1101 case LSUB : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1102 case LMUL : genArithmeticOp(Kind.Long, opcode); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1103 case LDIV : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1104 case LREM : genIntegerDivOp(Kind.Long, opcode); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1105 case FADD : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1106 case FSUB : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1107 case FMUL : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1108 case FDIV : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1109 case FREM : genArithmeticOp(Kind.Float, opcode); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1110 case DADD : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1111 case DSUB : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1112 case DMUL : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1113 case DDIV : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1114 case DREM : genArithmeticOp(Kind.Double, opcode); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1115 case INEG : genNegateOp(Kind.Int); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1116 case LNEG : genNegateOp(Kind.Long); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1117 case FNEG : genNegateOp(Kind.Float); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1118 case DNEG : genNegateOp(Kind.Double); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1119 case ISHL : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1120 case ISHR : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1121 case IUSHR : genShiftOp(Kind.Int, opcode); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1122 case IAND : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1123 case IOR : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1124 case IXOR : genLogicOp(Kind.Int, opcode); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1125 case LSHL : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1126 case LSHR : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1127 case LUSHR : genShiftOp(Kind.Long, opcode); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1128 case LAND : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1129 case LOR : // fall through
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1130 case LXOR : genLogicOp(Kind.Long, opcode); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1131 case IINC : genIncrement(); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1132 case I2F : genFloatConvert(FloatConvert.I2F, Kind.Int, Kind.Float); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1133 case I2D : genFloatConvert(FloatConvert.I2D, Kind.Int, Kind.Double); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1134 case L2F : genFloatConvert(FloatConvert.L2F, Kind.Long, Kind.Float); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1135 case L2D : genFloatConvert(FloatConvert.L2D, Kind.Long, Kind.Double); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1136 case F2I : genFloatConvert(FloatConvert.F2I, Kind.Float, Kind.Int); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1137 case F2L : genFloatConvert(FloatConvert.F2L, Kind.Float, Kind.Long); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1138 case F2D : genFloatConvert(FloatConvert.F2D, Kind.Float, Kind.Double); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1139 case D2I : genFloatConvert(FloatConvert.D2I, Kind.Double, Kind.Int); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1140 case D2L : genFloatConvert(FloatConvert.D2L, Kind.Double, Kind.Long); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1141 case D2F : genFloatConvert(FloatConvert.D2F, Kind.Double, Kind.Float); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1142 case L2I : genNarrow(Kind.Long, Kind.Int); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1143 case I2L : genSignExtend(Kind.Int, Kind.Long); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1144 case I2B : genSignExtend(Kind.Byte, Kind.Int); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1145 case I2S : genSignExtend(Kind.Short, Kind.Int); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1146 case I2C : genZeroExtend(Kind.Char, Kind.Int); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1147 case LCMP : genCompareOp(Kind.Long, false); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1148 case FCMPL : genCompareOp(Kind.Float, true); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1149 case FCMPG : genCompareOp(Kind.Float, false); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1150 case DCMPL : genCompareOp(Kind.Double, true); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1151 case DCMPG : genCompareOp(Kind.Double, false); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1152 case IFEQ : genIfZero(Condition.EQ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1153 case IFNE : genIfZero(Condition.NE); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1154 case IFLT : genIfZero(Condition.LT); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1155 case IFGE : genIfZero(Condition.GE); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1156 case IFGT : genIfZero(Condition.GT); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1157 case IFLE : genIfZero(Condition.LE); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1158 case IF_ICMPEQ : genIfSame(Kind.Int, Condition.EQ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1159 case IF_ICMPNE : genIfSame(Kind.Int, Condition.NE); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1160 case IF_ICMPLT : genIfSame(Kind.Int, Condition.LT); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1161 case IF_ICMPGE : genIfSame(Kind.Int, Condition.GE); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1162 case IF_ICMPGT : genIfSame(Kind.Int, Condition.GT); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1163 case IF_ICMPLE : genIfSame(Kind.Int, Condition.LE); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1164 case IF_ACMPEQ : genIfSame(Kind.Object, Condition.EQ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1165 case IF_ACMPNE : genIfSame(Kind.Object, Condition.NE); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1166 case GOTO : genGoto(); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1167 case JSR : genJsr(stream.readBranchDest()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1168 case RET : genRet(stream.readLocalIndex()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1169 case TABLESWITCH : genSwitch(new BytecodeTableSwitch(getStream(), bci())); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1170 case LOOKUPSWITCH : genSwitch(new BytecodeLookupSwitch(getStream(), bci())); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1171 case IRETURN : genReturn(frameState.ipop(), Kind.Int); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1172 case LRETURN : genReturn(frameState.lpop(), Kind.Long); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1173 case FRETURN : genReturn(frameState.fpop(), Kind.Float); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1174 case DRETURN : genReturn(frameState.dpop(), Kind.Double); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1175 case ARETURN : genReturn(frameState.apop(), Kind.Object); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1176 case RETURN : genReturn(null, Kind.Void); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1177 case GETSTATIC : cpi = stream.readCPI(); genGetStatic(lookupField(cpi, opcode)); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1178 case PUTSTATIC : cpi = stream.readCPI(); genPutStatic(lookupField(cpi, opcode)); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1179 case GETFIELD : cpi = stream.readCPI(); genGetField(lookupField(cpi, opcode)); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1180 case PUTFIELD : cpi = stream.readCPI(); genPutField(lookupField(cpi, opcode)); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1181 case INVOKEVIRTUAL : cpi = stream.readCPI(); genInvokeVirtual(lookupMethod(cpi, opcode)); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1182 case INVOKESPECIAL : cpi = stream.readCPI(); genInvokeSpecial(lookupMethod(cpi, opcode)); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1183 case INVOKESTATIC : cpi = stream.readCPI(); genInvokeStatic(lookupMethod(cpi, opcode)); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1184 case INVOKEINTERFACE: cpi = stream.readCPI(); genInvokeInterface(lookupMethod(cpi, opcode)); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1185 case INVOKEDYNAMIC : cpi = stream.readCPI4(); genInvokeDynamic(lookupMethod(cpi, opcode)); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1186 case NEW : genNewInstance(stream.readCPI()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1187 case NEWARRAY : genNewPrimitiveArray(stream.readLocalIndex()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1188 case ANEWARRAY : genNewObjectArray(stream.readCPI()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1189 case ARRAYLENGTH : genArrayLength(); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1190 case ATHROW : genThrow(); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1191 case CHECKCAST : genCheckCast(); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1192 case INSTANCEOF : genInstanceOf(); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1193 case MONITORENTER : genMonitorEnter(frameState.apop(), stream.nextBCI()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1194 case MONITOREXIT : genMonitorExit(frameState.apop(), null, stream.nextBCI()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1195 case MULTIANEWARRAY : genNewMultiArray(stream.readCPI()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1196 case IFNULL : genIfNull(Condition.EQ); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1197 case IFNONNULL : genIfNull(Condition.NE); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1198 case GOTO_W : genGoto(); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1199 case JSR_W : genJsr(stream.readBranchDest()); break;
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1200 case BREAKPOINT:
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1201 throw new BailoutException("concurrent setting of breakpoint");
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1202 default:
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1203 throw new BailoutException("Unsupported opcode %d (%s) [bci=%d]", opcode, nameOf(opcode), bci);
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1204 }
aaf5039e56d7 made partial intrinsification work (i.e., intrinsics that call the original method to handle slow/uncommon paths)
Doug Simon <doug.simon@oracle.com>
parents: 19962
diff changeset
1205 // @formatter:on
14892
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
1206 // Checkstyle: resume
75104db5215e Move Bytecode parsing into BytecodeParseHelper (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14830
diff changeset
1207 }
14893
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
1208
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
1209 private void genArrayLength() {
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
1210 frameState.ipush(append(genArrayLength(frameState.apop())));
f97c85e6366d Finished cleaning up BytecodeParseHelper abstract base class.
Josef Eisl <josef.eisl@jku.at>
parents: 14892
diff changeset
1211 }
14899
e2a5528599e0 Merge (defunc).
Josef Eisl <josef.eisl@jku.at>
parents: 14854 14896
diff changeset
1212
14900
be4c28683c08 Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents: 14899
diff changeset
1213 public ResolvedJavaMethod getMethod() {
be4c28683c08 Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents: 14899
diff changeset
1214 return method;
be4c28683c08 Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents: 14899
diff changeset
1215 }
be4c28683c08 Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents: 14899
diff changeset
1216
19535
97b35083d49d Reduce casting in AbstractBytecodeParser. Consolidate asserts in HIRFrameStateBuilder.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19512
diff changeset
1217 public HIRFrameStateBuilder getFrameState() {
14900
be4c28683c08 Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents: 14899
diff changeset
1218 return frameState;
be4c28683c08 Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents: 14899
diff changeset
1219 }
be4c28683c08 Moved bytecode parsing from GraphBuilderPhase to BytecodeParseHelper.
Josef Eisl <josef.eisl@jku.at>
parents: 14899
diff changeset
1220
19387
fc390dcb0ba5 Enable bytecode instruction level tracing only when assertions are enabled.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19333
diff changeset
1221 protected boolean traceInstruction(int bci, int opcode, boolean blockStart) {
18817
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1222 if (Debug.isEnabled() && Options.TraceBytecodeParserLevel.getValue() >= TRACELEVEL_INSTRUCTIONS && Debug.isLogEnabled()) {
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1223 traceInstructionHelper(bci, opcode, blockStart);
14922
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
1224 }
19387
fc390dcb0ba5 Enable bytecode instruction level tracing only when assertions are enabled.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 19333
diff changeset
1225 return true;
14922
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
1226 }
ea57ed7085cf Move options from GraphBuilderPhase to AbstractBytecodeParser.
Josef Eisl <josef.eisl@jku.at>
parents: 14902
diff changeset
1227
18817
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1228 private void traceInstructionHelper(int bci, int opcode, boolean blockStart) {
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1229 StringBuilder sb = new StringBuilder(40);
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1230 sb.append(blockStart ? '+' : '|');
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1231 if (bci < 10) {
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1232 sb.append(" ");
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1233 } else if (bci < 100) {
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1234 sb.append(' ');
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1235 }
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1236 sb.append(bci).append(": ").append(Bytecodes.nameOf(opcode));
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1237 for (int i = bci + 1; i < stream.nextBCI(); ++i) {
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1238 sb.append(' ').append(stream.readUByte(i));
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1239 }
18818
adf3a8581a67 Factor JSR info data into separate data structure from BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18817
diff changeset
1240 if (!currentBlock.getJsrScope().isEmpty()) {
adf3a8581a67 Factor JSR info data into separate data structure from BciBlock.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18817
diff changeset
1241 sb.append(' ').append(currentBlock.getJsrScope());
18817
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1242 }
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1243 Debug.log("%s", sb);
b51cfbc2bd07 Make allocation of loop header array in BciBlockMapping lazy.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 18674
diff changeset
1244 }
19791
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
1245
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
1246 public boolean parsingReplacement() {
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
1247 return replacementContext != null;
14e703edb2ab use GraphBuilderPlugins for method substitutions, intrinsics and snippets (GRAAL-982)
Doug Simon <doug.simon@oracle.com>
parents: 19787
diff changeset
1248 }
14818
3d04915a55c6 added kindinterface for valuenode and variable and started to generalize some methods used for bytecodeparsing
Niclas Adlertz <niclas.adlertz@oracle.com>
parents:
diff changeset
1249 }