comparison graal/com.oracle.max.graal.runtime/src/com/oracle/max/graal/runtime/HotSpotVMConfig.java @ 2874:d90bf514d647

Renamed packages.
author Thomas Wuerthinger <thomas@wuerthinger.net>
date Wed, 08 Jun 2011 08:59:54 +0200
parents graal/com.oracle.max.graal.runtime/src/com/oracle/graal/runtime/HotSpotVMConfig.java@0341b6424579
children 224412c24426
comparison
equal deleted inserted replaced
2873:810e2d253e00 2874:d90bf514d647
1 /*
2 * Copyright (c) 2011, Oracle and/or its affiliates. All rights reserved.
3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
4 *
5 * This code is free software; you can redistribute it and/or modify it
6 * under the terms of the GNU General Public License version 2 only, as
7 * published by the Free Software Foundation.
8 *
9 * This code is distributed in the hope that it will be useful, but WITHOUT
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 com.oracle.max.graal.runtime;
24
25 import com.sun.cri.ci.*;
26
27 /**
28 * Used to communicate configuration details, runtime offsets, etc. to c1x upon compileMethod.
29 */
30 public final class HotSpotVMConfig extends CompilerObject {
31
32 private HotSpotVMConfig() {
33 super(null);
34 }
35
36 // os information, register layout, code generation, ...
37 public boolean windowsOs;
38 public int codeEntryAlignment;
39 public boolean verifyPointers;
40 public boolean useFastLocking;
41 public boolean useFastNewObjectArray;
42 public boolean useFastNewTypeArray;
43
44 // offsets, ...
45 public int vmPageSize;
46 public int stackShadowPages;
47 public int hubOffset;
48 public int arrayLengthOffset;
49 public int klassStateOffset;
50 public int klassStateFullyInitialized;
51 public int[] arrayOffsets;
52 public int arrayClassElementOffset;
53 public int threadTlabTopOffset;
54 public int threadTlabEndOffset;
55 public int threadObjectOffset;
56 public int instanceHeaderPrototypeOffset;
57 public int threadExceptionOopOffset;
58 public int threadExceptionPcOffset;
59 public int threadMultiNewArrayStorage;
60 public long cardtableStartAddress;
61 public int cardtableShift;
62 public long safepointPollingAddress;
63 public int classMirrorOffset;
64
65 // runtime stubs
66 public long debugStub;
67 public long instanceofStub;
68 public long newInstanceStub;
69 public long unresolvedNewInstanceStub;
70 public long newTypeArrayStub;
71 public long newObjectArrayStub;
72 public long newMultiArrayStub;
73 public long loadKlassStub;
74 public long accessFieldStub;
75 public long resolveStaticCallStub;
76 public long inlineCacheMissStub;
77 public long unwindExceptionStub;
78 public long handleExceptionStub;
79 public long handleDeoptStub;
80 public long monitorEnterStub;
81 public long monitorExitStub;
82 public long fastMonitorEnterStub;
83 public long fastMonitorExitStub;
84 public long verifyPointerStub;
85
86 public void check() {
87 assert vmPageSize >= 16;
88 assert codeEntryAlignment > 0;
89 assert stackShadowPages > 0;
90 }
91
92 public int getArrayOffset(CiKind kind) {
93 return arrayOffsets[getKindNumber(kind)];
94 }
95
96 private int getKindNumber(CiKind kind) {
97 if (kind == CiKind.Boolean) {
98 return 0;
99 } else if (kind == CiKind.Byte) {
100 return 1;
101 } else if (kind == CiKind.Short) {
102 return 2;
103 } else if (kind == CiKind.Char) {
104 return 3;
105 } else if (kind == CiKind.Int) {
106 return 4;
107 } else if (kind == CiKind.Float) {
108 return 5;
109 } else if (kind == CiKind.Long) {
110 return 6;
111 } else if (kind == CiKind.Double) {
112 return 7;
113 } else if (kind == CiKind.Object) {
114 return 8;
115 } else {
116 throw new RuntimeException(kind + " is not a Java kind");
117 }
118 }
119 }