annotate graal/com.oracle.graal.api.meta/src/com/oracle/graal/api/meta/MetaAccessProvider.java @ 6442:45f682f7fea8

Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
author Christian Wimmer <christian.wimmer@oracle.com>
date Tue, 25 Sep 2012 09:23:45 -0700
parents 92bc58dc5b5e
children 2463eb24b644
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
5509
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
1 /*
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
2 * Copyright (c) 2012, 2012, Oracle and/or its affiliates. All rights reserved.
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
4 *
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
5 * This code is free software; you can redistribute it and/or modify it
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
6 * under the terms of the GNU General Public License version 2 only, as
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
7 * published by the Free Software Foundation.
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
8 *
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
9 * This code is distributed in the hope that it will be useful, but WITHOUT
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
12 * version 2 for more details (a copy is included in the LICENSE file that
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
13 * accompanied this code).
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
14 *
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
15 * You should have received a copy of the GNU General Public License version
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
16 * 2 along with this work; if not, write to the Free Software Foundation,
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
18 *
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
20 * or visit www.oracle.com if you need additional information or have any
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
21 * questions.
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
22 */
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
23 package com.oracle.graal.api.meta;
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
24
5535
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
25 import java.lang.reflect.*;
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
26
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6328
diff changeset
27 /**
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6328
diff changeset
28 * Interface implemented by the runtime to allow access to its meta data.
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6328
diff changeset
29 *
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6328
diff changeset
30 */
5509
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
31 public interface MetaAccessProvider {
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
32
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6328
diff changeset
33 /**
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6328
diff changeset
34 * Returns the resolved Java type representing a given Java class.
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6328
diff changeset
35 *
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6328
diff changeset
36 * @param clazz the Java class object
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6328
diff changeset
37 * @return the resolved Java type object
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6328
diff changeset
38 */
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6328
diff changeset
39 ResolvedJavaType getResolvedJavaType(Class< ? > clazz);
5535
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
40
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
41 /**
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
42 * Returns the JavaType object representing the base type for the given kind.
5535
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
43 */
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
44 ResolvedJavaType getResolvedJavaType(Kind kind);
5535
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
45
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
46 /**
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
47 * Returns the type of the given constant object.
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
48 *
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
49 * @return {@code null} if {@code constant.isNull() || !constant.kind.isObject()}
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
50 */
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
51 ResolvedJavaType getTypeOf(Constant constant);
5535
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
52
6328
6e66d97a16ae Clean up Kind class.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5572
diff changeset
53 /**
6329
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6328
diff changeset
54 * Used by the canonicalizer to compare objects, since a given runtime might not want to expose the real objects to
92bc58dc5b5e More clean up and documentation in api.code and api.meta.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 6328
diff changeset
55 * the compiler.
5535
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
56 *
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
57 * @return true if the two parameters represent the same runtime object, false otherwise
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
58 */
5538
e18ba36bfebc Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5535
diff changeset
59 boolean areConstantObjectsEqual(Constant x, Constant y);
5535
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
60
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
61 /**
6442
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
62 * Provides the {@link ResolvedJavaMethod} for a {@link Method} obtained via reflection.
5535
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
63 */
5541
b4c406861c33 More renamings to drop Ri* prefix completely. Deleted graph.BitMap class and replaced with java.util.BitSet.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5540
diff changeset
64 ResolvedJavaMethod getResolvedJavaMethod(Method reflectionMethod);
5535
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
65
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
66 /**
6442
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
67 * Provides the {@link ResolvedJavaField} for a {@link Field} obtained via reflection.
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
68 */
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
69 ResolvedJavaField getResolvedJavaField(Field reflectionField);
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
70
45f682f7fea8 Add MetaAccessProvider.getResolvedJavaField to convert from reflection field to metadata field
Christian Wimmer <christian.wimmer@oracle.com>
parents: 6329
diff changeset
71 /**
5572
8f9c9d372e31 small renaming and doc fixes
Lukas Stadler <lukas.stadler@jku.at>
parents: 5541
diff changeset
72 * Gets the length of the array that is wrapped in a Constant object.
5535
e624cded7986 Moving methods from RiRuntime to MetaAccessProvider.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5509
diff changeset
73 */
5538
e18ba36bfebc Renamed RiConstant => Constant.
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents: 5535
diff changeset
74 int getArrayLength(Constant array);
5509
6ed763809de7 Added new projects graal.api.code and graal.api.interpreter
Thomas Wuerthinger <thomas.wuerthinger@oracle.com>
parents:
diff changeset
75 }