10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package jdk.vm.ci.hotspot;
24
25 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
26 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale;
27
28 import java.lang.reflect.Array;
29
30 import jdk.vm.ci.meta.Constant;
31 import jdk.vm.ci.meta.ConstantReflectionProvider;
32 import jdk.vm.ci.meta.JavaConstant;
33 import jdk.vm.ci.meta.JavaKind;
34 import jdk.vm.ci.meta.JavaType;
35 import jdk.vm.ci.meta.MemoryAccessProvider;
36 import jdk.vm.ci.meta.MethodHandleAccessProvider;
37 import jdk.vm.ci.meta.ResolvedJavaField;
38 import jdk.vm.ci.meta.ResolvedJavaType;
39
40 /**
41 * HotSpot implementation of {@link ConstantReflectionProvider}.
42 */
43 public class HotSpotConstantReflectionProvider implements ConstantReflectionProvider, HotSpotProxified {
44
45 /**
46 * Determines whether to treat {@code final} fields with default values as constant.
47 */
48 private static final boolean TrustFinalDefaultFields = HotSpotJVMCIRuntime.getBooleanProperty("TrustFinalDefaultFields", true);
49
50 protected final HotSpotJVMCIRuntimeProvider runtime;
51 protected final HotSpotMethodHandleAccessProvider methodHandleAccess;
52 protected final HotSpotMemoryAccessProviderImpl memoryAccess;
53
54 public HotSpotConstantReflectionProvider(HotSpotJVMCIRuntimeProvider runtime) {
55 this.runtime = runtime;
56 this.methodHandleAccess = new HotSpotMethodHandleAccessProvider(this);
57 this.memoryAccess = new HotSpotMemoryAccessProviderImpl(runtime);
58 }
59
60 public MethodHandleAccessProvider getMethodHandleAccess() {
61 return methodHandleAccess;
62 }
63
64 @Override
65 public MemoryAccessProvider getMemoryAccessProvider() {
66 return memoryAccess;
67 }
68
|
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
12 * version 2 for more details (a copy is included in the LICENSE file that
13 * accompanied this code).
14 *
15 * You should have received a copy of the GNU General Public License version
16 * 2 along with this work; if not, write to the Free Software Foundation,
17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
18 *
19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
20 * or visit www.oracle.com if you need additional information or have any
21 * questions.
22 */
23 package jdk.vm.ci.hotspot;
24
25 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayBaseOffset;
26 import static jdk.vm.ci.hotspot.HotSpotJVMCIRuntimeProvider.getArrayIndexScale;
27
28 import java.lang.reflect.Array;
29
30 import jdk.vm.ci.hotspot.HotSpotJVMCIRuntime.Option;
31 import jdk.vm.ci.meta.Constant;
32 import jdk.vm.ci.meta.ConstantReflectionProvider;
33 import jdk.vm.ci.meta.JavaConstant;
34 import jdk.vm.ci.meta.JavaKind;
35 import jdk.vm.ci.meta.JavaType;
36 import jdk.vm.ci.meta.MemoryAccessProvider;
37 import jdk.vm.ci.meta.MethodHandleAccessProvider;
38 import jdk.vm.ci.meta.ResolvedJavaField;
39 import jdk.vm.ci.meta.ResolvedJavaType;
40
41 /**
42 * HotSpot implementation of {@link ConstantReflectionProvider}.
43 */
44 public class HotSpotConstantReflectionProvider implements ConstantReflectionProvider, HotSpotProxified {
45
46 /**
47 * Determines whether to treat {@code final} fields with default values as constant.
48 */
49 private static final boolean TrustFinalDefaultFields = Option.TrustFinalDefaultFields.getBoolean();
50
51 protected final HotSpotJVMCIRuntimeProvider runtime;
52 protected final HotSpotMethodHandleAccessProvider methodHandleAccess;
53 protected final HotSpotMemoryAccessProviderImpl memoryAccess;
54
55 public HotSpotConstantReflectionProvider(HotSpotJVMCIRuntimeProvider runtime) {
56 this.runtime = runtime;
57 this.methodHandleAccess = new HotSpotMethodHandleAccessProvider(this);
58 this.memoryAccess = new HotSpotMemoryAccessProviderImpl(runtime);
59 }
60
61 public MethodHandleAccessProvider getMethodHandleAccess() {
62 return methodHandleAccess;
63 }
64
65 @Override
66 public MemoryAccessProvider getMemoryAccessProvider() {
67 return memoryAccess;
68 }
69
|