Mercurial > hg > truffle
annotate graal/com.oracle.graal.phases.common.test/src/com/oracle/graal/phases/common/test/StampFactoryTest.java @ 21916:3df76a0300f3
jvmci.make remove generated source from search path; export compilers into a different directory when jvmci is disabled: jre/lib/<arch>/(server|client)-nojvmci/
author | Stefan Anzinger <stefan.anzinger@oracle.com> |
---|---|
date | Thu, 11 Jun 2015 11:07:28 +0200 |
parents | 47bebae7454f |
children |
rev | line source |
---|---|
18726
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
1 /* |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
2 * Copyright (c) 2013, Oracle and/or its affiliates. All rights reserved. |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
4 * |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
5 * This code is free software; you can redistribute it and/or modify it |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
6 * under the terms of the GNU General Public License version 2 only, as |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
7 * published by the Free Software Foundation. |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
8 * |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
9 * This code is distributed in the hope that it will be useful, but WITHOUT |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
12 * version 2 for more details (a copy is included in the LICENSE file that |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
13 * accompanied this code). |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
14 * |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
15 * You should have received a copy of the GNU General Public License version |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
16 * 2 along with this work; if not, write to the Free Software Foundation, |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
18 * |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
20 * or visit www.oracle.com if you need additional information or have any |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
21 * questions. |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
22 */ |
18728
e2460f2b3121
Fix Checkstyle error.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
18726
diff
changeset
|
23 package com.oracle.graal.phases.common.test; |
18726
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
24 |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
25 import java.lang.reflect.*; |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
26 |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
27 import org.junit.*; |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
28 |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
29 import com.oracle.graal.api.runtime.*; |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
30 import com.oracle.graal.compiler.common.type.*; |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
31 import com.oracle.graal.runtime.*; |
21562 | 32 import com.oracle.jvmci.meta.*; |
18726
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
33 |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
34 public class StampFactoryTest { |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
35 |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
36 @SuppressWarnings("unused") |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
37 public void test(int a, Object b, double c) { |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
38 } |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
39 |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
40 @Test |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
41 public void testParameters() throws NoSuchMethodException, SecurityException { |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
42 Method method = StampFactoryTest.class.getMethod("test", Integer.TYPE, Object.class, Double.TYPE); |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
43 MetaAccessProvider metaAccess = Graal.getRequiredCapability(RuntimeProvider.class).getHostBackend().getProviders().getMetaAccess(); |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
44 Stamp[] parameterStamps = StampFactory.createParameterStamps(metaAccess.lookupJavaMethod(method)); |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
45 Stamp[] expected = {StampFactory.declaredNonNull(metaAccess.lookupJavaType(StampFactoryTest.class)), StampFactory.forKind(Kind.Int), |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
46 StampFactory.declared(metaAccess.lookupJavaType(Object.class)), StampFactory.forKind(Kind.Double)}; |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
47 Assert.assertArrayEquals(expected, parameterStamps); |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
48 } |
8153d8cf264c
Added unit test for StampFactoryTest.createParameterStamps.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff
changeset
|
49 } |