Mercurial > hg > graal-compiler
annotate graal/com.oracle.graal.hotspot.test/src/com/oracle/graal/hotspot/test/HotSpotResolvedObjectTypeTest.java @ 22604:b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
author | Roland Schatz <roland.schatz@oracle.com> |
---|---|
date | Tue, 08 Sep 2015 19:57:39 +0200 |
parents | f5a43c861150 |
children | ed489bbcccbb |
rev | line source |
---|---|
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
1 /* |
22604
b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22535
diff
changeset
|
2 * Copyright (c) 2013, 2015, Oracle and/or its affiliates. All rights reserved. |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
4 * |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
8 * |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
13 * accompanied this code). |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
14 * |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
18 * |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
21 * questions. |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
22 */ |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
23 package com.oracle.graal.hotspot.test; |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
24 |
22054 | 25 import jdk.internal.jvmci.hotspot.*; |
22520
412c6ac963ed
added disabled test showing problem with CompilerToVM.getResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
26 import jdk.internal.jvmci.meta.*; |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
27 |
22054 | 28 import org.junit.*; |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
29 |
22535
f5a43c861150
Use proper stamp for read in HotSpotResolvedObjectTypeTest
Tom Rodriguez <tom.rodriguez@oracle.com>
parents:
22520
diff
changeset
|
30 import com.oracle.graal.compiler.common.type.*; |
22520
412c6ac963ed
added disabled test showing problem with CompilerToVM.getResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
31 |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
32 /** |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18167
diff
changeset
|
33 * Tests {@link HotSpotResolvedJavaMethod} functionality. |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
34 */ |
22520
412c6ac963ed
added disabled test showing problem with CompilerToVM.getResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
35 public class HotSpotResolvedObjectTypeTest extends HotSpotGraalCompilerTest { |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
36 |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
37 @Test |
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
38 public void testGetSourceFileName() throws Throwable { |
18223
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18167
diff
changeset
|
39 Assert.assertEquals("Object.java", HotSpotResolvedObjectTypeImpl.fromObjectClass(Object.class).getSourceFileName()); |
17c98fad6980
converted HotSpotResolvedObjectType to an interface
Doug Simon <doug.simon@oracle.com>
parents:
18167
diff
changeset
|
40 Assert.assertEquals("HotSpotResolvedObjectTypeTest.java", HotSpotResolvedObjectTypeImpl.fromObjectClass(this.getClass()).getSourceFileName()); |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
41 } |
22520
412c6ac963ed
added disabled test showing problem with CompilerToVM.getResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
42 |
412c6ac963ed
added disabled test showing problem with CompilerToVM.getResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
43 @Test |
412c6ac963ed
added disabled test showing problem with CompilerToVM.getResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
44 public void testKlassLayoutHelper() { |
412c6ac963ed
added disabled test showing problem with CompilerToVM.getResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
45 JavaConstant klass = HotSpotResolvedObjectTypeImpl.fromObjectClass(this.getClass()).klass(); |
412c6ac963ed
added disabled test showing problem with CompilerToVM.getResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
46 MemoryAccessProvider memoryAccess = getProviders().getConstantReflection().getMemoryAccessProvider(); |
412c6ac963ed
added disabled test showing problem with CompilerToVM.getResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
47 HotSpotVMConfig config = runtime().getConfig(); |
22604
b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22535
diff
changeset
|
48 Constant c = StampFactory.forKind(JavaKind.Int).readConstant(memoryAccess, klass, config.klassLayoutHelperOffset); |
22520
412c6ac963ed
added disabled test showing problem with CompilerToVM.getResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
49 assertTrue(c.toString(), c.getClass() == PrimitiveConstant.class); |
412c6ac963ed
added disabled test showing problem with CompilerToVM.getResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
50 PrimitiveConstant pc = (PrimitiveConstant) c; |
22604
b00cc0475f31
Update jvmci import: Refactoring: Rename Kind to JavaKind.
Roland Schatz <roland.schatz@oracle.com>
parents:
22535
diff
changeset
|
51 assertTrue(pc.toString(), pc.getJavaKind() == JavaKind.Int); |
22520
412c6ac963ed
added disabled test showing problem with CompilerToVM.getResolvedJavaType
Doug Simon <doug.simon@oracle.com>
parents:
22054
diff
changeset
|
52 } |
13254
42aaf7306707
Teach Graal about Symbol and ConstantPool so we can move more logic into Java. We'll see how that ends...
twisti
parents:
diff
changeset
|
53 } |