001/*
002 *  This file is part of the Jikes RVM project (http://jikesrvm.org).
003 *
004 *  This file is licensed to You under the Eclipse Public License (EPL);
005 *  You may not use this file except in compliance with the License. You
006 *  may obtain a copy of the License at
007 *
008 *      http://www.opensource.org/licenses/eclipse-1.0.php
009 *
010 *  See the COPYRIGHT.txt file distributed with this work for information
011 *  regarding copyright ownership.
012 */
013package org.jikesrvm.runtime;
014
015import static org.jikesrvm.runtime.EntrypointHelper.getField;
016import static org.jikesrvm.runtime.EntrypointHelper.getMethod;
017
018import org.jikesrvm.VM;
019import org.jikesrvm.classloader.RVMField;
020import org.jikesrvm.classloader.RVMMethod;
021import org.jikesrvm.classloader.NormalMethod;
022
023/**
024 * Fields and methods of the virtual machine that are needed by
025 * compiler-generated machine code or C runtime code.
026 */
027public class Entrypoints {
028  // The usual causes for getField/Method() to fail are:
029  //  1. you misspelled the class name, member name, or member signature
030  //  2. the class containing the specified member didn't get compiled
031  //
032
033  public static final NormalMethod bootMethod = EntrypointHelper.getMethod(org.jikesrvm.VM.class, "boot", "()V");
034
035  public static final RVMMethod java_lang_reflect_Method_invokeMethod =
036      getMethod(java.lang.reflect.Method.class, "invoke",
037          "(Ljava/lang/Object;[Ljava/lang/Object;)Ljava/lang/Object;");
038  public static final RVMMethod getClassFromStackFrame =
039    getMethod(org.jikesrvm.classloader.RVMClass.class, "getClassFromStackFrame", "(I)Lorg/jikesrvm/classloader/RVMClass;");
040  public static final RVMMethod getClassLoaderFromStackFrame =
041    getMethod(org.jikesrvm.classloader.RVMClass.class, "getClassLoaderFromStackFrame", "(I)Ljava/lang/ClassLoader;");
042
043  public static final RVMField magicObjectRemapperField =
044      getField(org.jikesrvm.runtime.Magic.class,
045               "objectAddressRemapper",
046               org.jikesrvm.runtime.ObjectAddressRemapper.class);
047
048  public static final NormalMethod instanceOfMethod =
049      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "instanceOf", "(Ljava/lang/Object;I)Z");
050  public static final NormalMethod checkcastMethod =
051      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "checkcast", "(Ljava/lang/Object;I)V");
052  public static final NormalMethod checkstoreMethod =
053      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "checkstore", "(Ljava/lang/Object;Ljava/lang/Object;)V");
054  public static final NormalMethod aastoreMethod =
055      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "aastore", "([Ljava/lang/Object;ILjava/lang/Object;)V");
056  public static final NormalMethod aastoreUninterruptibleMethod =
057      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "aastoreUninterruptible", "([Ljava/lang/Object;ILjava/lang/Object;)V");
058  public static final NormalMethod athrowMethod =
059      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "athrow", "(Ljava/lang/Throwable;)V");
060
061  // Allocation-related entry points
062  //
063  public static final NormalMethod resolvedNewScalarMethod =
064      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class,
065                "resolvedNewScalar",
066                "(ILorg/jikesrvm/objectmodel/TIB;ZIIII)Ljava/lang/Object;");
067  public static final NormalMethod unresolvedNewScalarMethod =
068      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "unresolvedNewScalar", "(II)Ljava/lang/Object;");
069  public static final NormalMethod unresolvedNewArrayMethod =
070      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "unresolvedNewArray", "(III)Ljava/lang/Object;");
071  public static final NormalMethod resolvedNewArrayMethod =
072      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class,
073                "resolvedNewArray",
074                "(IIILorg/jikesrvm/objectmodel/TIB;IIII)Ljava/lang/Object;");
075
076  public static final RVMField sysWriteLockField = getField(org.jikesrvm.VM.class, "sysWriteLock", int.class);
077  public static final RVMField intBufferLockField =
078      getField(org.jikesrvm.util.Services.class, "intBufferLock", int.class);
079  public static final RVMField dumpBufferLockField =
080      getField(org.jikesrvm.util.Services.class, "dumpBufferLock", int.class);
081
082  public static final NormalMethod unexpectedAbstractMethodCallMethod =
083      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "unexpectedAbstractMethodCall", "()V");
084  public static final NormalMethod raiseNullPointerException =
085      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "raiseNullPointerException", "()V");
086  public static final NormalMethod raiseArrayBoundsException =
087      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "raiseArrayIndexOutOfBoundsException", "(I)V");
088  public static final NormalMethod raiseArithmeticException =
089      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "raiseArithmeticException", "()V");
090  public static final NormalMethod raiseAbstractMethodError =
091      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "raiseAbstractMethodError", "()V");
092  public static final NormalMethod raiseIllegalAccessError =
093      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "raiseIllegalAccessError", "()V");
094  public static final NormalMethod deliverHardwareExceptionMethod =
095      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "deliverHardwareException", "(ILorg/vmmagic/unboxed/Word;)V");
096  public static final NormalMethod unlockAndThrowMethod =
097      getMethod(org.jikesrvm.runtime.RuntimeEntrypoints.class, "unlockAndThrow", "(Ljava/lang/Object;Ljava/lang/Throwable;)V");
098
099  public static final RVMField gcLockField = getField("Ljava/lang/VMCommonLibrarySupport$GCLock;", "gcLock", int.class);
100
101  public static final NormalMethod invokeInterfaceMethod =
102      getMethod(org.jikesrvm.classloader.InterfaceInvocation.class,
103                "invokeInterface",
104                "(Ljava/lang/Object;I)Lorg/jikesrvm/compilers/common/CodeArray;");
105  public static final NormalMethod findItableMethod =
106      getMethod(org.jikesrvm.classloader.InterfaceInvocation.class,
107                "findITable",
108                "(Lorg/jikesrvm/objectmodel/TIB;I)Lorg/jikesrvm/objectmodel/ITable;");
109  public static final NormalMethod unresolvedInvokeinterfaceImplementsTestMethod =
110      getMethod(org.jikesrvm.classloader.InterfaceInvocation.class,
111                "unresolvedInvokeinterfaceImplementsTest",
112                "(ILjava/lang/Object;)V");
113
114  public static final NormalMethod lockMethod =
115      getMethod(org.jikesrvm.objectmodel.ObjectModel.class, "genericLock", "(Ljava/lang/Object;)V");
116  public static final NormalMethod unlockMethod =
117      getMethod(org.jikesrvm.objectmodel.ObjectModel.class, "genericUnlock", "(Ljava/lang/Object;)V");
118
119  public static final NormalMethod inlineLockMethod =
120      getMethod(org.jikesrvm.scheduler.ThinLock.class,
121                "inlineLock",
122                "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;)V");
123  public static final NormalMethod inlineUnlockMethod =
124      getMethod(org.jikesrvm.scheduler.ThinLock.class,
125                "inlineUnlock",
126                "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;)V");
127
128  public static final NormalMethod lazyMethodInvokerMethod =
129      getMethod(org.jikesrvm.runtime.DynamicLinker.class, "lazyMethodInvoker", "()V");
130  public static final NormalMethod unimplementedNativeMethodMethod =
131      getMethod(org.jikesrvm.runtime.DynamicLinker.class, "unimplementedNativeMethod", "()V");
132  public static final NormalMethod sysCallMethod =
133      getMethod(org.jikesrvm.runtime.DynamicLinker.class, "sysCallMethod", "()V");
134
135  public static final NormalMethod resolveMemberMethod =
136      getMethod(org.jikesrvm.classloader.TableBasedDynamicLinker.class, "resolveMember", "(I)I");
137  public static final RVMField memberOffsetsField =
138      getField(org.jikesrvm.classloader.TableBasedDynamicLinker.class, "memberOffsets", int[].class);
139
140  /** 1L */
141  public static final RVMField longOneField = getField(org.jikesrvm.runtime.MathConstants.class, "longOne", long.class);
142  /** -1.0F */
143  public static final RVMField minusOneField = getField(org.jikesrvm.runtime.MathConstants.class, "minusOne", float.class);
144  /** 0.0F */
145  public static final RVMField zeroFloatField = getField(org.jikesrvm.runtime.MathConstants.class, "zero", float.class);
146  /**0.5F */
147  public static final RVMField halfFloatField = getField(org.jikesrvm.runtime.MathConstants.class, "half", float.class);
148  /** 1.0F */
149  public static final RVMField oneFloatField = getField(org.jikesrvm.runtime.MathConstants.class, "one", float.class);
150  /** 2.0F */
151  public static final RVMField twoFloatField = getField(org.jikesrvm.runtime.MathConstants.class, "two", float.class);
152  /** 2.0F^32 */
153  public static final RVMField two32Field = getField(org.jikesrvm.runtime.MathConstants.class, "two32", float.class);
154  /** 0.5F^32 */
155  public static final RVMField half32Field = getField(org.jikesrvm.runtime.MathConstants.class, "half32", float.class);
156  /** 1e-9 */
157  public static final RVMField billionthField = getField(org.jikesrvm.runtime.MathConstants.class, "billionth", double.class);
158  /** 0.0 */
159  public static final RVMField zeroDoubleField = getField(org.jikesrvm.runtime.MathConstants.class, "zeroD", double.class);
160  /** 1.0 */
161  public static final RVMField oneDoubleField = getField(org.jikesrvm.runtime.MathConstants.class, "oneD", double.class);
162  /** largest double that can be rounded to an int */
163  public static final RVMField maxintField =
164      getField(org.jikesrvm.runtime.MathConstants.class, "maxint", double.class);
165  /** largest double that can be rounded to a long */
166  public static final RVMField maxlongField =
167    getField(org.jikesrvm.runtime.MathConstants.class, "maxlong", double.class);
168  /** smallest double that can be rounded to an int */
169  public static final RVMField minintField =
170      getField(org.jikesrvm.runtime.MathConstants.class, "minint", double.class);
171  /** largest float that can be rounded to an int */
172  public static final RVMField maxintFloatField =
173    getField(org.jikesrvm.runtime.MathConstants.class, "maxintF", float.class);
174  /** largest float that can be rounded to a long */
175  public static final RVMField maxlongFloatField =
176    getField(org.jikesrvm.runtime.MathConstants.class, "maxlongF", float.class);
177  /** IEEEmagic constant */
178  public static final RVMField IEEEmagicField =
179      getField(org.jikesrvm.runtime.MathConstants.class, "IEEEmagic", double.class);
180  /** special double value for use in int <--> double conversions */
181  public static final RVMField I2DconstantField =
182      getField(org.jikesrvm.runtime.MathConstants.class,
183               "I2Dconstant",
184               double.class);
185
186  public static final RVMField bootThreadField =
187    getField(org.jikesrvm.scheduler.RVMThread.class, "bootThread",
188             org.jikesrvm.scheduler.RVMThread.class);
189
190  public static final RVMField scratchStorageField =
191      getField(org.jikesrvm.scheduler.RVMThread.class, "scratchStorage", double.class);
192  public static final RVMField takeYieldpointField =
193      getField(org.jikesrvm.scheduler.RVMThread.class, "takeYieldpoint", int.class);
194
195  public static final RVMField execStatusField = getField(org.jikesrvm.scheduler.RVMThread.class, "execStatus", int.class);
196
197  public static final RVMField referenceReferentField =
198      getField(java.lang.ref.Reference.class, "_referent", org.vmmagic.unboxed.Address.class);
199
200  /** Used in deciding which stack frames we can elide when printing. */
201  public static final NormalMethod mainThreadRunMethod =
202      getMethod(org.jikesrvm.scheduler.MainThread.class, "run", "()V");
203
204  public static final NormalMethod yieldpointFromPrologueMethod =
205      getMethod(org.jikesrvm.scheduler.RVMThread.class, "yieldpointFromPrologue", "()V");
206  public static final NormalMethod yieldpointFromBackedgeMethod =
207      getMethod(org.jikesrvm.scheduler.RVMThread.class, "yieldpointFromBackedge", "()V");
208  public static final NormalMethod yieldpointFromEpilogueMethod =
209      getMethod(org.jikesrvm.scheduler.RVMThread.class, "yieldpointFromEpilogue", "()V");
210  public static final NormalMethod enterJNIBlockedFromJNIFunctionCallMethod =
211      getMethod(org.jikesrvm.scheduler.RVMThread.class, "enterJNIBlockedFromJNIFunctionCall", "()V");
212  public static final NormalMethod enterJNIBlockedFromCallIntoNativeMethod =
213      getMethod(org.jikesrvm.scheduler.RVMThread.class, "enterJNIBlockedFromCallIntoNative", "()V");
214  public static final NormalMethod leaveJNIBlockedFromJNIFunctionCallMethod =
215      getMethod(org.jikesrvm.scheduler.RVMThread.class, "leaveJNIBlockedFromJNIFunctionCall", "()V");
216  public static final NormalMethod leaveJNIBlockedFromCallIntoNativeMethod =
217      getMethod(org.jikesrvm.scheduler.RVMThread.class, "leaveJNIBlockedFromCallIntoNative", "()V");
218
219  public static final NormalMethod threadRunMethod = getMethod(org.jikesrvm.scheduler.RVMThread.class, "run", "()V");
220  public static final NormalMethod threadStartoffMethod =
221      getMethod(org.jikesrvm.scheduler.RVMThread.class, "startoff", "()V");
222  public static final RVMField threadStackField = getField(org.jikesrvm.scheduler.RVMThread.class, "stack", byte[].class);
223  public static final RVMField stackLimitField =
224      getField(org.jikesrvm.scheduler.RVMThread.class, "stackLimit", org.vmmagic.unboxed.Address.class);
225
226  public static final RVMField threadSlotField = getField(org.jikesrvm.scheduler.RVMThread.class, "threadSlot", int.class);
227  public static final RVMField jniEnvField =
228      getField(org.jikesrvm.scheduler.RVMThread.class, "jniEnv", org.jikesrvm.jni.JNIEnvironment.class);
229  public static final RVMField threadContextRegistersField =
230      getField(org.jikesrvm.scheduler.RVMThread.class,
231               "contextRegisters",
232               org.jikesrvm.architecture.AbstractRegisters.class);
233  public static final RVMField threadContextRegistersSaveField =
234      getField(org.jikesrvm.scheduler.RVMThread.class,
235               "contextRegistersSave",
236               org.jikesrvm.architecture.AbstractRegisters.class);
237  public static final RVMField threadExceptionRegistersField =
238      getField(org.jikesrvm.scheduler.RVMThread.class,
239               "exceptionRegisters",
240               org.jikesrvm.architecture.AbstractRegisters.class);
241  public static final NormalMethod returnBarrierMethod = getMethod(org.jikesrvm.scheduler.RVMThread.class, "returnBarrier", "()V");
242
243  public static final RVMField tracePrevAddressField =
244      getField(org.jikesrvm.objectmodel.MiscHeader.class, "prevAddress", org.vmmagic.unboxed.Word.class);
245  public static final RVMField traceOIDField =
246      getField(org.jikesrvm.objectmodel.MiscHeader.class, "oid", org.vmmagic.unboxed.Word.class);
247  /*
248  public static final RVMField dispenserField = getField(org.jikesrvm.mm.mmtk.Lock.class, "dispenser", int.class);
249  public static final RVMField servingField = getField(org.jikesrvm.mm.mmtk.Lock.class, "serving", int.class);
250  public static final RVMField lockThreadField =
251      getField(org.jikesrvm.mm.mmtk.Lock.class, "thread", org.jikesrvm.scheduler.RVMThread.class);
252  */
253  public static final RVMField lockStateField = getField(org.jikesrvm.mm.mmtk.Lock.class, "state", int.class);
254  public static final RVMField gcStatusField = getField(org.mmtk.plan.Plan.class, "gcStatus", int.class);
255  public static final RVMField SQCFField = getField(org.mmtk.utility.deque.SharedDeque.class, "completionFlag", int.class);
256  public static final RVMField SQNCField = getField(org.mmtk.utility.deque.SharedDeque.class, "numConsumers", int.class);
257  public static final RVMField SQNCWField =
258      getField(org.mmtk.utility.deque.SharedDeque.class, "numConsumersWaiting", int.class);
259  public static final RVMField SQheadField =
260      getField(org.mmtk.utility.deque.SharedDeque.class, "head", org.vmmagic.unboxed.Address.class);
261  public static final RVMField SQtailField =
262      getField(org.mmtk.utility.deque.SharedDeque.class, "tail", org.vmmagic.unboxed.Address.class);
263  public static final RVMField SQBEField = getField(org.mmtk.utility.deque.SharedDeque.class, "bufsenqueued", int.class);
264  public static final RVMField synchronizedCounterField =
265      getField(org.jikesrvm.mm.mmtk.SynchronizedCounter.class, "count", int.class);
266
267  public static final NormalMethod booleanFieldWriteBarrierMethod =
268    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "booleanFieldWrite", "(Ljava/lang/Object;ZLorg/vmmagic/unboxed/Offset;I)V");
269  public static final NormalMethod booleanArrayWriteBarrierMethod =
270    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "booleanArrayWrite", "([ZIZ)V");
271  public static final NormalMethod booleanFieldReadBarrierMethod =
272    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "booleanFieldRead", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)Z");
273  public static final NormalMethod booleanArrayReadBarrierMethod =
274    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "booleanArrayRead", "([ZI)Z");
275
276  public static final NormalMethod byteFieldWriteBarrierMethod =
277    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "byteFieldWrite", "(Ljava/lang/Object;BLorg/vmmagic/unboxed/Offset;I)V");
278  public static final NormalMethod byteArrayWriteBarrierMethod =
279    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "byteArrayWrite", "([BIB)V");
280  public static final NormalMethod byteFieldReadBarrierMethod =
281    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "byteFieldRead", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)B");
282  public static final NormalMethod byteArrayReadBarrierMethod =
283    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "byteArrayRead", "([BI)B");
284
285  public static final NormalMethod charFieldWriteBarrierMethod =
286    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "charFieldWrite", "(Ljava/lang/Object;CLorg/vmmagic/unboxed/Offset;I)V");
287  public static final NormalMethod charArrayWriteBarrierMethod =
288    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "charArrayWrite", "([CIC)V");
289  public static final NormalMethod charFieldReadBarrierMethod =
290    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "charFieldRead", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)C");
291  public static final NormalMethod charArrayReadBarrierMethod =
292    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "charArrayRead", "([CI)C");
293
294  public static final NormalMethod shortFieldWriteBarrierMethod =
295    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "shortFieldWrite", "(Ljava/lang/Object;SLorg/vmmagic/unboxed/Offset;I)V");
296  public static final NormalMethod shortArrayWriteBarrierMethod =
297    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "shortArrayWrite", "([SIS)V");
298  public static final NormalMethod shortFieldReadBarrierMethod =
299    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "shortFieldRead", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)S");
300  public static final NormalMethod shortArrayReadBarrierMethod =
301    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "shortArrayRead", "([SI)S");
302
303  public static final NormalMethod intFieldWriteBarrierMethod =
304    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "intFieldWrite", "(Ljava/lang/Object;ILorg/vmmagic/unboxed/Offset;I)V");
305  public static final NormalMethod intArrayWriteBarrierMethod =
306    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "intArrayWrite", "([III)V");
307  public static final NormalMethod intFieldReadBarrierMethod =
308    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "intFieldRead", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)I");
309  public static final NormalMethod intArrayReadBarrierMethod =
310    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "intArrayRead", "([II)I");
311
312  public static final NormalMethod longFieldWriteBarrierMethod =
313    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "longFieldWrite", "(Ljava/lang/Object;JLorg/vmmagic/unboxed/Offset;I)V");
314  public static final NormalMethod longArrayWriteBarrierMethod =
315    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "longArrayWrite", "([JIJ)V");
316  public static final NormalMethod longFieldReadBarrierMethod =
317    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "longFieldRead", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)J");
318  public static final NormalMethod longArrayReadBarrierMethod =
319    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "longArrayRead", "([JI)J");
320
321  public static final NormalMethod floatFieldWriteBarrierMethod =
322    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "floatFieldWrite", "(Ljava/lang/Object;FLorg/vmmagic/unboxed/Offset;I)V");
323  public static final NormalMethod floatArrayWriteBarrierMethod =
324    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "floatArrayWrite", "([FIF)V");
325  public static final NormalMethod floatFieldReadBarrierMethod =
326    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "floatFieldRead", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)F");
327  public static final NormalMethod floatArrayReadBarrierMethod =
328    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "floatArrayRead", "([FI)F");
329
330  public static final NormalMethod doubleFieldWriteBarrierMethod =
331    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "doubleFieldWrite", "(Ljava/lang/Object;DLorg/vmmagic/unboxed/Offset;I)V");
332  public static final NormalMethod doubleArrayWriteBarrierMethod =
333    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "doubleArrayWrite", "([DID)V");
334  public static final NormalMethod doubleFieldReadBarrierMethod =
335    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "doubleFieldRead", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)D");
336  public static final NormalMethod doubleArrayReadBarrierMethod =
337    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "doubleArrayRead", "([DI)D");
338
339  public static final NormalMethod objectFieldWriteBarrierMethod =
340    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "objectFieldWrite", "(Ljava/lang/Object;Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)V");
341  public static final NormalMethod objectArrayWriteBarrierMethod =
342    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "objectArrayWrite", "([Ljava/lang/Object;ILjava/lang/Object;)V");
343  public static final NormalMethod objectFieldReadBarrierMethod =
344    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "objectFieldRead", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)Ljava/lang/Object;");
345  public static final NormalMethod objectArrayReadBarrierMethod =
346    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "objectArrayRead", "([Ljava/lang/Object;I)Ljava/lang/Object;");
347
348  public static final NormalMethod wordFieldWriteBarrierMethod =
349    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "wordFieldWrite", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Word;Lorg/vmmagic/unboxed/Offset;I)V");
350  public static final NormalMethod wordFieldReadBarrierMethod =
351    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "wordFieldRead", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)Lorg/vmmagic/unboxed/Word;");
352
353  public static final NormalMethod addressFieldWriteBarrierMethod =
354    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "addressFieldWrite", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Address;Lorg/vmmagic/unboxed/Offset;I)V");
355  public static final NormalMethod addressFieldReadBarrierMethod =
356    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "addressFieldRead", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)Lorg/vmmagic/unboxed/Address;");
357
358  public static final NormalMethod offsetFieldWriteBarrierMethod =
359    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "offsetFieldWrite", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;Lorg/vmmagic/unboxed/Offset;I)V");
360  public static final NormalMethod offsetFieldReadBarrierMethod =
361    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "offsetFieldRead", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)Lorg/vmmagic/unboxed/Offset;");
362
363  public static final NormalMethod extentFieldWriteBarrierMethod =
364    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "extentFieldWrite", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Extent;Lorg/vmmagic/unboxed/Offset;I)V");
365  public static final NormalMethod extentFieldReadBarrierMethod =
366    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "extentFieldRead", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)Lorg/vmmagic/unboxed/Extent;");
367
368  public static final NormalMethod objectStaticWriteBarrierMethod =
369    getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "objectStaticWrite", "(Ljava/lang/Object;Lorg/vmmagic/unboxed/Offset;I)V");
370  public static final NormalMethod objectStaticReadBarrierMethod =
371      getMethod(org.jikesrvm.mm.mminterface.Barriers.class, "objectStaticRead", "(Lorg/vmmagic/unboxed/Offset;I)Ljava/lang/Object;");
372
373  public static final NormalMethod modifyCheckMethod =
374      getMethod(org.jikesrvm.mm.mminterface.MemoryManager.class, "modifyCheck", "(Ljava/lang/Object;)V");
375
376  // used in boot image writer
377  public static final RVMField debugRequestedField =
378      getField(org.jikesrvm.scheduler.RVMThread.class, "debugRequested", boolean.class);
379  public static final NormalMethod dumpStackAndDieMethod =
380      getMethod(org.jikesrvm.scheduler.RVMThread.class, "dumpStackAndDie", "(Lorg/vmmagic/unboxed/Address;)V");
381
382  public static final RVMField latestContenderField =
383      getField(org.jikesrvm.scheduler.SpinLock.class, "latestContender", org.jikesrvm.scheduler.RVMThread.class);
384
385  public static final RVMField depthField = getField(org.jikesrvm.classloader.RVMType.class, "depth", int.class);
386  public static final RVMField idField = getField(org.jikesrvm.classloader.RVMType.class, "id", int.class);
387  public static final RVMField dimensionField = getField(org.jikesrvm.classloader.RVMType.class, "dimension", int.class);
388
389  public static final RVMField innermostElementTypeDimensionField =
390      getField(org.jikesrvm.classloader.RVMArray.class, "innermostElementTypeDimension", int.class);
391
392  public static final RVMField JNIEnvSavedTRField =
393      getField(org.jikesrvm.jni.JNIEnvironment.class, "savedTRreg", org.jikesrvm.scheduler.RVMThread.class);
394  public static final RVMField JNIEnvBasePointerOnEntryToNative =
395      getField(org.jikesrvm.jni.JNIEnvironment.class, "basePointerOnEntryToNative", org.vmmagic.unboxed.Address.class);
396  public static final RVMField JNIGlobalRefsField =
397    getField(org.jikesrvm.jni.JNIGlobalRefTable.class, "JNIGlobalRefs", org.vmmagic.unboxed.AddressArray.class);
398  public static final RVMField JNIRefsField =
399      getField(org.jikesrvm.jni.JNIEnvironment.class, "JNIRefs", org.vmmagic.unboxed.AddressArray.class);
400  public static final RVMField JNIRefsTopField = getField(org.jikesrvm.jni.JNIEnvironment.class, "JNIRefsTop", int.class);
401  public static final RVMField JNIRefsMaxField = getField(org.jikesrvm.jni.JNIEnvironment.class, "JNIRefsMax", int.class);
402  public static final RVMField JNIRefsSavedFPField =
403      getField(org.jikesrvm.jni.JNIEnvironment.class, "JNIRefsSavedFP", int.class);
404  public static final RVMField JNITopJavaFPField =
405      getField(org.jikesrvm.jni.JNIEnvironment.class, "JNITopJavaFP", org.vmmagic.unboxed.Address.class);
406  public static final RVMField JNIHasPendingExceptionField =
407      getField(org.jikesrvm.jni.JNIEnvironment.class, "hasPendingException", int.class);
408  public static final RVMField JNIExternalFunctionsField =
409      getField(org.jikesrvm.jni.JNIEnvironment.class, "externalJNIFunctions", org.vmmagic.unboxed.Address.class);
410  public static final RVMField JNIEnvSavedJTOCField;
411  public static final RVMMethod jniThrowPendingException;
412  public static final RVMMethod jniEntry;
413  public static final RVMMethod jniExit;
414
415
416  static {
417    if (VM.BuildForPowerPC) {
418      JNIEnvSavedJTOCField =  getField(org.jikesrvm.jni.JNIEnvironment.class,
419                                              "savedJTOC",
420                                              org.vmmagic.unboxed.Address.class);
421      jniThrowPendingException = getMethod(org.jikesrvm.jni.JNIEnvironment.class,
422                                              "throwPendingException",
423                                              "()V");
424      jniEntry = null;
425      jniExit = null;
426    } else {
427      if (VM.VerifyAssertions) VM._assert(VM.BuildForIA32);
428      JNIEnvSavedJTOCField = null;
429      jniThrowPendingException = null;
430      jniEntry = getMethod(org.jikesrvm.jni.JNIEnvironment.class,
431                                            "entryToJNI",
432                                            "(I)V");
433      jniExit = getMethod(org.jikesrvm.jni.JNIEnvironment.class,
434                                            "exitFromJNI",
435                                            "(I)Ljava/lang/Object;");
436    }
437  }
438
439  public static final RVMField the_boot_recordField =
440      getField(org.jikesrvm.runtime.BootRecord.class, "the_boot_record", org.jikesrvm.runtime.BootRecord.class);
441  public static final RVMField externalSignalFlagField =
442      getField(org.jikesrvm.runtime.BootRecord.class, "externalSignalFlag", int.class);
443  public static final RVMField sysLongDivideIPField =
444      getField(org.jikesrvm.runtime.BootRecord.class, "sysLongDivideIP", org.vmmagic.unboxed.Address.class);
445  public static final RVMField sysLongRemainderIPField =
446      getField(org.jikesrvm.runtime.BootRecord.class, "sysLongRemainderIP", org.vmmagic.unboxed.Address.class);
447  public static final RVMField sysLongToFloatIPField =
448      getField(org.jikesrvm.runtime.BootRecord.class, "sysLongToFloatIP", org.vmmagic.unboxed.Address.class);
449  public static final RVMField sysLongToDoubleIPField =
450      getField(org.jikesrvm.runtime.BootRecord.class, "sysLongToDoubleIP", org.vmmagic.unboxed.Address.class);
451  public static final RVMField sysFloatToIntIPField =
452      getField(org.jikesrvm.runtime.BootRecord.class, "sysFloatToIntIP", org.vmmagic.unboxed.Address.class);
453  public static final RVMField sysDoubleToIntIPField =
454      getField(org.jikesrvm.runtime.BootRecord.class, "sysDoubleToIntIP", org.vmmagic.unboxed.Address.class);
455  public static final RVMField sysFloatToLongIPField =
456      getField(org.jikesrvm.runtime.BootRecord.class, "sysFloatToLongIP", org.vmmagic.unboxed.Address.class);
457  public static final RVMField sysDoubleToLongIPField =
458      getField(org.jikesrvm.runtime.BootRecord.class, "sysDoubleToLongIP", org.vmmagic.unboxed.Address.class);
459  public static final RVMField sysDoubleRemainderIPField =
460      getField(org.jikesrvm.runtime.BootRecord.class, "sysDoubleRemainderIP", org.vmmagic.unboxed.Address.class);
461
462  public static final RVMField edgeCountersField =
463      getField(org.jikesrvm.compilers.baseline.EdgeCounts.class, "data", int[][].class);
464
465  public static final RVMField classLoadedCountField =
466      getField(org.jikesrvm.classloader.JMXSupport.class, "classLoadedCount", int.class);
467
468  //////////////////
469  // Entrypoints that are valid only when the opt compiler is included in the build
470  //////////////////
471  public static final RVMField specializedMethodsField;
472
473  public static final NormalMethod optThreadSwitchFromOsrOptMethod;
474  public static final NormalMethod optThreadSwitchFromPrologueMethod;
475  public static final NormalMethod optThreadSwitchFromBackedgeMethod;
476  public static final NormalMethod optThreadSwitchFromEpilogueMethod;
477  public static final NormalMethod yieldpointFromNativePrologueMethod;
478  public static final NormalMethod yieldpointFromNativeEpilogueMethod;
479  public static final NormalMethod optResolveMethod;
480  public static final NormalMethod optNewArrayArrayMethod;
481  public static final NormalMethod optNew2DArrayMethod;
482  public static final NormalMethod sysArrayCopy;
483
484  // Initialize opt-compiler specific fields
485  static {
486    if (VM.BuildForOptCompiler) {
487      specializedMethodsField =
488          getField(org.jikesrvm.compilers.opt.specialization.SpecializedMethodPool.class,
489                   "specializedMethods",
490                   org.jikesrvm.compilers.common.CodeArray[].class);
491      optThreadSwitchFromOsrOptMethod =
492          getMethod(org.jikesrvm.compilers.opt.runtimesupport.OptSaveVolatile.class, "yieldpointFromOsrOpt", "()V");
493      optThreadSwitchFromPrologueMethod =
494          getMethod(org.jikesrvm.compilers.opt.runtimesupport.OptSaveVolatile.class, "yieldpointFromPrologue", "()V");
495      optThreadSwitchFromBackedgeMethod =
496          getMethod(org.jikesrvm.compilers.opt.runtimesupport.OptSaveVolatile.class, "yieldpointFromBackedge", "()V");
497      optThreadSwitchFromEpilogueMethod =
498          getMethod(org.jikesrvm.compilers.opt.runtimesupport.OptSaveVolatile.class, "yieldpointFromEpilogue", "()V");
499      yieldpointFromNativePrologueMethod =
500          getMethod(org.jikesrvm.compilers.opt.runtimesupport.OptSaveVolatile.class, "yieldpointFromNativePrologue", "()V");
501      yieldpointFromNativeEpilogueMethod =
502          getMethod(org.jikesrvm.compilers.opt.runtimesupport.OptSaveVolatile.class, "yieldpointFromNativeEpilogue", "()V");
503      optResolveMethod = getMethod(org.jikesrvm.compilers.opt.runtimesupport.OptSaveVolatile.class, "resolve", "()V");
504
505      optNewArrayArrayMethod =
506          getMethod(org.jikesrvm.compilers.opt.runtimesupport.OptLinker.class, "newArrayArray", "(I[II)Ljava/lang/Object;");
507      optNew2DArrayMethod =
508          getMethod(org.jikesrvm.compilers.opt.runtimesupport.OptLinker.class, "new2DArray", "(IIII)Ljava/lang/Object;");
509      sysArrayCopy = getMethod("Ljava/lang/VMCommonLibrarySupport;", "arraycopy", "(Ljava/lang/Object;ILjava/lang/Object;II)V");
510      sysArrayCopy.setRuntimeServiceMethod(false);
511    } else {
512      specializedMethodsField = null;
513      optThreadSwitchFromOsrOptMethod = null;
514      optThreadSwitchFromPrologueMethod = null;
515      optThreadSwitchFromBackedgeMethod = null;
516      optThreadSwitchFromEpilogueMethod = null;
517      yieldpointFromNativePrologueMethod = null;
518      yieldpointFromNativeEpilogueMethod = null;
519      optResolveMethod = null;
520      optNewArrayArrayMethod = null;
521      optNew2DArrayMethod = null;
522      sysArrayCopy = null;
523    }
524  }
525
526  public static final RVMField classLoaderDefinedPackages =
527    getField(java.lang.ClassLoader.class, "definedPackages", java.util.HashMap.class);
528
529  public static final RVMField luni1;
530  public static final RVMField luni2;
531  public static final RVMField luni3;
532  public static final RVMField luni4;
533  public static final RVMField luni5;
534  public static final RVMField luni6;
535
536  // Initialize Harmony classlibrary specific fields
537  static {
538    if (VM.BuildForHarmony) {
539      luni1 = getField("Lorg/apache/harmony/luni/util/Msg;", "bundle", java.util.ResourceBundle.class);
540      luni2 = getField("Lorg/apache/harmony/archive/internal/nls/Messages;", "bundle", java.util.ResourceBundle.class);
541      luni3 = getField("Lorg/apache/harmony/luni/internal/nls/Messages;", "bundle", java.util.ResourceBundle.class);
542      luni4 = getField("Lorg/apache/harmony/nio/internal/nls/Messages;", "bundle", java.util.ResourceBundle.class);
543      luni5 = getField("Lorg/apache/harmony/niochar/internal/nls/Messages;", "bundle", java.util.ResourceBundle.class);
544      luni6 = getField(java.util.logging.LogManager.class, "manager", java.util.logging.LogManager.class);
545    } else {
546      luni1 = null;
547      luni2 = null;
548      luni3 = null;
549      luni4 = null;
550      luni5 = null;
551      luni6 = null;
552    }
553  }
554}