annotate graal/com.oracle.graal.interpreter/src/com/oracle/graal/interpreter/BytecodeInterpreter.java @ 7054:5d4676ae84a4

removed usages of ResolvedJavaType.toJava() from bytecode interpreter
author Doug Simon <doug.simon@oracle.com>
date Tue, 27 Nov 2012 18:30:20 +0100
parents 62818f156081
children 06d5f450f32b
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved.
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.interpreter;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
25 import java.lang.reflect.*;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
26 import java.util.*;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
27
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
28 import com.oracle.graal.api.interpreter.*;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
29 import com.oracle.graal.api.meta.*;
6540
31aa76ffd3bb Rename project graal.api to graal.api.runtime
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6539
diff changeset
30 import com.oracle.graal.api.runtime.*;
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
31 import com.oracle.graal.bytecode.*;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
33 /**
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
34 * High-level bytecode interpreter that executes on top of Java. Java native methods
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
35 * are executed using the {@link com.oracle.graal.api.interpreter.RuntimeInterpreterInterface}.
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
36 */
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
37 @SuppressWarnings("static-method")
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
38 public final class BytecodeInterpreter implements Interpreter {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
39
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
40 private static final String OPTION_MAX_STACK_SIZE = "maxStackSize";
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
41 private static final boolean TRACE = false;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
42 private static final boolean TRACE_BYTE_CODE = false;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
43
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
44 private static final int DEFAULT_MAX_STACK_SIZE = 1500;
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
45
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
46 private static final int NEXT = -1;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
47 private static final int BRANCH = -2;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
48 private static final int RETURN = -3;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
49 private static final int CALL = -4;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
50
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
51 private InterpreterFrame callFrame;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
52
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
53 private Map<ResolvedJavaMethod, MethodRedirectionInfo> methodDelegates;
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
54
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
55 private int maxStackFrames;
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
56
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
57 private ResolvedJavaMethod rootMethod;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
58 private RuntimeInterpreterInterface runtimeInterface;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
59 private MetaAccessProvider metaAccessProvider;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
60
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
61 public boolean initialize(String args) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
62 methodDelegates = new HashMap<>();
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
63 maxStackFrames = DEFAULT_MAX_STACK_SIZE;
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
64
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
65 GraalRuntime runtime = Graal.getRuntime();
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
66 this.runtimeInterface = runtime.getCapability(RuntimeInterpreterInterface.class);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
67 if (this.runtimeInterface == null) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
68 throw new UnsupportedOperationException("The provided graal runtime does not support the required capability " + RuntimeInterpreterInterface.class.getName() + ".");
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
69 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
70 this.metaAccessProvider = runtime.getCapability(MetaAccessProvider.class);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
71 if (this.metaAccessProvider == null) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
72 throw new UnsupportedOperationException("The provided graal runtime does not support the required capability " + MetaAccessProvider.class.getName() + ".");
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
73 }
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
74
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
75 this.rootMethod = resolveRootMethod();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
76 registerDelegates();
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
77 return parseArguments(args);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
78 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
79
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
80 @Override
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
81 public void setOption(String name, String value) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
82 if (name != null && name.equals(OPTION_MAX_STACK_SIZE)) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
83 this.maxStackFrames = Integer.parseInt(value);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
84 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
85 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
86
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
87 private void registerDelegates() {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
88 addDelegate(findMethod(Throwable.class, "fillInStackTrace"), new InterpreterCallable() {
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
89
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
90 @Override
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
91 public Object invoke(InterpreterFrame caller, ResolvedJavaMethod method, Object[] arguments) throws Throwable {
7054
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
92 setBackTrace(caller, (Throwable) arguments[0], createStackTraceElements(caller, runtimeInterface));
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
93 return null;
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
94 }
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
95 });
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
96 addDelegate(findMethod(Throwable.class, "getStackTraceDepth"), new InterpreterCallable() {
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
97
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
98 @Override
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
99 public Object invoke(InterpreterFrame caller, ResolvedJavaMethod method, Object[] arguments) throws Throwable {
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
100 StackTraceElement[] elements = getBackTrace(caller, (Throwable) arguments[0]);
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
101 if (elements != null) {
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
102 return elements.length;
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
103 }
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
104 return 0;
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
105 }
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
106 });
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
107 addDelegate(findMethod(Throwable.class, "getStackTraceElement", int.class), new InterpreterCallable() {
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
108
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
109 @Override
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
110 public Object invoke(InterpreterFrame caller, ResolvedJavaMethod method, Object[] arguments) throws Throwable {
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
111 StackTraceElement[] elements = getBackTrace(caller, (Throwable) arguments[0]);
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
112 if (elements != null) {
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
113 Integer index = (Integer) arguments[0];
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
114 if (index != null) {
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
115 return elements[index];
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
116 }
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
117 }
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
118 return null;
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
119 }
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
120 });
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
121 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
122
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
123 @SuppressWarnings("unused")
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
124 private boolean parseArguments(String stringArgs) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
125 // TODO: parse the arguments
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
126 return true;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
127 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
128
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
129 public void setMaxStackFrames(int maxStackSize) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
130 this.maxStackFrames = maxStackSize;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
131 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
132
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
133 public int getMaxStackFrames() {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
134 return maxStackFrames;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
135 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
136
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
137 public void addDelegate(Method method, InterpreterCallable callable) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
138 ResolvedJavaMethod resolvedMethod = metaAccessProvider.lookupJavaMethod(method);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
139 if (methodDelegates.containsKey(resolvedMethod)) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
140 throw new IllegalArgumentException("Delegate for method " + method + " already added.");
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
141 }
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
142
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
143 methodDelegates.put(resolvedMethod, new MethodRedirectionInfo(callable));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
144 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
145
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
146 public void removeDelegate(Method method) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
147 methodDelegates.remove(metaAccessProvider.lookupJavaMethod(method));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
148 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
149
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
150 @Override
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
151 public Object execute(ResolvedJavaMethod method, Object... boxedArguments) throws Throwable {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
152 try {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
153 boolean receiver = hasReceiver(method);
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
154 Signature signature = method.getSignature();
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
155 assert boxedArguments != null;
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
156 assert signature.getParameterCount(receiver) == boxedArguments.length;
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
157
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
158 if (TRACE) {
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
159 trace(0, "Executing root method " + method);
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
160 }
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
161
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
162 InterpreterFrame rootFrame = new InterpreterFrame(rootMethod, signature.getParameterSlots(true));
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
163 rootFrame.pushObject(this);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
164 rootFrame.pushObject(method);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
165 rootFrame.pushObject(boxedArguments);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
166
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
167 int index = 0;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
168 if (receiver) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
169 pushAsObject(rootFrame, Kind.Object, boxedArguments[index]);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
170 index++;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
171 }
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
172
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
173 for (int i = 0; index < boxedArguments.length; i++, index++) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
174 pushAsObject(rootFrame, signature.getParameterKind(i), boxedArguments[index]);
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
175 }
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
176
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
177 InterpreterFrame frame = rootFrame.create(method, receiver);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
178 executeRoot(rootFrame, frame);
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
179 return popAsObject(rootFrame, signature.getReturnKind());
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
180 } catch (Exception e) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
181 // TODO (chaeubl): remove this exception handler (only used for debugging)
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
182 throw e;
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
183 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
184 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
185
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
186 public Object execute(Method javaMethod, Object... boxedArguments) throws Throwable {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
187 return execute(metaAccessProvider.lookupJavaMethod(javaMethod), boxedArguments);
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
188 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
189
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
190 private boolean hasReceiver(ResolvedJavaMethod method) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
191 return !Modifier.isStatic(method.getModifiers());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
192 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
193
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
194 private void executeRoot(InterpreterFrame root, InterpreterFrame frame) throws Throwable {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
195 // TODO reflection redirection
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
196 InterpreterFrame prevFrame = frame;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
197 InterpreterFrame currentFrame = frame;
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
198 BytecodeStream bs = new BytecodeStream(currentFrame.getMethod().getCode());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
199 if (TRACE) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
200 traceCall(frame, "Call");
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
201 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
202 while (currentFrame != root) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
203 if (prevFrame != currentFrame) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
204 bs = new BytecodeStream(currentFrame.getMethod().getCode());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
205 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
206 bs.setBCI(currentFrame.getBCI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
207
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
208 prevFrame = currentFrame;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
209 currentFrame = loop(root, prevFrame, bs);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
210 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
211 assert callFrame == null;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
212 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
213
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
214 private InterpreterFrame loop(InterpreterFrame root, final InterpreterFrame frame, final BytecodeStream bs) throws Throwable {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
215 try {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
216 while (true) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
217 int result = executeInstruction(frame, bs);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
218 switch (result) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
219 case NEXT:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
220 bs.next();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
221 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
222 case RETURN:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
223 return popFrame(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
224 case CALL:
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
225 return allocateFrame(frame, bs);
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
226 case BRANCH:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
227 bs.setBCI(bs.readBranchDest());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
228 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
229 default:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
230 // the outcome depends on stack values
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
231 assert result >= 0 : "negative branch target";
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
232 bs.setBCI(result);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
233 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
234 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
235 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
236 } catch (Throwable t) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
237 if (TRACE) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
238 traceOp(frame, "Exception " + t.toString());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
239 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
240 updateStackTrace(frame, t);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
241
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
242 // frame bci needs to be in sync when handling exceptions
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
243 frame.setBCI(bs.currentBCI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
244
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
245 InterpreterFrame handlerFrame = handleThrowable(root, frame, t);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
246 if (handlerFrame == null) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
247 // matched root we just throw it again.
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
248 throw t;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
249 } else {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
250 if (TRACE) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
251 traceOp(frame, "Handler found " + handlerFrame.getMethod() + ":" + handlerFrame.getBCI());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
252 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
253 // update bci from frame
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
254 bs.setBCI(handlerFrame.getBCI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
255
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
256 // continue execution on the found frame
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
257 return handlerFrame;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
258 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
259 } finally {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
260 // TODO may be not necessary.
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
261 frame.setBCI(bs.currentBCI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
262 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
263 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
264
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
265 private int executeInstruction(InterpreterFrame frame, BytecodeStream bs) throws Throwable {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
266 if (TRACE_BYTE_CODE) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
267 traceOp(frame, bs.currentBCI() + ": " + Bytecodes.baseNameOf(bs.currentBC()));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
268 }
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
269 switch (bs.currentBC()) {
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
270 case Bytecodes.NOP:
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
271 break;
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
272 case Bytecodes.ACONST_NULL:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
273 frame.pushObject(null);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
274 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
275 case Bytecodes.ICONST_M1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
276 frame.pushInt(-1);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
277 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
278 case Bytecodes.ICONST_0:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
279 frame.pushInt(0);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
280 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
281 case Bytecodes.ICONST_1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
282 frame.pushInt(1);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
283 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
284 case Bytecodes.ICONST_2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
285 frame.pushInt(2);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
286 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
287 case Bytecodes.ICONST_3:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
288 frame.pushInt(3);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
289 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
290 case Bytecodes.ICONST_4:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
291 frame.pushInt(4);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
292 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
293 case Bytecodes.ICONST_5:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
294 frame.pushInt(5);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
295 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
296 case Bytecodes.LCONST_0:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
297 frame.pushLong(0L);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
298 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
299 case Bytecodes.LCONST_1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
300 frame.pushLong(1L);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
301 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
302 case Bytecodes.FCONST_0:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
303 frame.pushFloat(0.0F);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
304 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
305 case Bytecodes.FCONST_1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
306 frame.pushFloat(1.0F);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
307 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
308 case Bytecodes.FCONST_2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
309 frame.pushFloat(2.0F);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
310 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
311 case Bytecodes.DCONST_0:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
312 frame.pushDouble(0.0D);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
313 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
314 case Bytecodes.DCONST_1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
315 frame.pushDouble(1.0D);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
316 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
317 case Bytecodes.BIPUSH:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
318 frame.pushInt(bs.readByte());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
319 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
320 case Bytecodes.SIPUSH:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
321 frame.pushInt(bs.readShort());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
322 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
323 case Bytecodes.LDC:
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
324 case Bytecodes.LDC_W:
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
325 case Bytecodes.LDC2_W:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
326 pushCPConstant(frame, bs.readCPI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
327 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
328 case Bytecodes.ILOAD:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
329 frame.pushInt(frame.getInt(frame.resolveLocalIndex(bs.readLocalIndex())));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
330 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
331 case Bytecodes.LLOAD:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
332 frame.pushLong(frame.getLong(frame.resolveLocalIndex(bs.readLocalIndex())));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
333 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
334 case Bytecodes.FLOAD:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
335 frame.pushFloat(frame.getFloat(frame.resolveLocalIndex(bs.readLocalIndex())));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
336 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
337 case Bytecodes.DLOAD:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
338 frame.pushDouble(frame.getDouble(frame.resolveLocalIndex(bs.readLocalIndex())));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
339 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
340 case Bytecodes.ALOAD:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
341 frame.pushObject(frame.getObject(frame.resolveLocalIndex(bs.readLocalIndex())));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
342 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
343 case Bytecodes.ILOAD_0:
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
344 frame.pushInt(frame.getInt(frame.resolveLocalIndex(0)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
345 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
346 case Bytecodes.ILOAD_1:
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
347 frame.pushInt(frame.getInt(frame.resolveLocalIndex(1)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
348 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
349 case Bytecodes.ILOAD_2:
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
350 frame.pushInt(frame.getInt(frame.resolveLocalIndex(2)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
351 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
352 case Bytecodes.ILOAD_3:
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
353 frame.pushInt(frame.getInt(frame.resolveLocalIndex(3)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
354 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
355 case Bytecodes.LLOAD_0:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
356 frame.pushLong(frame.getLong(frame.resolveLocalIndex(0)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
357 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
358 case Bytecodes.LLOAD_1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
359 frame.pushLong(frame.getLong(frame.resolveLocalIndex(1)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
360 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
361 case Bytecodes.LLOAD_2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
362 frame.pushLong(frame.getLong(frame.resolveLocalIndex(2)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
363 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
364 case Bytecodes.LLOAD_3:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
365 frame.pushLong(frame.getLong(frame.resolveLocalIndex(3)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
366 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
367 case Bytecodes.FLOAD_0:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
368 frame.pushFloat(frame.getFloat(frame.resolveLocalIndex(0)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
369 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
370 case Bytecodes.FLOAD_1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
371 frame.pushFloat(frame.getFloat(frame.resolveLocalIndex(1)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
372 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
373 case Bytecodes.FLOAD_2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
374 frame.pushFloat(frame.getFloat(frame.resolveLocalIndex(2)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
375 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
376 case Bytecodes.FLOAD_3:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
377 frame.pushFloat(frame.getFloat(frame.resolveLocalIndex(3)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
378 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
379 case Bytecodes.DLOAD_0:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
380 frame.pushDouble(frame.getDouble(frame.resolveLocalIndex(0)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
381 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
382 case Bytecodes.DLOAD_1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
383 frame.pushDouble(frame.getDouble(frame.resolveLocalIndex(1)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
384 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
385 case Bytecodes.DLOAD_2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
386 frame.pushDouble(frame.getDouble(frame.resolveLocalIndex(2)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
387 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
388 case Bytecodes.DLOAD_3:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
389 frame.pushDouble(frame.getDouble(frame.resolveLocalIndex(3)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
390 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
391 case Bytecodes.ALOAD_0:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
392 frame.pushObject(frame.getObject(frame.resolveLocalIndex(0)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
393 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
394 case Bytecodes.ALOAD_1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
395 frame.pushObject(frame.getObject(frame.resolveLocalIndex(1)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
396 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
397 case Bytecodes.ALOAD_2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
398 frame.pushObject(frame.getObject(frame.resolveLocalIndex(2)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
399 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
400 case Bytecodes.ALOAD_3:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
401 frame.pushObject(frame.getObject(frame.resolveLocalIndex(3)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
402 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
403 case Bytecodes.IALOAD:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
404 frame.pushInt(runtimeInterface.getArrayInt(frame.popInt(), frame.popObject()));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
405 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
406 case Bytecodes.LALOAD:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
407 frame.pushLong(runtimeInterface.getArrayLong(frame.popInt(), frame.popObject()));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
408 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
409 case Bytecodes.FALOAD:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
410 frame.pushFloat(runtimeInterface.getArrayFloat(frame.popInt(), frame.popObject()));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
411 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
412 case Bytecodes.DALOAD:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
413 frame.pushDouble(runtimeInterface.getArrayDouble(frame.popInt(), frame.popObject()));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
414 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
415 case Bytecodes.AALOAD:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
416 frame.pushObject(runtimeInterface.getArrayObject(frame.popInt(), frame.popObject()));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
417 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
418 case Bytecodes.BALOAD:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
419 frame.pushInt(runtimeInterface.getArrayByte(frame.popInt(), frame.popObject()));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
420 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
421 case Bytecodes.CALOAD:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
422 frame.pushInt(runtimeInterface.getArrayChar(frame.popInt(), frame.popObject()));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
423 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
424 case Bytecodes.SALOAD:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
425 frame.pushInt(runtimeInterface.getArrayShort(frame.popInt(), frame.popObject()));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
426 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
427 case Bytecodes.ISTORE:
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
428 frame.setInt(frame.resolveLocalIndex(bs.readLocalIndex()), frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
429 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
430 case Bytecodes.LSTORE:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
431 frame.setLong(frame.resolveLocalIndex(bs.readLocalIndex()), frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
432 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
433 case Bytecodes.FSTORE:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
434 frame.setFloat(frame.resolveLocalIndex(bs.readLocalIndex()), frame.popFloat());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
435 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
436 case Bytecodes.DSTORE:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
437 frame.setDouble(frame.resolveLocalIndex(bs.readLocalIndex()), frame.popDouble());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
438 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
439 case Bytecodes.ASTORE:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
440 frame.setObject(frame.resolveLocalIndex(bs.readLocalIndex()), frame.popObject());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
441 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
442 case Bytecodes.ISTORE_0:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
443 frame.setInt(frame.resolveLocalIndex(0), frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
444 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
445 case Bytecodes.ISTORE_1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
446 frame.setInt(frame.resolveLocalIndex(1), frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
447 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
448 case Bytecodes.ISTORE_2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
449 frame.setInt(frame.resolveLocalIndex(2), frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
450 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
451 case Bytecodes.ISTORE_3:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
452 frame.setInt(frame.resolveLocalIndex(3), frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
453 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
454 case Bytecodes.LSTORE_0:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
455 frame.setLong(frame.resolveLocalIndex(0), frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
456 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
457 case Bytecodes.LSTORE_1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
458 frame.setLong(frame.resolveLocalIndex(1), frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
459 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
460 case Bytecodes.LSTORE_2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
461 frame.setLong(frame.resolveLocalIndex(2), frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
462 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
463 case Bytecodes.LSTORE_3:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
464 frame.setLong(frame.resolveLocalIndex(3), frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
465 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
466 case Bytecodes.FSTORE_0:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
467 frame.setFloat(frame.resolveLocalIndex(0), frame.popFloat());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
468 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
469 case Bytecodes.FSTORE_1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
470 frame.setFloat(frame.resolveLocalIndex(1), frame.popFloat());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
471 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
472 case Bytecodes.FSTORE_2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
473 frame.setFloat(frame.resolveLocalIndex(2), frame.popFloat());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
474 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
475 case Bytecodes.FSTORE_3:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
476 frame.setFloat(frame.resolveLocalIndex(3), frame.popFloat());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
477 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
478 case Bytecodes.DSTORE_0:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
479 frame.setDouble(frame.resolveLocalIndex(0), frame.popDouble());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
480 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
481 case Bytecodes.DSTORE_1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
482 frame.setDouble(frame.resolveLocalIndex(1), frame.popDouble());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
483 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
484 case Bytecodes.DSTORE_2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
485 frame.setDouble(frame.resolveLocalIndex(2), frame.popDouble());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
486 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
487 case Bytecodes.DSTORE_3:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
488 frame.setDouble(frame.resolveLocalIndex(3), frame.popDouble());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
489 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
490 case Bytecodes.ASTORE_0:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
491 frame.setObject(frame.resolveLocalIndex(0), frame.popObject());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
492 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
493 case Bytecodes.ASTORE_1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
494 frame.setObject(frame.resolveLocalIndex(1), frame.popObject());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
495 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
496 case Bytecodes.ASTORE_2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
497 frame.setObject(frame.resolveLocalIndex(2), frame.popObject());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
498 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
499 case Bytecodes.ASTORE_3:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
500 frame.setObject(frame.resolveLocalIndex(3), frame.popObject());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
501 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
502 case Bytecodes.IASTORE:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
503 runtimeInterface.setArrayInt(frame.popInt(), frame.popInt(), frame.popObject());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
504 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
505 case Bytecodes.LASTORE:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
506 runtimeInterface.setArrayLong(frame.popLong(), frame.popInt(), frame.popObject());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
507 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
508 case Bytecodes.FASTORE:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
509 runtimeInterface.setArrayFloat(frame.popFloat(), frame.popInt(), frame.popObject());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
510 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
511 case Bytecodes.DASTORE:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
512 runtimeInterface.setArrayDouble(frame.popDouble(), frame.popInt(), frame.popObject());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
513 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
514 case Bytecodes.AASTORE:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
515 runtimeInterface.setArrayObject(frame.popObject(), frame.popInt(), frame.popObject());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
516 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
517 case Bytecodes.BASTORE:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
518 runtimeInterface.setArrayByte((byte) frame.popInt(), frame.popInt(), frame.popObject());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
519 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
520 case Bytecodes.CASTORE:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
521 runtimeInterface.setArrayChar((char) frame.popInt(), frame.popInt(), frame.popObject());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
522 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
523 case Bytecodes.SASTORE:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
524 runtimeInterface.setArrayShort((short) frame.popInt(), frame.popInt(), frame.popObject());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
525 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
526 case Bytecodes.POP:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
527 frame.popVoid(1);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
528 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
529 case Bytecodes.POP2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
530 frame.popVoid(2);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
531 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
532 case Bytecodes.DUP:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
533 frame.dup(1);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
534 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
535 case Bytecodes.DUP_X1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
536 frame.dupx1();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
537 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
538 case Bytecodes.DUP_X2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
539 frame.dupx2();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
540 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
541 case Bytecodes.DUP2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
542 frame.dup(2);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
543 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
544 case Bytecodes.DUP2_X1:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
545 frame.dup2x1();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
546 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
547 case Bytecodes.DUP2_X2:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
548 frame.dup2x2();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
549 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
550 case Bytecodes.SWAP:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
551 frame.swapSingle();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
552 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
553 case Bytecodes.IADD:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
554 frame.pushInt(frame.popInt() + frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
555 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
556 case Bytecodes.LADD:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
557 frame.pushLong(frame.popLong() + frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
558 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
559 case Bytecodes.FADD:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
560 frame.pushFloat(frame.popFloat() + frame.popFloat());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
561 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
562 case Bytecodes.DADD:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
563 frame.pushDouble(frame.popDouble() + frame.popDouble());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
564 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
565 case Bytecodes.ISUB:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
566 frame.pushInt(-frame.popInt() + frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
567 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
568 case Bytecodes.LSUB:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
569 frame.pushLong(-frame.popLong() + frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
570 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
571 case Bytecodes.FSUB:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
572 frame.pushFloat(-frame.popFloat() + frame.popFloat());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
573 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
574 case Bytecodes.DSUB:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
575 frame.pushDouble(-frame.popDouble() + frame.popDouble());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
576 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
577 case Bytecodes.IMUL:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
578 frame.pushInt(frame.popInt() * frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
579 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
580 case Bytecodes.LMUL:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
581 frame.pushLong(frame.popLong() * frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
582 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
583 case Bytecodes.FMUL:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
584 frame.pushFloat(frame.popFloat() * frame.popFloat());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
585 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
586 case Bytecodes.DMUL:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
587 frame.pushDouble(frame.popDouble() * frame.popDouble());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
588 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
589 case Bytecodes.IDIV:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
590 divInt(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
591 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
592 case Bytecodes.LDIV:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
593 divLong(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
594 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
595 case Bytecodes.FDIV:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
596 divFloat(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
597 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
598 case Bytecodes.DDIV:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
599 divDouble(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
600 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
601 case Bytecodes.IREM:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
602 remInt(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
603 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
604 case Bytecodes.LREM:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
605 remLong(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
606 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
607 case Bytecodes.FREM:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
608 remFloat(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
609 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
610 case Bytecodes.DREM:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
611 remDouble(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
612 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
613 case Bytecodes.INEG:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
614 frame.pushInt(-frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
615 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
616 case Bytecodes.LNEG:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
617 frame.pushLong(-frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
618 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
619 case Bytecodes.FNEG:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
620 frame.pushFloat(-frame.popFloat());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
621 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
622 case Bytecodes.DNEG:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
623 frame.pushDouble(-frame.popDouble());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
624 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
625 case Bytecodes.ISHL:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
626 shiftLeftInt(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
627 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
628 case Bytecodes.LSHL:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
629 shiftLeftLong(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
630 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
631 case Bytecodes.ISHR:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
632 shiftRightSignedInt(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
633 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
634 case Bytecodes.LSHR:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
635 shiftRightSignedLong(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
636 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
637 case Bytecodes.IUSHR:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
638 shiftRightUnsignedInt(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
639 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
640 case Bytecodes.LUSHR:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
641 shiftRightUnsignedLong(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
642 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
643 case Bytecodes.IAND:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
644 frame.pushInt(frame.popInt() & frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
645 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
646 case Bytecodes.LAND:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
647 frame.pushLong(frame.popLong() & frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
648 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
649 case Bytecodes.IOR:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
650 frame.pushInt(frame.popInt() | frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
651 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
652 case Bytecodes.LOR:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
653 frame.pushLong(frame.popLong() | frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
654 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
655 case Bytecodes.IXOR:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
656 frame.pushInt(frame.popInt() ^ frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
657 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
658 case Bytecodes.LXOR:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
659 frame.pushLong(frame.popLong() ^ frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
660 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
661 case Bytecodes.IINC:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
662 iinc(frame, bs);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
663 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
664 case Bytecodes.I2L:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
665 frame.pushLong(frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
666 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
667 case Bytecodes.I2F:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
668 frame.pushFloat(frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
669 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
670 case Bytecodes.I2D:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
671 frame.pushDouble(frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
672 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
673 case Bytecodes.L2I:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
674 frame.pushInt((int) frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
675 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
676 case Bytecodes.L2F:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
677 frame.pushFloat(frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
678 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
679 case Bytecodes.L2D:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
680 frame.pushDouble(frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
681 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
682 case Bytecodes.F2I:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
683 frame.pushInt((int) frame.popFloat());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
684 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
685 case Bytecodes.F2L:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
686 frame.pushLong((long) frame.popFloat());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
687 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
688 case Bytecodes.F2D:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
689 frame.pushDouble(frame.popFloat());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
690 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
691 case Bytecodes.D2I:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
692 frame.pushInt((int) frame.popDouble());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
693 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
694 case Bytecodes.D2L:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
695 frame.pushLong((long) frame.popDouble());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
696 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
697 case Bytecodes.D2F:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
698 frame.pushFloat((float) frame.popDouble());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
699 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
700 case Bytecodes.I2B:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
701 frame.pushInt((byte) frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
702 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
703 case Bytecodes.I2C:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
704 frame.pushInt((char) frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
705 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
706 case Bytecodes.I2S:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
707 frame.pushInt((short) frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
708 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
709 case Bytecodes.LCMP:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
710 compareLong(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
711 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
712 case Bytecodes.FCMPL:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
713 compareFloatLess(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
714 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
715 case Bytecodes.FCMPG:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
716 compareFloatGreater(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
717 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
718 case Bytecodes.DCMPL:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
719 compareDoubleLess(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
720 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
721 case Bytecodes.DCMPG:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
722 compareDoubleGreater(frame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
723 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
724 case Bytecodes.IFEQ:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
725 if (frame.popInt() == 0) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
726 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
727 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
728 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
729 case Bytecodes.IFNE:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
730 if (frame.popInt() != 0) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
731 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
732 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
733 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
734 case Bytecodes.IFLT:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
735 if (frame.popInt() < 0) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
736 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
737 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
738 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
739 case Bytecodes.IFGE:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
740 if (frame.popInt() >= 0) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
741 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
742 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
743 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
744 case Bytecodes.IFGT:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
745 if (frame.popInt() > 0) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
746 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
747 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
748 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
749 case Bytecodes.IFLE:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
750 if (frame.popInt() <= 0) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
751 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
752 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
753 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
754 case Bytecodes.IF_ICMPEQ:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
755 if (frame.popInt() == frame.popInt()) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
756 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
757 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
758 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
759 case Bytecodes.IF_ICMPNE:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
760 if (frame.popInt() != frame.popInt()) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
761 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
762 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
763 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
764 case Bytecodes.IF_ICMPLT:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
765 if (frame.popInt() > frame.popInt()) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
766 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
767 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
768 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
769 case Bytecodes.IF_ICMPGE:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
770 if (frame.popInt() <= frame.popInt()) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
771 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
772 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
773 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
774 case Bytecodes.IF_ICMPGT:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
775 if (frame.popInt() < frame.popInt()) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
776 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
777 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
778 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
779 case Bytecodes.IF_ICMPLE:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
780 if (frame.popInt() >= frame.popInt()) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
781 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
782 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
783 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
784 case Bytecodes.IF_ACMPEQ:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
785 if (frame.popObject() == frame.popObject()) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
786 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
787 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
788 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
789 case Bytecodes.IF_ACMPNE:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
790 if (frame.popObject() != frame.popObject()) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
791 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
792 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
793 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
794 case Bytecodes.GOTO:
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
795 case Bytecodes.GOTO_W:
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
796 return BRANCH;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
797 case Bytecodes.JSR:
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
798 case Bytecodes.JSR_W:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
799 frame.pushInt(bs.currentBCI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
800 return BRANCH;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
801 case Bytecodes.RET:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
802 return frame.getInt(frame.resolveLocalIndex(bs.readLocalIndex()));
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
803 case Bytecodes.TABLESWITCH:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
804 return tableSwitch(frame, bs);
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
805 case Bytecodes.LOOKUPSWITCH:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
806 return lookupSwitch(frame, bs);
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
807 case Bytecodes.IRETURN:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
808 frame.getParentFrame().pushInt(frame.popInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
809 return RETURN;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
810 case Bytecodes.LRETURN:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
811 frame.getParentFrame().pushLong(frame.popLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
812 return RETURN;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
813 case Bytecodes.FRETURN:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
814 frame.getParentFrame().pushFloat(frame.popFloat());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
815 return RETURN;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
816 case Bytecodes.DRETURN:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
817 frame.getParentFrame().pushDouble(frame.popDouble());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
818 return RETURN;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
819 case Bytecodes.ARETURN:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
820 frame.getParentFrame().pushObject(frame.popObject());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
821 return RETURN;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
822 case Bytecodes.RETURN:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
823 return RETURN;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
824 case Bytecodes.GETSTATIC:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
825 getField(frame, null, bs.currentBC(), bs.readCPI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
826 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
827 case Bytecodes.PUTSTATIC:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
828 putStatic(frame, bs.readCPI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
829 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
830 case Bytecodes.GETFIELD:
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
831 getField(frame, nullCheck(frame.popObject()), bs.currentBC(), bs.readCPI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
832 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
833 case Bytecodes.PUTFIELD:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
834 putField(frame, bs.readCPI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
835 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
836 case Bytecodes.INVOKEVIRTUAL:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
837 callFrame = invokeVirtual(frame, bs.readCPI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
838 if (callFrame == null) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
839 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
840 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
841 return CALL;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
842 case Bytecodes.INVOKESPECIAL:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
843 callFrame = invokeSpecial(frame, bs.readCPI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
844 if (callFrame == null) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
845 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
846 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
847 return CALL;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
848 case Bytecodes.INVOKESTATIC:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
849 callFrame = invokeStatic(frame, bs.readCPI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
850 if (callFrame == null) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
851 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
852 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
853 return CALL;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
854 case Bytecodes.INVOKEINTERFACE:
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
855 callFrame = invokeInterface(frame, bs.readCPI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
856 if (callFrame == null) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
857 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
858 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
859 return CALL;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
860 case Bytecodes.XXXUNUSEDXXX:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
861 assert false : "unused bytecode used. behaviour unspecified.";
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
862 // nop
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
863 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
864 case Bytecodes.NEW:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
865 frame.pushObject(allocateInstance(frame, bs.readCPI()));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
866 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
867 case Bytecodes.NEWARRAY:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
868 frame.pushObject(allocateNativeArray(frame, bs.readByte()));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
869 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
870 case Bytecodes.ANEWARRAY:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
871 frame.pushObject(allocateArray(frame, bs.readCPI()));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
872 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
873 case Bytecodes.ARRAYLENGTH:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
874 frame.pushInt(Array.getLength(nullCheck(frame.popObject())));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
875 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
876 case Bytecodes.ATHROW:
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
877 Throwable t = (Throwable) frame.popObject();
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
878 if ("break".equals(t.getMessage())) {
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
879 t.printStackTrace();
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
880 }
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
881 throw t;
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
882 case Bytecodes.CHECKCAST:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
883 checkCast(frame, bs.readCPI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
884 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
885 case Bytecodes.INSTANCEOF:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
886 instanceOf(frame, bs.readCPI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
887 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
888 case Bytecodes.MONITORENTER:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
889 runtimeInterface.monitorEnter(frame.popObject());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
890 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
891 case Bytecodes.MONITOREXIT:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
892 runtimeInterface.monitorExit(frame.popObject());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
893 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
894 case Bytecodes.WIDE:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
895 assert false;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
896 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
897 case Bytecodes.MULTIANEWARRAY:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
898 frame.pushObject(allocateMultiArray(frame, bs.readCPI(), bs.readUByte(bs.currentBCI() + 3)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
899 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
900 case Bytecodes.IFNULL:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
901 if (frame.popObject() == null) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
902 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
903 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
904 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
905 case Bytecodes.IFNONNULL:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
906 if (frame.popObject() != null) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
907 return BRANCH;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
908 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
909 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
910 case Bytecodes.BREAKPOINT:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
911 assert false : "no breakpoints supported at this time.";
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
912 break; // nop
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
913 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
914 return NEXT;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
915 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
916
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
917 private InterpreterFrame handleThrowable(InterpreterFrame root, InterpreterFrame frame, Throwable t) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
918 ExceptionHandler handler;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
919 InterpreterFrame currentFrame = frame;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
920 do {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
921 handler = resolveExceptionHandlers(currentFrame, currentFrame.getBCI(), t);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
922 if (handler == null) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
923 // no handler found pop frame
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
924 // and continue searching
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
925 currentFrame = popFrame(currentFrame);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
926 } else {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
927 // found a handler -> execute it
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
928 currentFrame.setBCI(handler.getHandlerBCI());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
929 currentFrame.popStack();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
930 currentFrame.pushObject(t);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
931 return currentFrame;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
932 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
933 } while (handler == null && currentFrame != root);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
934
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
935 // will throw exception up the interpreter
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
936 return null;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
937 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
938
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
939 private void updateStackTrace(InterpreterFrame frame, Throwable t) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
940 StackTraceElement[] elements = getBackTrace(frame, t);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
941 if (elements != null) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
942 setStackTrace(frame, t, elements);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
943 setBackTrace(frame, t, null);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
944 } else {
7054
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
945 setBackTrace(frame, t, createStackTraceElements(frame, runtimeInterface));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
946 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
947 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
948
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
949 private void setStackTrace(InterpreterFrame frame, Throwable t, StackTraceElement[] stackTrace) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
950 runtimeInterface.setFieldObject(stackTrace, t, findThrowableField(frame, "stackTrace"));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
951 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
952
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
953 private StackTraceElement[] getBackTrace(InterpreterFrame frame, Throwable t) {
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
954 Object value = runtimeInterface.getFieldObject(t, findThrowableField(frame, "backtrace"));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
955 if (value instanceof StackTraceElement[]) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
956 return (StackTraceElement[]) value;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
957 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
958 return null;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
959 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
960
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
961 private void setBackTrace(InterpreterFrame frame, Throwable t, StackTraceElement[] backtrace) {
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
962 runtimeInterface.setFieldObject(backtrace, t, findThrowableField(frame, "backtrace"));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
963 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
964
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
965 private ExceptionHandler resolveExceptionHandlers(InterpreterFrame frame, int bci, Throwable t) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
966 ExceptionHandler[] handlers = frame.getMethod().getExceptionHandlers();
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
967 for (int i = 0; i < handlers.length; i++) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
968 ExceptionHandler handler = handlers[i];
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
969 if (bci >= handler.getStartBCI() && bci <= handler.getEndBCI()) {
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
970 ResolvedJavaType catchType = null;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
971 if (!handler.isCatchAll()) {
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
972 // exception handlers are similar to instanceof bytecodes, so we pass instanceof
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
973 catchType = resolveType(frame, Bytecodes.INSTANCEOF, (char) handler.catchTypeCPI());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
974 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
975
7054
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
976 if (catchType == null || catchType.isInstance(Constant.forObject(t))) {
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
977 // the first found exception handler is our exception handler
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
978 return handler;
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
979 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
980 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
981 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
982 return null;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
983 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
984
7054
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
985 private Class<?> mirror(ResolvedJavaType type) {
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
986 return runtimeInterface.getMirror(type);
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
987 }
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
988
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
989 private InterpreterFrame allocateFrame(InterpreterFrame frame, BytecodeStream bs) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
990 try {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
991 InterpreterFrame nextFrame = this.callFrame;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
992
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
993 assert nextFrame != null;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
994 assert nextFrame.getParentFrame() == frame;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
995
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
996 // store bci when leaving method
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
997 frame.setBCI(bs.currentBCI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
998
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
999 if (TRACE) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1000 traceCall(nextFrame, "Call");
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1001 }
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1002 if (Modifier.isSynchronized(nextFrame.getMethod().getModifiers())) {
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1003 if (TRACE) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1004 traceOp(frame, "Method monitor enter");
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1005 }
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1006 if (Modifier.isStatic(nextFrame.getMethod().getModifiers())) {
7054
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
1007 runtimeInterface.monitorEnter(mirror(nextFrame.getMethod().getDeclaringClass()));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1008 } else {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1009 Object enterObject = nextFrame.getObject(frame.resolveLocalIndex(0));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1010 assert enterObject != null;
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1011 runtimeInterface.monitorEnter(enterObject);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1012 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1013 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1014
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1015 return nextFrame;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1016 } finally {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1017 callFrame = null;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1018 bs.next();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1019 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1020 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1021
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1022 private InterpreterFrame popFrame(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1023 InterpreterFrame parent = frame.getParentFrame();
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1024 if (Modifier.isSynchronized(frame.getMethod().getModifiers())) {
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1025 if (TRACE) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1026 traceOp(frame, "Method monitor exit");
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1027 }
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1028 if (Modifier.isStatic(frame.getMethod().getModifiers())) {
7054
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
1029 runtimeInterface.monitorExit(mirror(frame.getMethod().getDeclaringClass()));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1030 } else {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1031 Object exitObject = frame.getObject(frame.resolveLocalIndex(0));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1032 if (exitObject != null) {
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1033 runtimeInterface.monitorExit(exitObject);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1034 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1035 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1036 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1037 if (TRACE) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1038 traceCall(frame, "Ret");
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1039 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1040
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1041 frame.dispose();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1042 return parent;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1043 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1044
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1045 private void traceOp(InterpreterFrame frame, String opName) {
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1046 trace(frame.depth(), opName);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1047 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1048
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1049 private void traceCall(InterpreterFrame frame, String type) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1050 trace(frame.depth(), type + " " + frame.getMethod() + " - " + frame.getMethod().getSignature());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1051 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1052
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1053 private void trace(int level, String message) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1054 StringBuilder builder = new StringBuilder();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1055 for (int i = 0; i < level; i++) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1056 builder.append(" ");
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1057 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1058 builder.append(message);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1059 System.out.println(builder);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1060 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1061
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1062 private void divInt(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1063 int dividend = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1064 int divisor = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1065 frame.pushInt(divisor / dividend);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1066 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1067
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1068 private void divLong(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1069 long dividend = frame.popLong();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1070 long divisor = frame.popLong();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1071 frame.pushLong(divisor / dividend);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1072 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1073
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1074 private void divFloat(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1075 float dividend = frame.popFloat();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1076 float divisor = frame.popFloat();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1077 frame.pushFloat(divisor / dividend);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1078 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1079
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1080 private void divDouble(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1081 double dividend = frame.popDouble();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1082 double divisor = frame.popDouble();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1083 frame.pushDouble(divisor / dividend);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1084 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1085
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1086 private void remInt(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1087 int dividend = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1088 int divisor = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1089 frame.pushInt(divisor % dividend);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1090 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1091
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1092 private void remLong(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1093 long dividend = frame.popLong();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1094 long divisor = frame.popLong();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1095 frame.pushLong(divisor % dividend);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1096 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1097
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1098 private void remFloat(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1099 float dividend = frame.popFloat();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1100 float divisor = frame.popFloat();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1101 frame.pushFloat(divisor % dividend);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1102 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1103
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1104 private void remDouble(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1105 double dividend = frame.popDouble();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1106 double divisor = frame.popDouble();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1107 frame.pushDouble(divisor % dividend);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1108 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1109
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1110 private void shiftLeftInt(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1111 int bits = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1112 int value = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1113 frame.pushInt(value << bits);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1114 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1115
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1116 private void shiftLeftLong(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1117 int bits = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1118 long value = frame.popLong();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1119 frame.pushLong(value << bits);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1120 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1121
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1122 private void shiftRightSignedInt(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1123 int bits = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1124 int value = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1125 frame.pushInt(value >> bits);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1126 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1127
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1128 private void shiftRightSignedLong(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1129 int bits = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1130 long value = frame.popLong();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1131 frame.pushLong(value >> bits);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1132 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1133
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1134 private void shiftRightUnsignedInt(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1135 int bits = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1136 int value = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1137 frame.pushInt(value >>> bits);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1138 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1139
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1140 private void shiftRightUnsignedLong(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1141 int bits = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1142 long value = frame.popLong();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1143 frame.pushLong(value >>> bits);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1144 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1145
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1146 private int lookupSwitch(InterpreterFrame frame, BytecodeStream bs) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1147 return lookupSearch(new BytecodeLookupSwitch(bs, bs.currentBCI()), frame.popInt());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1148 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1149
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1150 /**
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1151 * Binary search implementation for the lookup switch.
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1152 */
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1153 private int lookupSearch(BytecodeLookupSwitch switchHelper, int key) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1154 int low = 0;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1155 int high = switchHelper.numberOfCases() - 1;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1156 while (low <= high) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1157 int mid = (low + high) >>> 1;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1158 int midVal = switchHelper.keyAt(mid);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1159
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1160 if (midVal < key) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1161 low = mid + 1;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1162 } else if (midVal > key) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1163 high = mid - 1;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1164 } else {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1165 return switchHelper.bci() + switchHelper.offsetAt(mid); // key found
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1166 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1167 }
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1168 return switchHelper.defaultTarget(); // key not found.
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1169 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1170
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1171 private int tableSwitch(InterpreterFrame frame, BytecodeStream bs) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1172 BytecodeTableSwitch switchHelper = new BytecodeTableSwitch(bs, bs.currentBCI());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1173
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1174 int low = switchHelper.lowKey();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1175 int high = switchHelper.highKey();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1176
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1177 assert low <= high;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1178
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1179 int index = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1180 if (index < low || index > high) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1181 return switchHelper.defaultTarget();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1182 } else {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1183 return switchHelper.targetAt(index - low);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1184 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1185 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1186
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1187 private void checkCast(InterpreterFrame frame, char cpi) {
7054
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
1188 frame.pushObject(mirror(resolveType(frame, Bytecodes.CHECKCAST, cpi)).cast(frame.popObject()));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1189 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1190
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1191 private ResolvedJavaType resolveType(InterpreterFrame frame, int opcode, char cpi) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1192 ConstantPool constantPool = frame.getConstantPool();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1193 constantPool.loadReferencedType(cpi, opcode);
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1194 return constantPool.lookupType(cpi, opcode).resolve(frame.getMethod().getDeclaringClass());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1195 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1196
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1197 private ResolvedJavaType resolveType(InterpreterFrame frame, Class< ? > javaClass) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1198 return metaAccessProvider.lookupJavaType(javaClass).resolve(frame.getMethod().getDeclaringClass());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1199 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1200
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1201 private ResolvedJavaMethod resolveMethod(InterpreterFrame frame, int opcode, char cpi) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1202 ConstantPool constantPool = frame.getConstantPool();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1203 constantPool.loadReferencedType(cpi, opcode);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1204 return (ResolvedJavaMethod) constantPool.lookupMethod(cpi, opcode);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1205 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1206
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1207 private ResolvedJavaField resolveField(InterpreterFrame frame, int opcode, char cpi) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1208 ConstantPool constantPool = frame.getConstantPool();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1209 constantPool.loadReferencedType(cpi, opcode);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1210 return (ResolvedJavaField) constantPool.lookupField(cpi, opcode);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1211 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1212
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1213 private void instanceOf(InterpreterFrame frame, char cpi) {
7015
62818f156081 added ResolvedJavaType.isClass(Class c) to replace some uses of ResolvedJavaType.toJava()
Doug Simon <doug.simon@oracle.com>
parents: 6950
diff changeset
1214 frame.pushInt(resolveType(frame, Bytecodes.INSTANCEOF, cpi).isInstance(Constant.forObject(frame.popObject())) ? 1 : 0);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1215 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1216
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1217 private void pushCPConstant(InterpreterFrame frame, char cpi) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1218 ResolvedJavaMethod method = frame.getMethod();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1219 Object constant = method.getConstantPool().lookupConstant(cpi);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1220
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1221 if (constant instanceof Constant) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1222 Constant c = ((Constant) constant);
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5765
diff changeset
1223 switch (c.getKind()) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1224 case Int:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1225 frame.pushInt(c.asInt());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1226 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1227 case Float:
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1228 frame.pushFloat(c.asFloat());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1229 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1230 case Object:
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1231 frame.pushObject(c.asObject());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1232 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1233 case Double:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1234 frame.pushDouble(c.asDouble());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1235 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1236 case Long:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1237 frame.pushLong(c.asLong());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1238 break;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1239 default:
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1240 assert false : "unspecified case";
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1241 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1242 } else if (constant instanceof JavaType) {
7054
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
1243 frame.pushObject(mirror(((JavaType) constant).resolve(method.getDeclaringClass())));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1244 } else {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1245 assert false : "unexpected case";
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1246 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1247 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1248
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1249 private void compareLong(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1250 long y = frame.popLong();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1251 long x = frame.popLong();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1252 frame.pushInt((x < y) ? -1 : ((x == y) ? 0 : 1));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1253 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1254
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1255 private void compareDoubleGreater(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1256 double y = frame.popDouble();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1257 double x = frame.popDouble();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1258 frame.pushInt(x < y ? -1 : ((x == y) ? 0 : 1));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1259 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1260
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1261 private void compareDoubleLess(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1262 double y = frame.popDouble();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1263 double x = frame.popDouble();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1264 frame.pushInt(x > y ? 1 : ((x == y) ? 0 : -1));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1265 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1266
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1267 private void compareFloatGreater(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1268 float y = frame.popFloat();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1269 float x = frame.popFloat();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1270 frame.pushInt(x < y ? -1 : ((x == y) ? 0 : 1));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1271 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1272
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1273 private void compareFloatLess(InterpreterFrame frame) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1274 float y = frame.popFloat();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1275 float x = frame.popFloat();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1276 frame.pushInt(x > y ? 1 : ((x == y) ? 0 : -1));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1277 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1278
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1279 private Object nullCheck(Object value) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1280 if (value == null) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1281 throw new NullPointerException();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1282 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1283 return value;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1284 }
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1285
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1286 private InterpreterFrame invokeStatic(InterpreterFrame frame, char cpi) throws Throwable {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1287 return invoke(frame, resolveMethod(frame, Bytecodes.INVOKESTATIC, cpi), null);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1288 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1289
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1290 private InterpreterFrame invokeInterface(InterpreterFrame frame, char cpi) throws Throwable {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1291 return resolveAndInvoke(frame, resolveMethod(frame, Bytecodes.INVOKEINTERFACE, cpi));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1292 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1293
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1294 private InterpreterFrame resolveAndInvoke(InterpreterFrame parent, ResolvedJavaMethod m) throws Throwable {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1295 Object receiver = nullCheck(parent.peekReceiver(m));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1296
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1297 ResolvedJavaMethod method = resolveType(parent, receiver.getClass()).resolveMethod(m);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1298
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1299 if (method == null) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1300 throw new AbstractMethodError();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1301 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1302
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1303 return invoke(parent, method, receiver);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1304 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1305
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1306 private InterpreterFrame invokeVirtual(InterpreterFrame frame, char cpi) throws Throwable {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1307 ResolvedJavaMethod m = resolveMethod(frame, Bytecodes.INVOKEVIRTUAL, cpi);
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1308 if (Modifier.isFinal(m.getModifiers())) {
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1309 return invoke(frame, m, nullCheck(frame.peekReceiver(m)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1310 } else {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1311 return resolveAndInvoke(frame, m);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1312 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1313 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1314
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1315 private InterpreterFrame invokeSpecial(InterpreterFrame frame, char cpi) throws Throwable {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1316 ResolvedJavaMethod m = resolveMethod(frame, Bytecodes.INVOKESPECIAL, cpi);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1317 return invoke(frame, m, nullCheck(frame.peekReceiver(m)));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1318 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1319
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1320 private Object[] popArgumentsAsObject(InterpreterFrame frame, ResolvedJavaMethod method, boolean hasReceiver) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1321 Signature signature = method.getSignature();
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1322 int argumentCount = method.getSignature().getParameterCount(hasReceiver);
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1323 Object[] parameters = new Object[argumentCount];
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1324
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1325 int lastSignatureIndex = hasReceiver ? 1 : 0;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1326 for (int i = argumentCount - 1; i >= lastSignatureIndex; i--) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1327 ResolvedJavaType type = signature.getParameterType(i - lastSignatureIndex, method.getDeclaringClass()).resolve(method.getDeclaringClass());
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1328 parameters[i] = popAsObject(frame, type.getKind());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1329 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1330
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1331 if (hasReceiver) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1332 parameters[0] = frame.popObject();
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1333 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1334 return parameters;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1335 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1336
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1337 private InterpreterFrame invoke(InterpreterFrame caller, ResolvedJavaMethod method, Object receiver) throws Throwable {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1338 if (caller.depth() >= maxStackFrames) {
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1339 throw new StackOverflowError("Maximum callstack of " + maxStackFrames + " exceeded.");
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1340 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1341
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1342 if (Modifier.isNative(method.getModifiers())) {
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1343 return invokeNativeMethodViaVM(caller, method, receiver != null);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1344 } else {
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1345 MethodRedirectionInfo redirectedMethod = methodDelegates.get(method);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1346 if (redirectedMethod != null) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1347 return invokeRedirectedMethodViaVM(caller, method, redirectedMethod, receiver != null);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1348 } else {
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1349 return invokeOptimized(caller, method, receiver != null);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1350 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1351 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1352 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1353
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1354 private InterpreterFrame invokeNativeMethodViaVM(InterpreterFrame caller, ResolvedJavaMethod method, boolean hasReceiver) throws Throwable {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1355 assert !methodDelegates.containsKey(method) : "must not be redirected";
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1356 if (TRACE) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1357 traceCall(caller, "Native " + method);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1358 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1359
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1360 // mark the current thread as high level and execute the native method
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1361 Object[] parameters = popArgumentsAsObject(caller, method, hasReceiver);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1362 Object returnValue = runtimeInterface.invoke(method, parameters);
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1363 pushAsObject(caller, method.getSignature().getReturnKind(), returnValue);
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1364
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1365 return null;
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1366 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1367
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1368 private InterpreterFrame invokeRedirectedMethodViaVM(InterpreterFrame caller, ResolvedJavaMethod originalMethod, MethodRedirectionInfo redirectionInfo, boolean hasReceiver) throws Throwable {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1369 assert methodDelegates.containsKey(originalMethod) : "must be redirected";
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1370 if (TRACE) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1371 traceCall(caller, "Delegate " + originalMethod);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1372 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1373
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1374 // current thread is low level and we also execute the target method in the low-level interpreter
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1375 Object[] originalCalleeParameters = popArgumentsAsObject(caller, originalMethod, hasReceiver);
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1376 Object[] parameters = new Object[]{caller, originalMethod, originalCalleeParameters};
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1377 Object returnValue = redirectionInfo.getTargetMethod().invoke(redirectionInfo.getReceiver(), parameters);
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1378 pushAsObject(caller, originalMethod.getSignature().getReturnKind(), returnValue);
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1379
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1380 return null;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1381 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1382
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1383 private InterpreterFrame invokeOptimized(InterpreterFrame parent, ResolvedJavaMethod method, boolean hasReceiver) throws Throwable {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1384 return parent.create(method, hasReceiver);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1385 }
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1386
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1387 private Object allocateMultiArray(InterpreterFrame frame, char cpi, int dimension) {
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1388 ResolvedJavaType type = getLastDimensionType(resolveType(frame, Bytecodes.MULTIANEWARRAY, cpi));
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1389
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1390 int[] dimensions = new int[dimension];
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1391 for (int i = dimension - 1; i >= 0; i--) {
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1392 dimensions[i] = frame.popInt();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1393 }
7054
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
1394 return Array.newInstance(mirror(type), dimensions);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1395 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1396
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1397 private ResolvedJavaType getLastDimensionType(ResolvedJavaType type) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1398 ResolvedJavaType result = type;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1399 while (result.isArrayClass()) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1400 result = result.getComponentType();
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1401 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1402 return result;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1403 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1404
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1405 private Object allocateArray(InterpreterFrame frame, char cpi) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1406 ResolvedJavaType type = resolveType(frame, Bytecodes.ANEWARRAY, cpi);
7054
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
1407 return Array.newInstance(runtimeInterface.getMirror(type), frame.popInt());
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1408 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1409
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1410 private Object allocateNativeArray(InterpreterFrame frame, byte cpi) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1411 // the constants for the cpi are loosely defined and no real cpi indices.
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1412 switch (cpi) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1413 case 4:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1414 return new byte[frame.popInt()];
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1415 case 8:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1416 return new byte[frame.popInt()];
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1417 case 5:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1418 return new char[frame.popInt()];
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1419 case 7:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1420 return new double[frame.popInt()];
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1421 case 6:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1422 return new float[frame.popInt()];
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1423 case 10:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1424 return new int[frame.popInt()];
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1425 case 11:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1426 return new long[frame.popInt()];
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1427 case 9:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1428 return new short[frame.popInt()];
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1429 default:
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1430 assert false : "unexpected case";
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1431 return null;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1432 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1433 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1434
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1435 private Object allocateInstance(InterpreterFrame frame, char cpi) throws InstantiationException {
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1436 return runtimeInterface.newObject(resolveType(frame, Bytecodes.NEW, cpi));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1437 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1438
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1439 private void iinc(InterpreterFrame frame, BytecodeStream bs) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1440 int index = frame.resolveLocalIndex(bs.readLocalIndex());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1441 frame.setInt(index, frame.getInt(index) + bs.readIncrement());
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1442 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1443
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1444 private void putStatic(InterpreterFrame frame, char cpi) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1445 putFieldStatic(frame, resolveField(frame, Bytecodes.PUTSTATIC, cpi));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1446 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1447
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1448 private void putField(InterpreterFrame frame, char cpi) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1449 putFieldVirtual(frame, resolveField(frame, Bytecodes.PUTFIELD, cpi));
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1450 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1451
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1452 private void putFieldStatic(InterpreterFrame frame, ResolvedJavaField field) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1453 switch (field.getKind()) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1454 case Boolean:
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1455 case Byte:
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1456 case Char:
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1457 case Short:
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1458 case Int:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1459 runtimeInterface.setFieldInt(frame.popInt(), null, field);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1460 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1461 case Double:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1462 runtimeInterface.setFieldDouble(frame.popDouble(), null, field);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1463 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1464 case Float:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1465 runtimeInterface.setFieldFloat(frame.popFloat(), null, field);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1466 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1467 case Long:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1468 runtimeInterface.setFieldLong(frame.popLong(), null, field);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1469 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1470 case Object:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1471 runtimeInterface.setFieldObject(frame.popObject(), null, field);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1472 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1473 default:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1474 assert false : "unexpected case";
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1475 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1476 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1477
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1478 private void putFieldVirtual(InterpreterFrame frame, ResolvedJavaField field) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1479 switch (field.getKind()) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1480 case Boolean:
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1481 case Byte:
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1482 case Char:
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1483 case Short:
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1484 case Int:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1485 runtimeInterface.setFieldInt(frame.popInt(), nullCheck(frame.popObject()), field);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1486 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1487 case Double:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1488 runtimeInterface.setFieldDouble(frame.popDouble(), nullCheck(frame.popObject()), field);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1489 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1490 case Float:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1491 runtimeInterface.setFieldFloat(frame.popFloat(), nullCheck(frame.popObject()), field);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1492 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1493 case Long:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1494 runtimeInterface.setFieldLong(frame.popLong(), nullCheck(frame.popObject()), field);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1495 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1496 case Object:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1497 runtimeInterface.setFieldObject(frame.popObject(), nullCheck(frame.popObject()), field);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1498 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1499 default:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1500 assert false : "unexpected case";
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1501 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1502 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1503
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1504 private void getField(InterpreterFrame frame, Object base, int opcode, char cpi) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1505 ResolvedJavaField field = resolveField(frame, opcode, cpi);
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1506 switch (field.getKind()) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1507 case Boolean:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1508 frame.pushInt(runtimeInterface.getFieldBoolean(base, field) ? 1 : 0);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1509 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1510 case Byte:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1511 frame.pushInt(runtimeInterface.getFieldByte(base, field));
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1512 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1513 case Char:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1514 frame.pushInt(runtimeInterface.getFieldChar(base, field));
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1515 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1516 case Short:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1517 frame.pushInt(runtimeInterface.getFieldShort(base, field));
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1518 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1519 case Int:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1520 frame.pushInt(runtimeInterface.getFieldInt(base, field));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1521 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1522 case Double:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1523 frame.pushDouble(runtimeInterface.getFieldDouble(base, field));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1524 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1525 case Float:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1526 frame.pushFloat(runtimeInterface.getFieldFloat(base, field));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1527 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1528 case Long:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1529 frame.pushLong(runtimeInterface.getFieldLong(base, field));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1530 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1531 case Object:
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1532 frame.pushObject(runtimeInterface.getFieldObject(base, field));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1533 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1534 default:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1535 assert false : "unexpected case";
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1536 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1537 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1538
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1539 private int pushAsObject(InterpreterFrame frame, Kind typeKind, Object value) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1540 switch (typeKind) {
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1541 case Int:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1542 frame.pushInt((int) value);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1543 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1544 case Long:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1545 frame.pushLong((long) value);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1546 return 2;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1547 case Boolean:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1548 frame.pushInt(((boolean) value) ? 1 : 0);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1549 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1550 case Byte:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1551 frame.pushInt((byte) value);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1552 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1553 case Char:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1554 frame.pushInt((char) value);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1555 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1556 case Double:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1557 frame.pushDouble((double) value);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1558 return 2;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1559 case Float:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1560 frame.pushFloat((float) value);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1561 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1562 case Short:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1563 frame.pushInt((short) value);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1564 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1565 case Object:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1566 frame.pushObject(value);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1567 break;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1568 case Void:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1569 return 0;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1570 default:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1571 assert false : "case not specified";
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1572 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1573 return 1;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1574 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1575
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1576 private Object popAsObject(InterpreterFrame frame, Kind typeKind) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1577 switch (typeKind) {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1578 case Boolean:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1579 return frame.popInt() == 1 ? true : false;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1580 case Byte:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1581 return (byte) frame.popInt();
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1582 case Char:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1583 return (char) frame.popInt();
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1584 case Double:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1585 return frame.popDouble();
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1586 case Int:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1587 return frame.popInt();
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1588 case Float:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1589 return frame.popFloat();
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1590 case Long:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1591 return frame.popLong();
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1592 case Short:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1593 return (short) frame.popInt();
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1594 case Object:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1595 return frame.popObject();
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1596 case Void:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1597 return null;
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1598 default:
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1599 assert false : "unexpected case";
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1600 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1601 return null;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1602 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1603
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1604 private ResolvedJavaMethod resolveRootMethod() {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1605 try {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1606 return metaAccessProvider.lookupJavaMethod(BytecodeInterpreter.class.getDeclaredMethod("execute", Method.class, Object[].class));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1607 } catch (Exception e) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1608 throw new RuntimeException(e);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1609 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1610 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1611
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1612 private static Method findMethod(Class< ? > clazz, String name, Class< ? >... parameters) {
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1613 try {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1614 return clazz.getDeclaredMethod(name, parameters);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1615 } catch (Exception e) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1616 throw new RuntimeException(e);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1617 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1618 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1619
7054
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
1620 private static StackTraceElement[] createStackTraceElements(InterpreterFrame frame, RuntimeInterpreterInterface runtimeInterface) {
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1621 InterpreterFrame tmp = frame;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1622 List<StackTraceElement> elements = new ArrayList<>();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1623 boolean first = false; // filter only first stack elements
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1624 while (tmp != null) {
7054
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
1625 if (first || !filterStackElement(tmp, runtimeInterface)) {
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1626 first = true;
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1627 elements.add(tmp.getMethod().asStackTraceElement(tmp.getBCI()));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1628 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1629 tmp = tmp.getParentFrame();
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1630 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1631 return elements.toArray(new StackTraceElement[elements.size()]);
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1632 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1633
7054
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
1634 private static boolean filterStackElement(InterpreterFrame frame, RuntimeInterpreterInterface runtimeInterface) {
5d4676ae84a4 removed usages of ResolvedJavaType.toJava() from bytecode interpreter
Doug Simon <doug.simon@oracle.com>
parents: 7015
diff changeset
1635 return Throwable.class.isAssignableFrom(runtimeInterface.getMirror(frame.getMethod().getDeclaringClass()));
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1636 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1637
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1638 private ResolvedJavaField findThrowableField(InterpreterFrame frame, String name) {
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1639 ResolvedJavaType throwableType = resolveType(frame, Throwable.class);
6950
41938af2b3d8 modifications to support non-perm-gen changes in HotSpot
Doug Simon <doug.simon@oracle.com>
parents: 6543
diff changeset
1640 ResolvedJavaField[] fields = throwableType.getInstanceFields(false);
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1641 for (int i = 0; i < fields.length; i++) {
6539
2463eb24b644 Cleanup of Graal API: Rename methods so that it follows the getXxx naming convention and so that they are similar to the names of the java.lang.reflect classes. Remove unused methods.
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
1642 if (fields[i].getName().equals(name)) {
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1643 return fields[i];
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1644 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1645 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1646 assert false;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1647 return null;
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1648 }
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1649
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1650 private class MethodRedirectionInfo {
5765
8d0a6bceb112 fixed result value for (high-level interpreter -> native -> Java transitions)
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5747
diff changeset
1651
5747
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1652 private InterpreterCallable receiver;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1653 private Method method;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1654
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1655 public MethodRedirectionInfo(InterpreterCallable instance) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1656 this.receiver = instance;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1657 this.method = resolveMethod(instance);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1658 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1659
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1660 public InterpreterCallable getReceiver() {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1661 return receiver;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1662 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1663
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1664 public Method getTargetMethod() {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1665 return method;
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1666 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1667
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1668 private Method resolveMethod(InterpreterCallable instance) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1669 try {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1670 return instance.getClass().getMethod(InterpreterCallable.INTERPRETER_CALLABLE_INVOKE_NAME, InterpreterCallable.INTERPRETER_CALLABLE_INVOKE_SIGNATURE);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1671 } catch (NoSuchMethodException e) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1672 throw new InterpreterException(e);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1673 } catch (SecurityException e) {
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1674 throw new InterpreterException(e);
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1675 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1676 }
120820e30baa added basic high-level interpreter support to HotSpot
Christian Haeubl <haeubl@ssw.jku.at>
parents: 5569
diff changeset
1677 }
5569
af976ca29136 Added prototype implementation of Java bytecode interpreter - contribution by Christian Humer (chumer).
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1678 }