< prev index next >

src/jdk.internal.vm.compiler/share/classes/org.graalvm.compiler.replacements/src/org/graalvm/compiler/replacements/PEGraphDecoder.java

Print this page
rev 52509 : [mq]: graal


   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.replacements;
  26 
  27 import java.net.URI;
  28 import static org.graalvm.compiler.debug.GraalError.unimplemented;
  29 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_IGNORED;
  30 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_IGNORED;
  31 

  32 import java.util.ArrayList;
  33 import java.util.Arrays;

  34 import java.util.HashMap;
  35 import java.util.List;
  36 import java.util.Map;
  37 
  38 import jdk.internal.vm.compiler.collections.EconomicMap;
  39 import jdk.internal.vm.compiler.collections.Equivalence;
  40 import org.graalvm.compiler.api.replacements.Fold;
  41 import org.graalvm.compiler.bytecode.Bytecode;
  42 import org.graalvm.compiler.bytecode.BytecodeProvider;

  43 import org.graalvm.compiler.core.common.PermanentBailoutException;
  44 import org.graalvm.compiler.core.common.cfg.CFGVerifier;
  45 import org.graalvm.compiler.core.common.spi.ConstantFieldProvider;
  46 import org.graalvm.compiler.core.common.type.Stamp;
  47 import org.graalvm.compiler.core.common.type.StampFactory;
  48 import org.graalvm.compiler.core.common.type.StampPair;
  49 import org.graalvm.compiler.debug.DebugCloseable;
  50 import org.graalvm.compiler.debug.DebugContext;
  51 import org.graalvm.compiler.debug.GraalError;
  52 import org.graalvm.compiler.graph.Node;
  53 import org.graalvm.compiler.graph.Node.NodeIntrinsic;
  54 import org.graalvm.compiler.graph.NodeClass;
  55 import org.graalvm.compiler.graph.NodeSourcePosition;
  56 import org.graalvm.compiler.graph.SourceLanguagePosition;
  57 import org.graalvm.compiler.graph.SourceLanguagePositionProvider;
  58 import org.graalvm.compiler.graph.spi.Canonicalizable;
  59 import org.graalvm.compiler.java.GraphBuilderPhase;
  60 import org.graalvm.compiler.nodeinfo.NodeInfo;
  61 import org.graalvm.compiler.nodes.AbstractBeginNode;
  62 import org.graalvm.compiler.nodes.AbstractMergeNode;


 381         }
 382 
 383         @Override
 384         public ResolvedJavaMethod getMethod() {
 385             throw unimplemented();
 386         }
 387 
 388         @Override
 389         public int bci() {
 390             return invoke.bci();
 391         }
 392 
 393         @Override
 394         public InvokeKind getInvokeKind() {
 395             throw unimplemented();
 396         }
 397 
 398         @Override
 399         public JavaType getInvokeReturnType() {
 400             throw unimplemented();












 401         }
 402     }
 403 
 404     protected class PEAppendGraphBuilderContext extends PENonAppendGraphBuilderContext {
 405         protected FixedWithNextNode lastInstr;
 406         protected ValueNode pushedNode;
 407         protected boolean invokeConsumed;
 408 
 409         public PEAppendGraphBuilderContext(PEMethodScope inlineScope, FixedWithNextNode lastInstr) {
 410             super(inlineScope, inlineScope.invokeData != null ? inlineScope.invokeData.invoke : null);
 411             this.lastInstr = lastInstr;
 412         }
 413 
 414         @Override
 415         public void push(JavaKind kind, ValueNode value) {
 416             if (pushedNode != null) {
 417                 throw unimplemented("Only one push is supported");
 418             }
 419             pushedNode = value;
 420         }




   7  * published by the Free Software Foundation.
   8  *
   9  * This code is distributed in the hope that it will be useful, but WITHOUT
  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 
  25 package org.graalvm.compiler.replacements;
  26 

  27 import static org.graalvm.compiler.debug.GraalError.unimplemented;
  28 import static org.graalvm.compiler.nodeinfo.NodeCycles.CYCLES_IGNORED;
  29 import static org.graalvm.compiler.nodeinfo.NodeSize.SIZE_IGNORED;
  30 
  31 import java.net.URI;
  32 import java.util.ArrayList;
  33 import java.util.Arrays;
  34 import java.util.Formatter;
  35 import java.util.HashMap;
  36 import java.util.List;
  37 import java.util.Map;
  38 
  39 import jdk.internal.vm.compiler.collections.EconomicMap;
  40 import jdk.internal.vm.compiler.collections.Equivalence;
  41 import org.graalvm.compiler.api.replacements.Fold;
  42 import org.graalvm.compiler.bytecode.Bytecode;
  43 import org.graalvm.compiler.bytecode.BytecodeProvider;
  44 import org.graalvm.compiler.bytecode.ResolvedJavaMethodBytecode;
  45 import org.graalvm.compiler.core.common.PermanentBailoutException;
  46 import org.graalvm.compiler.core.common.cfg.CFGVerifier;
  47 import org.graalvm.compiler.core.common.spi.ConstantFieldProvider;
  48 import org.graalvm.compiler.core.common.type.Stamp;
  49 import org.graalvm.compiler.core.common.type.StampFactory;
  50 import org.graalvm.compiler.core.common.type.StampPair;
  51 import org.graalvm.compiler.debug.DebugCloseable;
  52 import org.graalvm.compiler.debug.DebugContext;
  53 import org.graalvm.compiler.debug.GraalError;
  54 import org.graalvm.compiler.graph.Node;
  55 import org.graalvm.compiler.graph.Node.NodeIntrinsic;
  56 import org.graalvm.compiler.graph.NodeClass;
  57 import org.graalvm.compiler.graph.NodeSourcePosition;
  58 import org.graalvm.compiler.graph.SourceLanguagePosition;
  59 import org.graalvm.compiler.graph.SourceLanguagePositionProvider;
  60 import org.graalvm.compiler.graph.spi.Canonicalizable;
  61 import org.graalvm.compiler.java.GraphBuilderPhase;
  62 import org.graalvm.compiler.nodeinfo.NodeInfo;
  63 import org.graalvm.compiler.nodes.AbstractBeginNode;
  64 import org.graalvm.compiler.nodes.AbstractMergeNode;


 383         }
 384 
 385         @Override
 386         public ResolvedJavaMethod getMethod() {
 387             throw unimplemented();
 388         }
 389 
 390         @Override
 391         public int bci() {
 392             return invoke.bci();
 393         }
 394 
 395         @Override
 396         public InvokeKind getInvokeKind() {
 397             throw unimplemented();
 398         }
 399 
 400         @Override
 401         public JavaType getInvokeReturnType() {
 402             throw unimplemented();
 403         }
 404 
 405         @Override
 406         public String toString() {
 407             Formatter fmt = new Formatter();
 408             PEMethodScope scope = this.methodScope;
 409             fmt.format("%s", new ResolvedJavaMethodBytecode(scope.method).asStackTraceElement(invoke.bci()));
 410             NodeSourcePosition callers = scope.getCallerBytecodePosition();
 411             if (callers != null) {
 412                 fmt.format("%n%s", callers);
 413             }
 414             return fmt.toString();
 415         }
 416     }
 417 
 418     protected class PEAppendGraphBuilderContext extends PENonAppendGraphBuilderContext {
 419         protected FixedWithNextNode lastInstr;
 420         protected ValueNode pushedNode;
 421         protected boolean invokeConsumed;
 422 
 423         public PEAppendGraphBuilderContext(PEMethodScope inlineScope, FixedWithNextNode lastInstr) {
 424             super(inlineScope, inlineScope.invokeData != null ? inlineScope.invokeData.invoke : null);
 425             this.lastInstr = lastInstr;
 426         }
 427 
 428         @Override
 429         public void push(JavaKind kind, ValueNode value) {
 430             if (pushedNode != null) {
 431                 throw unimplemented("Only one push is supported");
 432             }
 433             pushedNode = value;
 434         }


< prev index next >