Mercurial > hg > graal-compiler
changeset 6381:c61ce6bac1df
Merge
author | Gilles Duboscq <duboscq@ssw.jku.at> |
---|---|
date | Thu, 13 Sep 2012 12:59:27 +0200 |
parents | 4df5ec0f8082 (diff) a718f153b9f2 (current diff) |
children | d44835610b52 69e94aa204b7 |
files | src/share/vm/graal/graalCompilerToVM.cpp |
diffstat | 19 files changed, 590 insertions(+), 268 deletions(-) [+] |
line wrap: on
line diff
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/EscapeAnalysisTest.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/EscapeAnalysisTest.java Thu Sep 13 12:59:27 2012 +0200 @@ -94,6 +94,7 @@ return x.intValue(); } + @Test public void testMonitor2() { test("testMonitor2Snippet", Constant.forInt(0)); }
--- a/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.compiler.test/src/com/oracle/graal/compiler/test/GraalCompilerTest.java Thu Sep 13 12:59:27 2012 +0200 @@ -163,29 +163,78 @@ Assert.assertEquals(expected, actual); } + protected void testN(int n, final String name, final Object... args) { + final Throwable[] errors = new Throwable[n]; + Thread[] threads = new Thread[n]; + for (int i = 0; i < n; i++) { + final int idx = i; + Thread t = new Thread(i + ":" + name) { + @Override + public void run() { + try { + test(name, args); + } catch (Throwable e) { + errors[idx] = e; + } + } + }; + threads[i] = t; + t.start(); + } + int failed = 0; + for (int i = 0; i < n; i++) { + try { + threads[i].join(); + } catch (InterruptedException e) { + errors[i] = e; + } + if (errors[i] != null) { + errors[i].printStackTrace(); + failed++; + } + } + Assert.assertTrue(failed + " of " + n + " failed", failed == 0); + } + protected void test(String name, Object... args) { Method method = getMethod(name); Object expect = null; + Object receiver = Modifier.isStatic(method.getModifiers()) ? null : this; Throwable exception = null; try { // This gives us both the expected return value as well as ensuring that the method to be compiled is fully resolved - expect = method.invoke(null, args); + expect = method.invoke(this, args); } catch (InvocationTargetException e) { exception = e.getTargetException(); } catch (Exception e) { throw new RuntimeException(e); } + + if (runtime == null) { + return; + } + InstalledCode compiledMethod = getCode(runtime.getResolvedJavaMethod(method), parse(method)); + Object[] executeArgs; + if (receiver == null) { + executeArgs = args; + } else { + executeArgs = new Object[args.length + 1]; + executeArgs[0] = receiver; + for (int i = 0; i < args.length; i++) { + executeArgs[i + 1] = args[i]; + } + } if (exception != null) { try { - compiledMethod.executeVarargs(args); + compiledMethod.executeVarargs(executeArgs); Assert.fail("expected " + exception); } catch (Throwable e) { Assert.assertEquals(exception.getClass(), e.getClass()); } } else { - Object actual = compiledMethod.executeVarargs(args); + Object actual = compiledMethod.executeVarargs(executeArgs); assertEquals(expect, actual); } }
--- a/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/ea/PartialEscapeAnalysisPhase.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.compiler/src/com/oracle/graal/compiler/phases/ea/PartialEscapeAnalysisPhase.java Thu Sep 13 12:59:27 2012 +0200 @@ -599,6 +599,9 @@ if (index < 0 || index >= arrayObj.fieldState.length) { // out of bounds or not constant replaceWithMaterialized(array, x, state, arrayObj); + if (valueObj != null) { + replaceWithMaterialized(value, x, state, valueObj); + } } else { arrayObj.fieldState[index] = value; if (changeGraph) { @@ -731,6 +734,11 @@ } } }); + for (ObjectState obj : state.states()) { + if (obj.lockCount > 0) { + virtual.add(obj); + } + } ArrayDeque<ObjectState> queue = new ArrayDeque<>(virtual); while (!queue.isEmpty()) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/HotSpotVMConfig.java Thu Sep 13 12:59:27 2012 +0200 @@ -62,7 +62,7 @@ /** * The offset of the _prototype_header field in a Klass. */ - public int initialMarkWordOffset; + public int prototypeMarkWordOffset; /** * The offset of an the array length in an array's header.
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVM.java Thu Sep 13 12:59:27 2012 +0200 @@ -117,7 +117,7 @@ String decodePC(long pc); - long JavaType_initialMarkWord(HotSpotResolvedJavaType hotSpotResolvedJavaType); + long JavaType_prototypeMarkWord(HotSpotResolvedJavaType hotSpotResolvedJavaType); // Checkstyle: resume }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/bridge/CompilerToVMImpl.java Thu Sep 13 12:59:27 2012 +0200 @@ -168,7 +168,7 @@ public native String decodePC(long pc); @Override - public native long JavaType_initialMarkWord(HotSpotResolvedJavaType type); + public native long JavaType_prototypeMarkWord(HotSpotResolvedJavaType type); // Checkstyle: resume }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/meta/HotSpotResolvedJavaType.java Thu Sep 13 12:59:27 2012 +0200 @@ -288,7 +288,7 @@ return superCheckOffset; } - public long initialMarkWord() { - return HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_initialMarkWord(this); + public long prototypeMarkWord() { + return HotSpotGraalRuntime.getInstance().getCompilerToVM().JavaType_prototypeMarkWord(this); } }
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TLABAllocateNode.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/nodes/TLABAllocateNode.java Thu Sep 13 12:59:27 2012 +0200 @@ -53,9 +53,6 @@ /** * @return null if allocation fails */ - /** - * @return null if allocation fails - */ @SuppressWarnings("unused") @NodeIntrinsic public static Word allocateVariableSize(int size, @ConstantNodeParameter Kind wordKind) {
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/HotSpotSnippetUtils.java Thu Sep 13 12:59:27 2012 +0200 @@ -82,8 +82,8 @@ } @Fold - static int initialMarkWordOffset() { - return HotSpotGraalRuntime.getInstance().getConfig().initialMarkWordOffset; + static int prototypeMarkWordOffset() { + return HotSpotGraalRuntime.getInstance().getConfig().prototypeMarkWordOffset; } @Fold
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/snippets/NewObjectSnippets.java Thu Sep 13 12:59:27 2012 +0200 @@ -69,7 +69,7 @@ public static Object initializeObject( @Parameter("memory") Word memory, @Parameter("hub") Object hub, - @Parameter("initialMarkWord") Word initialMarkWord, + @Parameter("prototypeMarkWord") Word prototypeMarkWord, @ConstantParameter("size") int size, @ConstantParameter("fillContents") boolean fillContents) { @@ -77,7 +77,7 @@ new_stub.inc(); return NewInstanceStubCall.call(hub); } - formatObject(hub, size, memory, initialMarkWord, fillContents); + formatObject(hub, size, memory, prototypeMarkWord, fillContents); Object instance = memory.toObject(); return castFromHub(verifyOop(instance), hub); } @@ -88,10 +88,10 @@ @Parameter("hub") Object hub, @Parameter("length") int length, @Parameter("size") int size, - @Parameter("initialMarkWord") Word initialMarkWord, + @Parameter("prototypeMarkWord") Word prototypeMarkWord, @ConstantParameter("headerSize") int headerSize, @ConstantParameter("fillContents") boolean fillContents) { - return initializeArray(memory, hub, length, size, initialMarkWord, headerSize, true, fillContents); + return initializeArray(memory, hub, length, size, prototypeMarkWord, headerSize, true, fillContents); } @Snippet @@ -100,13 +100,13 @@ @Parameter("hub") Object hub, @Parameter("length") int length, @Parameter("size") int size, - @Parameter("initialMarkWord") Word initialMarkWord, + @Parameter("prototypeMarkWord") Word prototypeMarkWord, @ConstantParameter("headerSize") int headerSize, @ConstantParameter("fillContents") boolean fillContents) { - return initializeArray(memory, hub, length, size, initialMarkWord, headerSize, false, fillContents); + return initializeArray(memory, hub, length, size, prototypeMarkWord, headerSize, false, fillContents); } - private static Object initializeArray(Word memory, Object hub, int length, int size, Word initialMarkWord, int headerSize, boolean isObjectArray, boolean fillContents) { + private static Object initializeArray(Word memory, Object hub, int length, int size, Word prototypeMarkWord, int headerSize, boolean isObjectArray, boolean fillContents) { if (memory == Word.zero()) { if (isObjectArray) { anewarray_stub.inc(); @@ -120,7 +120,7 @@ } else { newarray_loopInit.inc(); } - formatArray(hub, size, length, headerSize, memory, initialMarkWord, fillContents); + formatArray(hub, size, length, headerSize, memory, prototypeMarkWord, fillContents); Object instance = memory.toObject(); return castFromHub(verifyOop(instance), hub); } @@ -163,14 +163,14 @@ /** * Setting this to false causes (as yet inexplicable) crashes on lusearch. */ - private static final boolean USE_STATIC_INITIAL_MARK_WORD = true; + private static final boolean USE_COMPILE_TIME_PROTOTYPE_MARK_WORD = true; /** * Formats some allocated memory with an object header zeroes out the rest. */ - private static void formatObject(Object hub, int size, Word memory, Word staticInitialMarkWord, boolean fillContents) { - Word initialMarkWord = USE_STATIC_INITIAL_MARK_WORD ? staticInitialMarkWord : loadWord(asWord(hub), initialMarkWordOffset()); - storeObject(memory, 0, markOffset(), initialMarkWord); + private static void formatObject(Object hub, int size, Word memory, Word compileTimePrototypeMarkWord, boolean fillContents) { + Word prototypeMarkWord = USE_COMPILE_TIME_PROTOTYPE_MARK_WORD ? compileTimePrototypeMarkWord : loadWord(asWord(hub), prototypeMarkWordOffset()); + storeObject(memory, 0, markOffset(), prototypeMarkWord); storeObject(memory, 0, hubOffset(), hub); if (fillContents) { if (size <= MAX_UNROLLED_OBJECT_ZEROING_SIZE) { @@ -191,8 +191,8 @@ /** * Formats some allocated memory with an object header zeroes out the rest. */ - private static void formatArray(Object hub, int size, int length, int headerSize, Word memory, Word initialMarkWord, boolean fillContents) { - storeObject(memory, 0, markOffset(), initialMarkWord); + private static void formatArray(Object hub, int size, int length, int headerSize, Word memory, Word prototypeMarkWord, boolean fillContents) { + storeObject(memory, 0, markOffset(), prototypeMarkWord); storeObject(memory, 0, hubOffset(), hub); storeInt(memory, 0, arrayLengthOffset(), length); if (fillContents) { @@ -314,7 +314,7 @@ assert size >= 0; Key key = new Key(initializeObject).add("size", size).add("fillContents", initializeNode.fillContents()); ValueNode memory = initializeNode.memory(); - Arguments arguments = arguments("memory", memory).add("hub", hub).add("initialMarkWord", type.initialMarkWord()); + Arguments arguments = arguments("memory", memory).add("hub", hub).add("prototypeMarkWord", type.prototypeMarkWord()); SnippetTemplate template = cache.get(key); Debug.log("Lowering initializeObject in %s: node=%s, template=%s, arguments=%s", graph, initializeNode, template, arguments); template.instantiate(runtime, initializeNode, arguments); @@ -331,7 +331,7 @@ final int headerSize = elementKind.getArrayBaseOffset(); Key key = new Key(elementKind.isObject() ? initializeObjectArray : initializePrimitiveArray).add("headerSize", headerSize).add("fillContents", initializeNode.fillContents()); ValueNode memory = initializeNode.memory(); - Arguments arguments = arguments("memory", memory).add("hub", hub).add("initialMarkWord", type.initialMarkWord()).add("size", initializeNode.size()).add("length", initializeNode.length()); + Arguments arguments = arguments("memory", memory).add("hub", hub).add("prototypeMarkWord", type.prototypeMarkWord()).add("size", initializeNode.size()).add("length", initializeNode.length()); SnippetTemplate template = cache.get(key); Debug.log("Lowering initializeObjectArray in %s: node=%s, template=%s, arguments=%s", graph, initializeNode, template, arguments); template.instantiate(runtime, initializeNode, arguments);
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64NewArrayStubCallOp.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64NewArrayStubCallOp.java Thu Sep 13 12:59:27 2012 +0200 @@ -37,7 +37,7 @@ * LIR instruction for calling HotSpot's {@code new_[object|type]_array} stub. This stub is declared in c1_Runtime1.hpp * and implemented in Runtime1::generate_code_for() which is located in c1_Runtime1_x86.cpp. */ -@Opcode("NEW_ARRAY") +@Opcode("NEW_ARRAY_STUB") public class AMD64NewArrayStubCallOp extends AMD64LIRInstruction { /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64NewInstanceStubCallOp.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64NewInstanceStubCallOp.java Thu Sep 13 12:59:27 2012 +0200 @@ -37,7 +37,7 @@ * LIR instruction for calling HotSpot's {@code new_instance} stub. This stub is declared in c1_Runtime1.hpp * and implemented in Runtime1::generate_code_for() which is located in c1_Runtime1_x86.cpp. */ -@Opcode("NEW_INSTANCE") +@Opcode("NEW_INSTANCE_STUB") public class AMD64NewInstanceStubCallOp extends AMD64LIRInstruction { /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64VerifyOopStubCallOp.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/AMD64VerifyOopStubCallOp.java Thu Sep 13 12:59:27 2012 +0200 @@ -36,7 +36,7 @@ /** * A call to HotSpot's object pointer verification stub. */ -@Opcode("VERIFY_OOP") +@Opcode("VERIFY_OOP_STUB") public class AMD64VerifyOopStubCallOp extends AMD64LIRInstruction { /**
--- a/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotXirGenerator.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.hotspot/src/com/oracle/graal/hotspot/target/amd64/HotSpotXirGenerator.java Thu Sep 13 12:59:27 2012 +0200 @@ -294,7 +294,7 @@ asm.bindInline(resume); - asm.pload(target.wordKind, temp1, hub, asm.i(config.initialMarkWordOffset), false); + asm.pload(target.wordKind, temp1, hub, asm.i(config.prototypeMarkWordOffset), false); asm.pstore(target.wordKind, result, asm.i(config.markOffset), temp1, false); asm.mov(temp1o, hub); // need a temporary register since Intel cannot store 64-bit constants to memory asm.pstore(Kind.Object, result, asm.i(config.hubOffset), temp1o, false); @@ -380,7 +380,7 @@ asm.pstore(target.wordKind, thread, asm.i(config.threadTlabTopOffset), temp1, false); // Now the new object is in result, store mark word and klass - asm.pload(target.wordKind, temp1, hub, asm.i(config.initialMarkWordOffset), false); + asm.pload(target.wordKind, temp1, hub, asm.i(config.prototypeMarkWordOffset), false); asm.pstore(target.wordKind, result, asm.i(config.markOffset), temp1, false); asm.mov(temp1o, hub); // need a temporary register since Intel cannot store 64-bit constants to memory asm.pstore(Kind.Object, result, asm.i(config.hubOffset), temp1o, false);
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/MonitorTest.java Thu Sep 13 12:59:27 2012 +0200 @@ -0,0 +1,209 @@ +/* + * Copyright (c) 2012, Oracle and/or its affiliates. All rights reserved. + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. + * + * This code is free software; you can redistribute it and/or modify it + * under the terms of the GNU General Public License version 2 only, as + * published by the Free Software Foundation. + * + * This code is distributed in the hope that it will be useful, but WITHOUT + * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or + * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License + * version 2 for more details (a copy is included in the LICENSE file that + * accompanied this code). + * + * You should have received a copy of the GNU General Public License version + * 2 along with this work; if not, write to the Free Software Foundation, + * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. + * + * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA + * or visit www.oracle.com if you need additional information or have any + * questions. + */ +package com.oracle.graal.snippets; + +import org.junit.*; + +import com.oracle.graal.compiler.phases.*; +import com.oracle.graal.compiler.test.*; + +public class MonitorTest extends GraalCompilerTest { + + @Test + public void test0() { + test("lockObjectSimple", new Object(), "test1"); + } + + @Test + public void test0_1() { + test("lockThisSimple", "test1"); + } + + @Test + public void test0_2() { + test("lockObjectSimple", null, "test1"); + } + + @Test + public void test1_1() { + test("lockObject", new Object(), "test1", new String[1]); + } + + @Test + public void test1_2() { + test("lockObject", null, "test1_1", new String[1]); + } + + @Test + public void test2() { + test("lockThis", "test2", new String[1]); + } + + /** + * Tests monitor operations on {@link EscapeAnalysisPhase virtual objects}. + */ + @Test + public void test3() { + test("lockLocalObject", "test3", new String[1]); + } + + /** + * Tests recursive locking of objects which should be biasable. + */ + @Test + public void test4() { + Chars src = new Chars("1234567890".toCharArray()); + Chars dst = new Chars(src.data.length); + test("copyObj", src, dst, 100); + } + + /** + * Tests recursive locking of objects which do not appear to be biasable. + */ + @Test + public void test5() { + char[] src = "1234567890".toCharArray(); + char[] dst = new char[src.length]; + test("copyArr", src, dst, 100); + } + + /** + * Extends {@link #test4()} with contention. + */ + @Test + public void test6() { + Chars src = new Chars("1234567890".toCharArray()); + Chars dst = new Chars(src.data.length); + int n = Runtime.getRuntime().availableProcessors(); + testN(n, "copyObj", src, dst, 100); + } + + /** + * Extends {@link #test5()} with contention. + */ + @Test + public void test7() { + char[] src = "1234567890".toCharArray(); + char[] dst = new char[src.length]; + int n = Runtime.getRuntime().availableProcessors(); + testN(n, "copyArr", src, dst, 100); + } + + private static String setAndGet(String[] box, String value) { + synchronized (box) { + box[0] = null; + } + + // Do a GC while a object is locked (by the caller) + System.gc(); + + synchronized (box) { + box[0] = value; + } + return box[0]; + } + + public static String lockObjectSimple(Object o, String value) { + synchronized (o) { + return value; + } + } + + public String lockThisSimple(String value) { + synchronized (this) { + return value; + } + } + + public static String lockObject(Object o, String value, String[] box) { + synchronized (o) { + return setAndGet(box, value); + } + } + + public String lockThis(String value, String[] box) { + synchronized (this) { + return setAndGet(box, value); + } + } + + public static String lockLocalObject(String value, String[] box) { + Object o = new Object(); + synchronized (o) { + return setAndGet(box, value); + } + } + + static class Chars { + final char[] data; + + public Chars(int size) { + this.data = new char[size]; + } + public Chars(char[] data) { + this.data = data; + } + } + + public static String copyObj(Chars src, Chars dst, int n) { + System.out.println(Thread.currentThread().getName() + " reps=" + n + ", src.length=" + src.data.length); + int total = 0; + for (int j = 0; j < n; j++) { + for (int i = 0; i < src.data.length; i++) { + synchronized (src) { + synchronized (dst) { + synchronized (src) { + synchronized (dst) { + dst.data[i] = src.data[i]; + total++; + } + } + } + } + } + } + System.out.println(Thread.currentThread().getName() + " total " + total); + return new String(dst.data); + } + + public static String copyArr(char[] src, char[] dst, int n) { + System.out.println(Thread.currentThread().getName() + " reps=" + n + ", src.length=" + src.length); + int total = 0; + for (int j = 0; j < n; j++) { + for (int i = 0; i < src.length; i++) { + synchronized (src) { + synchronized (dst) { + synchronized (src) { + synchronized (dst) { + dst[i] = src[i]; + total++; + } + } + } + } + } + } + System.out.println(Thread.currentThread().getName() + " total " + total); + return new String(dst); + } +}
--- a/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/WordTest.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.snippets.test/src/com/oracle/graal/snippets/WordTest.java Thu Sep 13 12:59:27 2012 +0200 @@ -63,12 +63,38 @@ test("plus_int", word, -addend); test("minus_int", word, addend); test("minus_int", word, -addend); + test("plus_long", word, (long) addend); + test("plus_long", word, (long) -addend); + test("minus_long", word, (long) addend); + test("minus_long", word, (long) -addend); + + test("and_int", word, addend); + test("and_int", word, -addend); + test("or_int", word, addend); + test("or_int", word, -addend); + test("and_long", word, (long) addend); + test("and_long", word, (long) -addend); + test("or_long", word, (long) addend); + test("or_long", word, (long) -addend); } for (long addend : words) { test("plus_int", word, (int) addend); test("minus_int", word, (int) addend); test("plus_int", word, -((int) addend)); test("minus_int", word, -((int) addend)); + test("plus_long", word, addend); + test("minus_long", word, addend); + test("plus_long", word, -addend); + test("minus_long", word, -addend); + + test("and_int", word, (int) addend); + test("or_int", word, (int) addend); + test("and_int", word, -((int) addend)); + test("or_int", word, -((int) addend)); + test("and_long", word, addend); + test("or_long", word, addend); + test("and_long", word, -addend); + test("or_long", word, -addend); } } } @@ -108,10 +134,20 @@ @Snippet public static long minus_int(long word, int addend) { + return Word.fromLong(word).minus(addend).toLong(); + } + + @Snippet + public static long plus_long(long word, long addend) { return Word.fromLong(word).plus(addend).toLong(); } @Snippet + public static long minus_long(long word, long addend) { + return Word.fromLong(word).minus(addend).toLong(); + } + + @Snippet public static boolean aboveOrEqual(long word1, long word2) { return Word.fromLong(word1).aboveOrEqual(Word.fromLong(word2)); } @@ -135,5 +171,24 @@ public static int fromToObject(Object o1, Object o2) { return Word.fromObject(o1).toObject().hashCode() + Word.fromObject(o2).toObject().hashCode(); } + + @Snippet + public static long and_int(long word, int addend) { + return Word.fromLong(word).and(addend).toLong(); + } + + @Snippet + public static long or_int(long word, int addend) { + return Word.fromLong(word).or(addend).toLong(); + } + + @Snippet + public static long and_long(long word, long addend) { + return Word.fromLong(word).and(addend).toLong(); + } + + @Snippet + public static long or_long(long word, long addend) { + return Word.fromLong(word).or(addend).toLong(); + } } -
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Word.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/Word.java Thu Sep 13 12:59:27 2012 +0200 @@ -53,6 +53,9 @@ W2I, PLUS, MINUS, + OR, + AND, + XOR, BELOW, BELOW_EQUAL, ABOVE, @@ -177,4 +180,59 @@ assert object == null; return new Word(value - addend.value, null); } + + @Operation(OR) + public Word or(int other) { + assert object == null; + return new Word(value | other, null); + } + + @Operation(OR) + public Word or(long other) { + assert object == null; + return new Word(value | other, null); + } + + @Operation(OR) + public Word or(Word other) { + assert object == null; + return new Word(value | other.value, null); + } + + @Operation(AND) + public Word and(int other) { + assert object == null; + return new Word(value & other, null); + } + + @Operation(AND) + public Word and(long other) { + assert object == null; + return new Word(value & other, null); + } + + @Operation(AND) + public Word and(Word other) { + assert object == null; + return new Word(value & other.value, null); + } + + @Operation(XOR) + public Word xor(int other) { + assert object == null; + return new Word(value | other, null); + } + + @Operation(XOR) + public Word xor(long other) { + assert object == null; + return new Word(value | other, null); + } + + @Operation(XOR) + public Word xor(Word other) { + assert object == null; + return new Word(value | other.value, null); + } + }
--- a/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/WordTypeRewriterPhase.java Thu Sep 13 10:45:17 2012 +0200 +++ b/graal/com.oracle.graal.snippets/src/com/oracle/graal/snippets/WordTypeRewriterPhase.java Thu Sep 13 12:59:27 2012 +0200 @@ -32,6 +32,7 @@ import com.oracle.graal.nodes.extended.*; import com.oracle.graal.nodes.java.*; import com.oracle.graal.nodes.type.*; +import com.oracle.graal.nodes.util.*; import com.oracle.graal.snippets.Word.Opcode; import com.oracle.graal.snippets.Word.Operation; @@ -91,38 +92,66 @@ switch (opcode) { case ZERO: { assert arguments.size() == 0; - invoke.intrinsify(wordKind.isLong() ? ConstantNode.forLong(0L, graph) : ConstantNode.forInt(0, graph)); + replace(invoke, wordKind.isLong() ? ConstantNode.forLong(0L, graph) : ConstantNode.forInt(0, graph)); break; } case ABOVE: { assert arguments.size() == 2; - invoke.intrinsify(compare(Condition.AT, graph, arguments.first(), arguments.last())); + replace(invoke, compare(Condition.AT, graph, arguments.first(), arguments.last())); break; } case ABOVE_EQUAL: { assert arguments.size() == 2; - invoke.intrinsify(compare(Condition.AE, graph, arguments.first(), arguments.last())); + replace(invoke, compare(Condition.AE, graph, arguments.first(), arguments.last())); break; } case BELOW: { assert arguments.size() == 2; - invoke.intrinsify(compare(Condition.BT, graph, arguments.first(), arguments.last())); + replace(invoke, compare(Condition.BT, graph, arguments.first(), arguments.last())); break; } case BELOW_EQUAL: { assert arguments.size() == 2; - invoke.intrinsify(compare(Condition.BE, graph, arguments.first(), arguments.last())); + replace(invoke, compare(Condition.BE, graph, arguments.first(), arguments.last())); break; } case PLUS: { ValueNode addend = asWordKind(graph, arguments.last()); IntegerAddNode op = graph.unique(new IntegerAddNode(wordKind, arguments.first(), addend)); - invoke.intrinsify(op); + replace(invoke, op); + break; + } + + case MINUS: { + ValueNode addend = asWordKind(graph, arguments.last()); + IntegerSubNode op = graph.unique(new IntegerSubNode(wordKind, arguments.first(), addend)); + replace(invoke, op); + break; + } + + case AND: { + ValueNode operand = asWordKind(graph, arguments.last()); + AndNode op = graph.unique(new AndNode(wordKind, arguments.first(), operand)); + replace(invoke, op); + break; + } + + case OR: { + ValueNode operand = asWordKind(graph, arguments.last()); + OrNode op = graph.unique(new OrNode(wordKind, arguments.first(), operand)); + replace(invoke, op); + break; + } + + case XOR: { + ValueNode operand = asWordKind(graph, arguments.last()); + XorNode op = graph.unique(new XorNode(wordKind, arguments.first(), operand)); + replace(invoke, op); break; } @@ -131,7 +160,7 @@ ValueNode value = arguments.first(); ResolvedJavaType targetType = (ResolvedJavaType) targetMethod.signature().returnType(targetMethod.holder()); UnsafeCastNode cast = graph.unique(new UnsafeCastNode(value, targetType)); - invoke.intrinsify(cast); + replace(invoke, cast); break; } @@ -139,7 +168,7 @@ assert arguments.size() == 1; ValueNode value = arguments.first(); ValueNode intValue = fromWordKindTo(graph, value, Kind.Int); - invoke.intrinsify(intValue); + replace(invoke, intValue); break; } @@ -147,7 +176,7 @@ assert arguments.size() == 1; ValueNode value = arguments.first(); ValueNode longValue = fromWordKindTo(graph, value, Kind.Long); - invoke.intrinsify(longValue); + replace(invoke, longValue); break; } @@ -156,7 +185,7 @@ ValueNode value = arguments.first(); assert value.kind() == Kind.Object : value + ", " + targetMethod; UnsafeCastNode cast = graph.unique(new UnsafeCastNode(value, wordType)); - invoke.intrinsify(cast); + replace(invoke, cast); break; } @@ -165,7 +194,7 @@ ValueNode value = arguments.first(); assert value.kind() == Kind.Long; ValueNode wordValue = asWordKind(graph, value); - invoke.intrinsify(wordValue); + replace(invoke, wordValue); break; } @@ -173,7 +202,7 @@ assert arguments.size() == 1; ValueNode value = arguments.first(); assert value.kind() == Kind.Int; - invoke.intrinsify(asWordKind(graph, value)); + replace(invoke, asWordKind(graph, value)); break; } @@ -185,6 +214,14 @@ } } + protected void replace(Invoke invoke, ValueNode value) { + FixedNode next = invoke.next(); + invoke.setNext(null); + invoke.node().replaceAtPredecessor(next); + invoke.node().replaceAtUsages(value); + GraphUtil.killCFG(invoke.node()); + } + /** * Creates comparison node for a given condition and two input values. */ @@ -247,6 +284,9 @@ } public static boolean isWord(ValueNode node) { + if (node.stamp() instanceof WordStamp) { + return true; + } if (node.kind().isObject()) { return isWord(node.objectStamp().type()); }
--- a/src/share/vm/graal/graalCompilerToVM.cpp Thu Sep 13 10:45:17 2012 +0200 +++ b/src/share/vm/graal/graalCompilerToVM.cpp Thu Sep 13 12:59:27 2012 +0200 @@ -48,9 +48,21 @@ return (methodDataOop)HotSpotMethodData::hotspotMirror(JNIHandles::resolve(hotspot_method_data)); } -// public byte[] JavaMethod_code(HotSpotResolvedMethod method); -JNIEXPORT jbyteArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1code(JNIEnv *env, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::JavaMethod_code"); +// Entry to native method implementation that transitions current thread to '_thread_in_vm'. +#define C2V_VMENTRY(result_type, name, signature) \ + JNIEXPORT result_type JNICALL name signature { \ + TRACE_graal_3("CompilerToVM::" #name); \ + VM_ENTRY_MARK; \ + +// Entry to native method implementation that calls a JNI function +// and hence cannot transition current thread to '_thread_in_vm'. +#define C2V_ENTRY(result_type, name, signature) \ + JNIEXPORT result_type JNICALL name signature { \ + TRACE_graal_3("CompilerToVM::" #name); \ + +#define C2V_END } + +C2V_ENTRY(jbyteArray, JavaMethod_code, (JNIEnv *env, jobject, jobject hotspot_method)) methodHandle method = getMethodFromHotSpotMethod(hotspot_method); // copy all bytecodes @@ -83,21 +95,15 @@ } return result; -} +C2V_END -// public String JavaMethod_signature(HotSpotResolvedMethod method); -JNIEXPORT jstring JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1signature(JNIEnv *env, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::JavaMethod_signature"); - VM_ENTRY_MARK +C2V_VMENTRY(jstring, JavaMethod_signature, (JNIEnv *env, jobject, jobject hotspot_method)) methodOop method = getMethodFromHotSpotMethod(hotspot_method); assert(method != NULL && method->signature() != NULL, "signature required"); return VmIds::toString<jstring>(method->signature(), THREAD); -} +C2V_END -// public ExceptionHandler[] JavaMethod_exceptionHandlers(long vmId); -JNIEXPORT jobjectArray JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1exceptionHandlers(JNIEnv *, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::JavaMethod_exceptionHandlers"); - VM_ENTRY_MARK +C2V_VMENTRY(jobjectArray, JavaMethod_exceptionHandlers, (JNIEnv *, jobject, jobject hotspot_method)) ResourceMark rm; methodHandle method = getMethodFromHotSpotMethod(hotspot_method); int handler_count = method->exception_table_length(); @@ -132,13 +138,9 @@ } return (jobjectArray) JNIHandles::make_local(array()); -} +C2V_END -// public boolean JavaMethod_hasBalancedMonitors(long vmId); -JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1hasBalancedMonitors(JNIEnv *, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::JavaMethod_hasBalancedMonitors"); - - VM_ENTRY_MARK; +C2V_VMENTRY(jint, JavaMethod_hasBalancedMonitors, (JNIEnv *, jobject, jobject hotspot_method)) // Analyze the method to see if monitors are used properly. methodHandle method(THREAD, getMethodFromHotSpotMethod(hotspot_method)); @@ -160,12 +162,9 @@ method->set_guaranteed_monitor_matching(); } return true; -} +C2V_END -// public JavaMethod getJavaMethod(java.lang.reflect.Method reflectionMethod); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getJavaMethod(JNIEnv *, jobject, jobject reflection_method_handle) { - TRACE_graal_3("CompilerToVM::getJavaMethod"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, getJavaMethod, (JNIEnv *, jobject, jobject reflection_method_handle)) oop reflection_method = JNIHandles::resolve(reflection_method_handle); oop reflection_holder = java_lang_reflect_Method::clazz(reflection_method); int slot = java_lang_reflect_Method::slot(reflection_method); @@ -175,11 +174,7 @@ return JNIHandles::make_local(THREAD, ret()); } -// public boolean JavaMethod_uniqueConcreteMethod(long vmId); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1uniqueConcreteMethod(JNIEnv *, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::JavaMethod_uniqueConcreteMethod"); - - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, JavaMethod_uniqueConcreteMethod, (JNIEnv *, jobject, jobject hotspot_method)) methodHandle method = getMethodFromHotSpotMethod(hotspot_method); KlassHandle holder = method->method_holder(); if (holder->is_interface()) { @@ -204,18 +199,13 @@ Handle method_resolved = GraalCompiler::createHotSpotResolvedJavaMethod(unique_concrete, CHECK_NULL); return JNIHandles::make_local(THREAD, method_resolved()); } -} +C2V_END -// public native int JavaMethod_invocationCount(long vmId); -JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1invocationCount(JNIEnv *, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::JavaMethod_invocationCount"); +C2V_ENTRY(jint, JavaMethod_invocationCount, (JNIEnv *, jobject, jobject hotspot_method)) return getMethodFromHotSpotMethod(hotspot_method)->invocation_count(); -} +C2V_END -// public native HotSpotMethodData JavaMethod_methodData(HotSpotResolvedJavaMethod method); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1methodData(JNIEnv *, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::JavaMethod_methodData"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, JavaMethod_methodData,(JNIEnv *, jobject, jobject hotspot_method)) methodDataHandle method_data = getMethodFromHotSpotMethod(hotspot_method)->method_data(); if(method_data.is_null()) { @@ -224,7 +214,7 @@ Handle graalMethodData = GraalCompiler::createHotSpotMethodData(method_data, CHECK_NULL); return JNIHandles::make_local(THREAD, graalMethodData()); } -} +C2V_END // ------------------------------------------------------------------ // Adjust a CounterData count to be commensurate with @@ -252,23 +242,16 @@ return count; } -// public native boolean JavaMethod_hasCompiledCode(HotSpotResolvedJavaMethod method); -JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1hasCompiledCode(JNIEnv *, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::JavaMethod_hasCompiledCode"); +C2V_ENTRY(jboolean, JavaMethod_hasCompiledCode, (JNIEnv *, jobject, jobject hotspot_method)) return getMethodFromHotSpotMethod(hotspot_method)->has_compiled_code(); -} +C2V_END -// public native int JavaMethod_getCompiledCodeSize(HotSpotResolvedJavaMethod method); -JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1getCompiledCodeSize(JNIEnv *env, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::JavaMethod_getCompiledCodeSize"); +C2V_ENTRY(jint, JavaMethod_getCompiledCodeSize, (JNIEnv *env, jobject, jobject hotspot_method)) nmethod* code = getMethodFromHotSpotMethod(hotspot_method)->code(); return code == NULL ? 0 : code->insts_size(); -} +C2V_END -// public JavaType Signature_lookupType(String returnType, HotSpotResolvedJavaType accessingClass); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_Signature_1lookupType(JNIEnv *env, jobject, jstring jname, jobject accessingClass, jboolean eagerResolve) { - TRACE_graal_3("CompilerToVM::Signature_lookupType"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, Signature_lookupType, (JNIEnv *env, jobject, jstring jname, jobject accessingClass, jboolean eagerResolve)) ResourceMark rm; Symbol* nameSymbol = VmIds::toSymbol(jname); @@ -331,12 +314,9 @@ } return JNIHandles::make_local(THREAD, result); -} +C2V_END -// public Object ConstantPool_lookupConstant(HotSpotResolvedJavaType type, int cpi); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupConstant(JNIEnv *env, jobject, jobject type, jint index) { - TRACE_graal_3("CompilerToVM::ConstantPool_lookupConstant"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, ConstantPool_lookupConstant, (JNIEnv *env, jobject, jobject type, jint index)) constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); @@ -376,12 +356,9 @@ } return JNIHandles::make_local(THREAD, result); -} +C2V_END -// public JavaMethod ConstantPool_lookupMethod(long vmId, int cpi, byte byteCode); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupMethod(JNIEnv *env, jobject, jobject type, jint index, jbyte byteCode) { - TRACE_graal_3("CompilerToVM::ConstantPool_lookupMethod"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, ConstantPool_lookupMethod, (JNIEnv *env, jobject, jobject type, jint index, jbyte byteCode)) index = GraalCompiler::to_cp_index_u2(index); constantPoolHandle cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); instanceKlassHandle pool_holder(cp->pool_holder()); @@ -399,23 +376,16 @@ Handle type = GraalCompiler::get_JavaType(cp, holder_index, cp->pool_holder(), CHECK_NULL); return JNIHandles::make_local(THREAD, VMToCompiler::createJavaMethod(name, signature, type, THREAD)); } -} +C2V_END -// public JavaType ConstantPool_lookupType(long vmId, int cpi); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupType(JNIEnv *env, jobject, jobject type, jint index) { - TRACE_graal_3("CompilerToVM::ConstantPool_lookupType"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, ConstantPool_lookupType, (JNIEnv *env, jobject, jobject type, jint index)) constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); Handle result = GraalCompiler::get_JavaType(cp, index, cp->pool_holder(), CHECK_NULL); return JNIHandles::make_local(THREAD, result()); -} +C2V_END -// public void ConstantPool_loadReferencedType(long vmId, int cpi); -JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1loadReferencedType(JNIEnv *env, jobject, jobject type, jint index, jbyte op) { - TRACE_graal_3("CompilerToVM::ConstantPool_loadReferencedType"); - VM_ENTRY_MARK; - +C2V_VMENTRY(void, ConstantPool_loadReferencedType, (JNIEnv *env, jobject, jobject type, jint index, jbyte op)) constantPoolOop cp = instanceKlass::cast(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(type)))->constants(); int byteCode = (op & 0xFF); if (byteCode != Bytecodes::_checkcast && byteCode != Bytecodes::_instanceof && byteCode != Bytecodes::_new && byteCode != Bytecodes::_anewarray @@ -435,12 +405,9 @@ instanceKlass::cast(klass)->initialize(CHECK); } } -} +C2V_END -// public JavaField ConstantPool_lookupField(long vmId, int cpi); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_ConstantPool_1lookupField(JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte byteCode) { - TRACE_graal_3("CompilerToVM::ConstantPool_lookupField"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, ConstantPool_lookupField, (JNIEnv *env, jobject, jobject constantPoolHolder, jint index, jbyte byteCode)) ResourceMark rm; index = GraalCompiler::to_cp_index_u2(index); @@ -479,12 +446,9 @@ Handle field_handle = GraalCompiler::get_JavaField(offset, flags.as_int(), name, holder, type, code, THREAD); return JNIHandles::make_local(THREAD, field_handle()); -} +C2V_END -// public JavaMethod JavaType_resolveMethodImpl(HotSpotResolvedJavaType klass, String name, String signature); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_3resolveMethodImpl(JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature) { - TRACE_graal_3("CompilerToVM::JavaType_resolveMethodImpl"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, JavaType_resolveMethodImpl, (JNIEnv *, jobject, jobject resolved_type, jstring name, jstring signature)) assert(JNIHandles::resolve(resolved_type) != NULL, ""); klassOop klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(resolved_type)); @@ -500,13 +464,9 @@ } Handle ret = GraalCompiler::createHotSpotResolvedJavaMethod(method, CHECK_NULL); return JNIHandles::make_local(THREAD, ret()); -} +C2V_END -// public boolean JavaType_isSubtypeOf(HotSpotResolvedJavaType klass, JavaType other); -JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_2isSubtypeOf(JNIEnv *, jobject, jobject klass, jobject jother) { - TRACE_graal_3("CompilerToVM::JavaType_isSubtypeOf"); - VM_ENTRY_MARK; - +C2V_VMENTRY(jboolean, JavaType_isSubtypeOf, (JNIEnv *, jobject, jobject klass, jobject jother)) oop other = JNIHandles::resolve(jother); assert(other->is_a(HotSpotResolvedJavaType::klass()), "resolved hotspot type expected"); assert(JNIHandles::resolve(klass) != NULL, ""); @@ -520,24 +480,18 @@ fatal("unexpected class type"); return false; } -} +C2V_END -// public JavaType JavaType_leastCommonAncestor(HotSpotResolvedJavaType thisType, HotSpotResolvedJavaType otherType); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_2leastCommonAncestor(JNIEnv *, jobject, jobject this_type, jobject other_type) { - TRACE_graal_3("CompilerToVM::JavaType_leastCommonAncestor"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, JavaType_leastCommonAncestor, (JNIEnv *, jobject, jobject this_type, jobject other_type)) Klass* this_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(this_type))->klass_part(); Klass* other_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(other_type))->klass_part(); Klass* lca = this_klass->LCA(other_klass); return JNIHandles::make_local(GraalCompiler::get_JavaType(lca, THREAD)()); -} +C2V_END -// public JavaType JavaType_componentType(HotSpotResolvedType klass); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1componentType(JNIEnv *, jobject, jobject klass) { - TRACE_graal_3("CompilerToVM::JavaType_componentType"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, JavaType_componentType, (JNIEnv *, jobject, jobject klass)) KlassHandle array_klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass)); if(array_klass->oop_is_typeArray()) { BasicType t = typeArrayKlass::cast(array_klass())->element_type(); @@ -548,24 +502,18 @@ klassOop element_type = objArrayKlass::cast(array_klass())->element_klass(); assert(JNIHandles::resolve(klass) != NULL, ""); return JNIHandles::make_local(GraalCompiler::get_JavaType(element_type, THREAD)()); -} +C2V_END -// public JavaType JavaType_superType(HotSpotResolvedType klass); -JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_initialMarkWord(JNIEnv *, jobject, jobject klass) { - TRACE_graal_3("CompilerToVM::JavaType_superType"); - VM_ENTRY_MARK; +C2V_VMENTRY(jlong, JavaType_prototypeMarkWord, (JNIEnv *, jobject, jobject klass)) KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); if (klass_handle->oop_is_array()) { return (int32_t)(intptr_t) markOopDesc::prototype(); } else { return (jlong) (intptr_t) klass_handle->prototype_header(); } -} +C2V_END -// public JavaType JavaType_superType(HotSpotResolvedType klass); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1superType(JNIEnv *, jobject, jobject klass) { - TRACE_graal_3("CompilerToVM::JavaType_superType"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, JavaType_superType, (JNIEnv *, jobject, jobject klass)) KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); klassOop k; @@ -581,44 +529,32 @@ } else { return NULL; } -} +C2V_END -// public JavaType JavaType_uniqueConcreteSubtype(HotSpotResolvedType klass); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1uniqueConcreteSubtype(JNIEnv *, jobject, jobject klass) { - TRACE_graal_3("CompilerToVM::JavaType_uniqueConcreteSubtype"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, JavaType_uniqueConcreteSubtype, (JNIEnv *, jobject, jobject klass)) KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); Klass *up_cast = klass_handle->up_cast_abstract(); if (!up_cast->is_interface() && up_cast->subklass() == NULL) { return JNIHandles::make_local(GraalCompiler::get_JavaType(up_cast, THREAD)()); } return NULL; -} +C2V_END -// public bool JavaType_isInitialized(HotSpotResolvedType klass); -JNIEXPORT jboolean JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1isInitialized(JNIEnv *, jobject, jobject hotspot_klass) { - TRACE_graal_3("CompilerToVM::JavaType_isInitialized"); +C2V_VMENTRY(jboolean, JavaType_isInitialized,(JNIEnv *, jobject, jobject hotspot_klass)) klassOop klass = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(hotspot_klass)); assert(klass != NULL, "method must not be called for primitive types"); return instanceKlass::cast(klass)->is_initialized(); -} +C2V_END -// public JavaType JavaType_arrayOf(HotSpotResolvedJavaType klass); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1arrayOf(JNIEnv *, jobject, jobject klass) { - TRACE_graal_3("CompilerToVM::JavaType_arrayOf"); - VM_ENTRY_MARK; - +C2V_VMENTRY(jobject, JavaType_arrayOf, (JNIEnv *, jobject, jobject klass)) KlassHandle klass_handle(java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass))); KlassHandle arr = klass_handle->array_klass(THREAD); Handle name = VmIds::toString<Handle>(arr->name(), CHECK_NULL); assert(arr->oop_is_array(), ""); return JNIHandles::make_local(THREAD, GraalCompiler::createHotSpotResolvedJavaType(arr, name, THREAD)()); -} +C2V_END -// public ResolvedJavaField[] JavaType_fields(HotSpotResolvedJavaType klass); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaType_1fields(JNIEnv *, jobject, jobject klass) { - TRACE_graal_3("CompilerToVM::JavaType_fields"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, JavaType_fields, (JNIEnv *, jobject, jobject klass)) ResourceMark rm; instanceKlassHandle k = java_lang_Class::as_klassOop(HotSpotResolvedJavaType::javaMirror(klass)); @@ -647,22 +583,16 @@ field_array->obj_at_put(i, closure._field_array.at(i)()); } return JNIHandles::make_local(field_array()); -} +C2V_END -// public JavaType getPrimitiveArrayType(Kind kind); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getPrimitiveArrayType(JNIEnv *env, jobject, jobject kind) { - TRACE_graal_3("CompilerToVM::getPrimitiveArrayType"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, getPrimitiveArrayType, (JNIEnv *env, jobject, jobject kind)) BasicType type = GraalCompiler::kindToBasicType(Kind::typeChar(kind)); assert(type != T_OBJECT, "primitive type expecteds"); Handle result = GraalCompiler::get_JavaType(Universe::typeArrayKlassObj(type), CHECK_NULL); return JNIHandles::make_local(THREAD, result()); -} +C2V_END -// public long getMaxCallTargetOffset(RuntimeCall rtcall); -JNIEXPORT jlong JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getMaxCallTargetOffset(JNIEnv *env, jobject, jobject rtcall) { - TRACE_graal_3("CompilerToVM::getMaxCallTargetOffset"); - VM_ENTRY_MARK; +C2V_VMENTRY(jlong, getMaxCallTargetOffset, (JNIEnv *env, jobject, jobject rtcall)) oop call = JNIHandles::resolve(rtcall); address target_addr = CodeInstaller::runtime_call_target_address(call); if (target_addr != 0x0) { @@ -671,12 +601,9 @@ return MAX2(ABS(off_low), ABS(off_high)); } return -1; -} +C2V_END -// public JavaType getType(Class<?> javaClass); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getType(JNIEnv *env, jobject, jobject javaClass) { - TRACE_graal_3("CompilerToVM::getType"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, getType, (JNIEnv *env, jobject, jobject javaClass)) oop javaClassOop = JNIHandles::resolve(javaClass); if (javaClassOop == NULL) { fatal("argument to CompilerToVM.getType must not be NULL"); @@ -691,7 +618,7 @@ Handle type = GraalCompiler::createHotSpotResolvedJavaType(klass, name, CHECK_NULL); return JNIHandles::make_local(THREAD, type()); } -} +C2V_END // helpers used to set fields in the HotSpotVMConfig object @@ -719,8 +646,10 @@ BasicType basicTypes[] = { T_BOOLEAN, T_BYTE, T_SHORT, T_CHAR, T_INT, T_FLOAT, T_LONG, T_DOUBLE, T_OBJECT }; int basicTypeCount = sizeof(basicTypes) / sizeof(BasicType); -// public void initializeConfiguration(HotSpotVMConfig config); -JNIEXPORT void JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_initializeConfiguration(JNIEnv *env, jobject, jobject config) { +C2V_ENTRY(void, initializeConfiguration, (JNIEnv *env, jobject, jobject config)) +if (JavaThread::current()->thread_state() != _thread_in_native) { + tty->print_cr("thread state: %d", JavaThread::current()->thread_state()); +} #ifdef _WIN64 set_boolean(env, config, "windowsOs", true); #else @@ -736,7 +665,7 @@ set_int(env, config, "stackShadowPages", StackShadowPages); set_int(env, config, "hubOffset", oopDesc::klass_offset_in_bytes()); set_int(env, config, "markOffset", oopDesc::mark_offset_in_bytes()); - set_int(env, config, "initialMarkWordOffset", in_bytes(Klass::prototype_header_offset())); + set_int(env, config, "prototypeMarkWordOffset", in_bytes(Klass::prototype_header_offset())); set_int(env, config, "superCheckOffsetOffset", in_bytes(Klass::super_check_offset_offset())); set_int(env, config, "secondarySuperCacheOffset", in_bytes(Klass::secondary_super_cache_offset())); set_int(env, config, "secondarySupersOffset", in_bytes(Klass::secondary_supers_offset())); @@ -817,11 +746,9 @@ } set_int(env, config, "arrayClassElementOffset", in_bytes(objArrayKlass::element_klass_offset())); -} +C2V_END -// public HotSpotCompiledMethod installMethod(HotSpotCompilationResult comp, boolean installCode); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_installMethod(JNIEnv *jniEnv, jobject, jobject compResult, jboolean install_code, jobject info) { - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, installMethod, (JNIEnv *jniEnv, jobject, jobject compResult, jboolean install_code, jobject info)) ResourceMark rm; HandleMark hm; Handle compResultHandle = JNIHandles::resolve(compResult); @@ -849,12 +776,9 @@ } else { return NULL; } -} +C2V_END -// public String disassembleNative(byte[] code, long address); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_disassembleNative(JNIEnv *jniEnv, jobject, jbyteArray code, jlong start_address) { - TRACE_graal_3("CompilerToVM::disassembleNative"); - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, disassembleNative, (JNIEnv *jniEnv, jobject, jbyteArray code, jlong start_address)) ResourceMark rm; HandleMark hm; @@ -867,26 +791,18 @@ Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); return JNIHandles::make_local(result()); -} +C2V_END -// public StackTraceElement JavaMethod_toStackTraceElement(HotSpotResolvedJavaMethod method, int bci); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_1toStackTraceElement(JNIEnv *env, jobject, jobject hotspot_method, int bci) { - TRACE_graal_3("CompilerToVM::JavaMethod_toStackTraceElement"); - - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, JavaMethod_toStackTraceElement, (JNIEnv *env, jobject, jobject hotspot_method, int bci)) ResourceMark rm; HandleMark hm; methodHandle method = getMethodFromHotSpotMethod(hotspot_method); oop element = java_lang_StackTraceElement::create(method, bci, CHECK_NULL); return JNIHandles::make_local(element); -} +C2V_END -// public Object executeCompiledMethodVarargs(HotSpotCompiledMethod method, Object... args); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_executeCompiledMethodVarargs(JNIEnv *env, jobject, jobject method, jobject args) { - TRACE_graal_3("CompilerToVM::executeCompiledMethod"); - - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, executeCompiledMethodVarargs, (JNIEnv *env, jobject, jobject method, jobject args)) ResourceMark rm; HandleMark hm; @@ -913,13 +829,9 @@ oop o = java_lang_boxing_object::create(jap.get_ret_type(), (jvalue *) result.get_value_addr(), CHECK_NULL); return JNIHandles::make_local(o); } -} +C2V_END -// public Object executeCompiledMethod(HotSpotCompiledMethod method, Object arg1, Object arg2, Object arg3); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_executeCompiledMethod(JNIEnv *env, jobject, jobject method, jobject arg1, jobject arg2, jobject arg3) { - TRACE_graal_3("CompilerToVM::executeCompiledMethod"); - - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, executeCompiledMethod, (JNIEnv *env, jobject, jobject method, jobject arg1, jobject arg2, jobject arg3)) ResourceMark rm; HandleMark hm; @@ -939,11 +851,9 @@ JavaCalls::call(&result, actualMethod, nm, &args, CHECK_NULL); return JNIHandles::make_local((oop) result.get_jobject()); -} +C2V_END -// public native int JavaMethod_vtableEntryOffset(HotSpotResolvedJavaMethod method); -JNIEXPORT jint JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_JavaMethod_vtableEntryOffset(JNIEnv *, jobject, jobject hotspot_method) { - TRACE_graal_3("CompilerToVM::JavaMethod_vtableEntryOffset"); +C2V_VMENTRY(jint, JavaMethod_vtableEntryOffset, (JNIEnv *, jobject, jobject hotspot_method)) methodOop method = getMethodFromHotSpotMethod(hotspot_method); assert(!instanceKlass::cast(method->method_holder())->is_interface(), "vtableEntryOffset cannot be called for interface methods"); @@ -955,13 +865,9 @@ vtable_entry_offset = vtable_entry_offset * wordSize + vtableEntry::method_offset_in_bytes(); return vtable_entry_offset; -} +C2V_END -// public native long[] getDeoptedLeafGraphIds(); -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_getDeoptedLeafGraphIds(JNIEnv *, jobject) { - TRACE_graal_3("CompilerToVM::getDeoptedLeafGraphIds"); - - VM_ENTRY_MARK; +C2V_VMENTRY(jobject, getDeoptedLeafGraphIds, (JNIEnv *, jobject)) // the contract for this method is as follows: // returning null: no deopted leaf graphs @@ -970,13 +876,9 @@ oop array = GraalCompiler::instance()->dump_deopted_leaf_graphs(CHECK_NULL); return JNIHandles::make_local(array); -} +C2V_END -JNIEXPORT jobject JNICALL Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_decodePC(JNIEnv *, jobject, jlong pc) { - TRACE_graal_3("CompilerToVM::decodePC"); - - VM_ENTRY_MARK; - +C2V_VMENTRY(jobject, decodePC, (JNIEnv *, jobject, jlong pc)) stringStream(st); CodeBlob* blob = CodeCache::find_blob_unsafe((void*) pc); if (blob == NULL) { @@ -993,12 +895,11 @@ } Handle result = java_lang_String::create_from_platform_dependent_str(st.as_string(), CHECK_NULL); return JNIHandles::make_local(result()); - -} +C2V_END #define CC (char*) /*cast a literal from (const char*)*/ -#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(Java_com_oracle_graal_hotspot_bridge_CompilerToVMImpl_##f)) +#define FN_PTR(f) CAST_FROM_FN_PTR(void*, &(f)) #define PROXY "J" #define TYPE "Lcom/oracle/graal/api/meta/JavaType;" @@ -1026,42 +927,46 @@ #define STACK_TRACE_ELEMENT "Ljava/lang/StackTraceElement;" JNINativeMethod CompilerToVM_methods[] = { - {CC"JavaMethod_code", CC"("RESOLVED_METHOD")[B", FN_PTR(JavaMethod_1code)}, - {CC"JavaMethod_signature", CC"("RESOLVED_METHOD")"STRING, FN_PTR(JavaMethod_1signature)}, - {CC"JavaMethod_exceptionHandlers", CC"("RESOLVED_METHOD")"EXCEPTION_HANDLERS, FN_PTR(JavaMethod_1exceptionHandlers)}, - {CC"JavaMethod_hasBalancedMonitors", CC"("RESOLVED_METHOD")Z", FN_PTR(JavaMethod_1hasBalancedMonitors)}, - {CC"JavaMethod_uniqueConcreteMethod", CC"("RESOLVED_METHOD")"METHOD, FN_PTR(JavaMethod_1uniqueConcreteMethod)}, - {CC"getJavaMethod", CC"("REFLECT_METHOD")"METHOD, FN_PTR(getJavaMethod)}, - {CC"JavaMethod_methodData", CC"("RESOLVED_METHOD")"METHOD_DATA, FN_PTR(JavaMethod_1methodData)}, - {CC"JavaMethod_invocationCount", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_1invocationCount)}, - {CC"JavaMethod_hasCompiledCode", CC"("RESOLVED_METHOD")Z", FN_PTR(JavaMethod_1hasCompiledCode)}, - {CC"JavaMethod_getCompiledCodeSize", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_1getCompiledCodeSize)}, - {CC"Signature_lookupType", CC"("STRING RESOLVED_TYPE"Z)"TYPE, FN_PTR(Signature_1lookupType)}, - {CC"ConstantPool_lookupConstant", CC"("RESOLVED_TYPE"I)"OBJECT, FN_PTR(ConstantPool_1lookupConstant)}, - {CC"ConstantPool_lookupMethod", CC"("RESOLVED_TYPE"IB)"METHOD, FN_PTR(ConstantPool_1lookupMethod)}, - {CC"ConstantPool_lookupType", CC"("RESOLVED_TYPE"I)"TYPE, FN_PTR(ConstantPool_1lookupType)}, - {CC"ConstantPool_loadReferencedType", CC"("RESOLVED_TYPE"IB)V", FN_PTR(ConstantPool_1loadReferencedType)}, - {CC"ConstantPool_lookupField", CC"("RESOLVED_TYPE"IB)"FIELD, FN_PTR(ConstantPool_1lookupField)}, - {CC"JavaType_resolveMethodImpl", CC"("RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(JavaType_3resolveMethodImpl)}, - {CC"JavaType_isSubtypeOf", CC"("RESOLVED_TYPE TYPE")Z", FN_PTR(JavaType_2isSubtypeOf)}, - {CC"JavaType_leastCommonAncestor", CC"("RESOLVED_TYPE RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_2leastCommonAncestor)}, - {CC"JavaType_componentType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1componentType)}, - {CC"JavaType_uniqueConcreteSubtype", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1uniqueConcreteSubtype)}, - {CC"JavaType_superType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1superType)}, - {CC"JavaType_initialMarkWord", CC"("RESOLVED_TYPE")J", FN_PTR(JavaType_initialMarkWord)}, - {CC"JavaType_arrayOf", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_1arrayOf)}, - {CC"JavaType_fields", CC"("RESOLVED_TYPE")["RESOLVED_FIELD, FN_PTR(JavaType_1fields)}, - {CC"JavaType_isInitialized", CC"("RESOLVED_TYPE")Z", FN_PTR(JavaType_1isInitialized)}, + {CC"JavaMethod_code", CC"("RESOLVED_METHOD")[B", FN_PTR(JavaMethod_code)}, + {CC"JavaMethod_signature", CC"("RESOLVED_METHOD")"STRING, FN_PTR(JavaMethod_signature)}, + {CC"JavaMethod_exceptionHandlers", CC"("RESOLVED_METHOD")"EXCEPTION_HANDLERS, FN_PTR(JavaMethod_exceptionHandlers)}, + {CC"JavaMethod_hasBalancedMonitors", CC"("RESOLVED_METHOD")Z", FN_PTR(JavaMethod_hasBalancedMonitors)}, + {CC"JavaMethod_uniqueConcreteMethod", CC"("RESOLVED_METHOD")"METHOD, FN_PTR(JavaMethod_uniqueConcreteMethod)}, + {CC"JavaMethod_toStackTraceElement", CC"("RESOLVED_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(JavaMethod_toStackTraceElement)}, + {CC"JavaMethod_methodData", CC"("RESOLVED_METHOD")"METHOD_DATA, FN_PTR(JavaMethod_methodData)}, + {CC"JavaMethod_invocationCount", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_invocationCount)}, + {CC"JavaMethod_hasCompiledCode", CC"("RESOLVED_METHOD")Z", FN_PTR(JavaMethod_hasCompiledCode)}, + {CC"JavaMethod_getCompiledCodeSize", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_getCompiledCodeSize)}, + {CC"JavaMethod_vtableEntryOffset", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_vtableEntryOffset)}, + + {CC"Signature_lookupType", CC"("STRING RESOLVED_TYPE"Z)"TYPE, FN_PTR(Signature_lookupType)}, + + {CC"ConstantPool_lookupConstant", CC"("RESOLVED_TYPE"I)"OBJECT, FN_PTR(ConstantPool_lookupConstant)}, + {CC"ConstantPool_lookupMethod", CC"("RESOLVED_TYPE"IB)"METHOD, FN_PTR(ConstantPool_lookupMethod)}, + {CC"ConstantPool_lookupType", CC"("RESOLVED_TYPE"I)"TYPE, FN_PTR(ConstantPool_lookupType)}, + {CC"ConstantPool_loadReferencedType", CC"("RESOLVED_TYPE"IB)V", FN_PTR(ConstantPool_loadReferencedType)}, + {CC"ConstantPool_lookupField", CC"("RESOLVED_TYPE"IB)"FIELD, FN_PTR(ConstantPool_lookupField)}, + + {CC"JavaType_resolveMethodImpl", CC"("RESOLVED_TYPE STRING STRING")"METHOD, FN_PTR(JavaType_resolveMethodImpl)}, + {CC"JavaType_isSubtypeOf", CC"("RESOLVED_TYPE TYPE")Z", FN_PTR(JavaType_isSubtypeOf)}, + {CC"JavaType_leastCommonAncestor", CC"("RESOLVED_TYPE RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_leastCommonAncestor)}, + {CC"JavaType_componentType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_componentType)}, + {CC"JavaType_uniqueConcreteSubtype", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_uniqueConcreteSubtype)}, + {CC"JavaType_superType", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_superType)}, + {CC"JavaType_prototypeMarkWord", CC"("RESOLVED_TYPE")J", FN_PTR(JavaType_prototypeMarkWord)}, + {CC"JavaType_arrayOf", CC"("RESOLVED_TYPE")"TYPE, FN_PTR(JavaType_arrayOf)}, + {CC"JavaType_fields", CC"("RESOLVED_TYPE")["RESOLVED_FIELD, FN_PTR(JavaType_fields)}, + {CC"JavaType_isInitialized", CC"("RESOLVED_TYPE")Z", FN_PTR(JavaType_isInitialized)}, + {CC"getPrimitiveArrayType", CC"("KIND")"TYPE, FN_PTR(getPrimitiveArrayType)}, {CC"getMaxCallTargetOffset", CC"("RUNTIME_CALL")J", FN_PTR(getMaxCallTargetOffset)}, {CC"getType", CC"("CLASS")"TYPE, FN_PTR(getType)}, + {CC"getJavaMethod", CC"("REFLECT_METHOD")"METHOD, FN_PTR(getJavaMethod)}, {CC"initializeConfiguration", CC"("CONFIG")V", FN_PTR(initializeConfiguration)}, {CC"installMethod", CC"("HS_COMP_RESULT"Z"HS_CODE_INFO")"HS_COMP_METHOD, FN_PTR(installMethod)}, {CC"disassembleNative", CC"([BJ)"STRING, FN_PTR(disassembleNative)}, - {CC"JavaMethod_toStackTraceElement", CC"("RESOLVED_METHOD"I)"STACK_TRACE_ELEMENT, FN_PTR(JavaMethod_1toStackTraceElement)}, {CC"executeCompiledMethod", CC"("HS_COMP_METHOD OBJECT OBJECT OBJECT")"OBJECT, FN_PTR(executeCompiledMethod)}, {CC"executeCompiledMethodVarargs", CC"("HS_COMP_METHOD "["OBJECT")"OBJECT, FN_PTR(executeCompiledMethodVarargs)}, - {CC"JavaMethod_vtableEntryOffset", CC"("RESOLVED_METHOD")I", FN_PTR(JavaMethod_vtableEntryOffset)}, {CC"getDeoptedLeafGraphIds", CC"()[J", FN_PTR(getDeoptedLeafGraphIds)}, {CC"decodePC", CC"(J)"STRING, FN_PTR(decodePC)}, };