001/*
002 * Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
003 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
004 *
005 * This code is free software; you can redistribute it and/or modify it
006 * under the terms of the GNU General Public License version 2 only, as
007 * published by the Free Software Foundation.
008 *
009 * This code is distributed in the hope that it will be useful, but WITHOUT
010 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
011 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
012 * version 2 for more details (a copy is included in the LICENSE file that
013 * accompanied this code).
014 *
015 * You should have received a copy of the GNU General Public License version
016 * 2 along with this work; if not, write to the Free Software Foundation,
017 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
018 *
019 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
020 * or visit www.oracle.com if you need additional information or have any
021 * questions.
022 */
023package com.oracle.graal.word;
024
025import jdk.internal.jvmci.meta.*;
026
027import com.oracle.graal.word.Word.Opcode;
028import com.oracle.graal.word.Word.Operation;
029
030/**
031 * Medium-level memory access for Objects. Similarly to the readXxx and writeXxx methods defined for
032 * {@link Pointer} and {@link ObjectAccess}, these methods access the memory without any null
033 * checks. However, these methods use read- or write barriers. When the VM uses compressed pointers,
034 * then readObject and writeObject methods access compressed pointers.
035 */
036public final class BarrieredAccess {
037
038    /**
039     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
040     * <p>
041     * The offset is always treated as a {@link Signed} value. However, the static type is
042     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
043     * knows that the highest-order bit of the unsigned value is never used).
044     *
045     * @param object the base object for the memory access
046     * @param offset the signed offset for the memory access
047     * @param locationIdentity the identity of the read
048     * @return the result of the memory access
049     */
050    @Operation(opcode = Opcode.READ_BARRIERED)
051    public static native byte readByte(Object object, WordBase offset, LocationIdentity locationIdentity);
052
053    /**
054     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
055     * <p>
056     * The offset is always treated as a {@link Signed} value. However, the static type is
057     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
058     * knows that the highest-order bit of the unsigned value is never used).
059     *
060     * @param object the base object for the memory access
061     * @param offset the signed offset for the memory access
062     * @param locationIdentity the identity of the read
063     * @return the result of the memory access
064     */
065    @Operation(opcode = Opcode.READ_BARRIERED)
066    public static native char readChar(Object object, WordBase offset, LocationIdentity locationIdentity);
067
068    /**
069     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
070     * <p>
071     * The offset is always treated as a {@link Signed} value. However, the static type is
072     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
073     * knows that the highest-order bit of the unsigned value is never used).
074     *
075     * @param object the base object for the memory access
076     * @param offset the signed offset for the memory access
077     * @param locationIdentity the identity of the read
078     * @return the result of the memory access
079     */
080    @Operation(opcode = Opcode.READ_BARRIERED)
081    public static native short readShort(Object object, WordBase offset, LocationIdentity locationIdentity);
082
083    /**
084     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
085     * <p>
086     * The offset is always treated as a {@link Signed} value. However, the static type is
087     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
088     * knows that the highest-order bit of the unsigned value is never used).
089     *
090     * @param object the base object for the memory access
091     * @param offset the signed offset for the memory access
092     * @param locationIdentity the identity of the read
093     * @return the result of the memory access
094     */
095    @Operation(opcode = Opcode.READ_BARRIERED)
096    public static native int readInt(Object object, WordBase offset, LocationIdentity locationIdentity);
097
098    /**
099     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
100     * <p>
101     * The offset is always treated as a {@link Signed} value. However, the static type is
102     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
103     * knows that the highest-order bit of the unsigned value is never used).
104     *
105     * @param object the base object for the memory access
106     * @param offset the signed offset for the memory access
107     * @param locationIdentity the identity of the read
108     * @return the result of the memory access
109     */
110    @Operation(opcode = Opcode.READ_BARRIERED)
111    public static native long readLong(Object object, WordBase offset, LocationIdentity locationIdentity);
112
113    /**
114     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
115     * <p>
116     * The offset is always treated as a {@link Signed} value. However, the static type is
117     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
118     * knows that the highest-order bit of the unsigned value is never used).
119     *
120     * @param object the base object for the memory access
121     * @param offset the signed offset for the memory access
122     * @param locationIdentity the identity of the read
123     * @return the result of the memory access
124     */
125    @Operation(opcode = Opcode.READ_BARRIERED)
126    public static native float readFloat(Object object, WordBase offset, LocationIdentity locationIdentity);
127
128    /**
129     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
130     * <p>
131     * The offset is always treated as a {@link Signed} value. However, the static type is
132     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
133     * knows that the highest-order bit of the unsigned value is never used).
134     *
135     * @param object the base object for the memory access
136     * @param offset the signed offset for the memory access
137     * @param locationIdentity the identity of the read
138     * @return the result of the memory access
139     */
140    @Operation(opcode = Opcode.READ_BARRIERED)
141    public static native double readDouble(Object object, WordBase offset, LocationIdentity locationIdentity);
142
143    /**
144     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
145     * <p>
146     * The offset is always treated as a {@link Signed} value. However, the static type is
147     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
148     * knows that the highest-order bit of the unsigned value is never used).
149     *
150     * @param object the base object for the memory access
151     * @param offset the signed offset for the memory access
152     * @param locationIdentity the identity of the read
153     * @return the result of the memory access
154     */
155    @Operation(opcode = Opcode.READ_BARRIERED)
156    public static native Word readWord(Object object, WordBase offset, LocationIdentity locationIdentity);
157
158    /**
159     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
160     * <p>
161     * The offset is always treated as a {@link Signed} value. However, the static type is
162     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
163     * knows that the highest-order bit of the unsigned value is never used).
164     *
165     * @param object the base object for the memory access
166     * @param offset the signed offset for the memory access
167     * @param locationIdentity the identity of the read
168     * @return the result of the memory access
169     */
170    @Operation(opcode = Opcode.READ_BARRIERED)
171    public static native Object readObject(Object object, WordBase offset, LocationIdentity locationIdentity);
172
173    /**
174     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
175     *
176     * @param object the base object for the memory access
177     * @param offset the signed offset for the memory access
178     * @param locationIdentity the identity of the read
179     * @return the result of the memory access
180     */
181    @Operation(opcode = Opcode.READ_BARRIERED)
182    public static native byte readByte(Object object, int offset, LocationIdentity locationIdentity);
183
184    /**
185     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
186     *
187     * @param object the base object for the memory access
188     * @param offset the signed offset for the memory access
189     * @param locationIdentity the identity of the read
190     * @return the result of the memory access
191     */
192    @Operation(opcode = Opcode.READ_BARRIERED)
193    public static native char readChar(Object object, int offset, LocationIdentity locationIdentity);
194
195    /**
196     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
197     *
198     * @param object the base object for the memory access
199     * @param offset the signed offset for the memory access
200     * @param locationIdentity the identity of the read
201     * @return the result of the memory access
202     */
203    @Operation(opcode = Opcode.READ_BARRIERED)
204    public static native short readShort(Object object, int offset, LocationIdentity locationIdentity);
205
206    /**
207     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
208     *
209     * @param object the base object for the memory access
210     * @param offset the signed offset for the memory access
211     * @param locationIdentity the identity of the read
212     * @return the result of the memory access
213     */
214    @Operation(opcode = Opcode.READ_BARRIERED)
215    public static native int readInt(Object object, int offset, LocationIdentity locationIdentity);
216
217    /**
218     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
219     *
220     * @param object the base object for the memory access
221     * @param offset the signed offset for the memory access
222     * @param locationIdentity the identity of the read
223     * @return the result of the memory access
224     */
225    @Operation(opcode = Opcode.READ_BARRIERED)
226    public static native long readLong(Object object, int offset, LocationIdentity locationIdentity);
227
228    /**
229     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
230     *
231     * @param object the base object for the memory access
232     * @param offset the signed offset for the memory access
233     * @param locationIdentity the identity of the read
234     * @return the result of the memory access
235     */
236    @Operation(opcode = Opcode.READ_BARRIERED)
237    public static native float readFloat(Object object, int offset, LocationIdentity locationIdentity);
238
239    /**
240     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
241     *
242     * @param object the base object for the memory access
243     * @param offset the signed offset for the memory access
244     * @param locationIdentity the identity of the read
245     * @return the result of the memory access
246     */
247    @Operation(opcode = Opcode.READ_BARRIERED)
248    public static native double readDouble(Object object, int offset, LocationIdentity locationIdentity);
249
250    /**
251     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
252     *
253     * @param object the base object for the memory access
254     * @param offset the signed offset for the memory access
255     * @param locationIdentity the identity of the read
256     * @return the result of the memory access
257     */
258    @Operation(opcode = Opcode.READ_BARRIERED)
259    public static native Word readWord(Object object, int offset, LocationIdentity locationIdentity);
260
261    /**
262     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
263     *
264     * @param object the base object for the memory access
265     * @param offset the signed offset for the memory access
266     * @param locationIdentity the identity of the read
267     * @return the result of the memory access
268     */
269    @Operation(opcode = Opcode.READ_BARRIERED)
270    public static native Object readObject(Object object, int offset, LocationIdentity locationIdentity);
271
272    /**
273     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
274     * <p>
275     * The offset is always treated as a {@link Signed} value. However, the static type is
276     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
277     * knows that the highest-order bit of the unsigned value is never used).
278     *
279     * @param object the base object for the memory access
280     * @param offset the signed offset for the memory access
281     * @param locationIdentity the identity of the write
282     * @param val the value to be written to memory
283     */
284    @Operation(opcode = Opcode.WRITE_BARRIERED)
285    public static native void writeByte(Object object, WordBase offset, byte val, LocationIdentity locationIdentity);
286
287    /**
288     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
289     * <p>
290     * The offset is always treated as a {@link Signed} value. However, the static type is
291     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
292     * knows that the highest-order bit of the unsigned value is never used).
293     *
294     * @param object the base object for the memory access
295     * @param offset the signed offset for the memory access
296     * @param locationIdentity the identity of the write
297     * @param val the value to be written to memory
298     */
299    @Operation(opcode = Opcode.WRITE_BARRIERED)
300    public static native void writeChar(Object object, WordBase offset, char val, LocationIdentity locationIdentity);
301
302    /**
303     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
304     * <p>
305     * The offset is always treated as a {@link Signed} value. However, the static type is
306     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
307     * knows that the highest-order bit of the unsigned value is never used).
308     *
309     * @param object the base object for the memory access
310     * @param offset the signed offset for the memory access
311     * @param locationIdentity the identity of the write
312     * @param val the value to be written to memory
313     */
314    @Operation(opcode = Opcode.WRITE_BARRIERED)
315    public static native void writeShort(Object object, WordBase offset, short val, LocationIdentity locationIdentity);
316
317    /**
318     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
319     * <p>
320     * The offset is always treated as a {@link Signed} value. However, the static type is
321     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
322     * knows that the highest-order bit of the unsigned value is never used).
323     *
324     * @param object the base object for the memory access
325     * @param offset the signed offset for the memory access
326     * @param locationIdentity the identity of the write
327     * @param val the value to be written to memory
328     */
329    @Operation(opcode = Opcode.WRITE_BARRIERED)
330    public static native void writeInt(Object object, WordBase offset, int val, LocationIdentity locationIdentity);
331
332    /**
333     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
334     * <p>
335     * The offset is always treated as a {@link Signed} value. However, the static type is
336     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
337     * knows that the highest-order bit of the unsigned value is never used).
338     *
339     * @param object the base object for the memory access
340     * @param offset the signed offset for the memory access
341     * @param locationIdentity the identity of the write
342     * @param val the value to be written to memory
343     */
344    @Operation(opcode = Opcode.WRITE_BARRIERED)
345    public static native void writeLong(Object object, WordBase offset, long val, LocationIdentity locationIdentity);
346
347    /**
348     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
349     * <p>
350     * The offset is always treated as a {@link Signed} value. However, the static type is
351     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
352     * knows that the highest-order bit of the unsigned value is never used).
353     *
354     * @param object the base object for the memory access
355     * @param offset the signed offset for the memory access
356     * @param locationIdentity the identity of the write
357     * @param val the value to be written to memory
358     */
359    @Operation(opcode = Opcode.WRITE_BARRIERED)
360    public static native void writeFloat(Object object, WordBase offset, float val, LocationIdentity locationIdentity);
361
362    /**
363     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
364     * <p>
365     * The offset is always treated as a {@link Signed} value. However, the static type is
366     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
367     * knows that the highest-order bit of the unsigned value is never used).
368     *
369     * @param object the base object for the memory access
370     * @param offset the signed offset for the memory access
371     * @param locationIdentity the identity of the write
372     * @param val the value to be written to memory
373     */
374    @Operation(opcode = Opcode.WRITE_BARRIERED)
375    public static native void writeDouble(Object object, WordBase offset, double val, LocationIdentity locationIdentity);
376
377    /**
378     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
379     * <p>
380     * The offset is always treated as a {@link Signed} value. However, the static type is
381     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
382     * knows that the highest-order bit of the unsigned value is never used).
383     *
384     * @param object the base object for the memory access
385     * @param offset the signed offset for the memory access
386     * @param locationIdentity the identity of the write
387     * @param val the value to be written to memory
388     */
389    @Operation(opcode = Opcode.WRITE_BARRIERED)
390    public static native void writeWord(Object object, WordBase offset, WordBase val, LocationIdentity locationIdentity);
391
392    /**
393     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
394     * <p>
395     * The offset is always treated as a {@link Signed} value. However, the static type is
396     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
397     * knows that the highest-order bit of the unsigned value is never used).
398     *
399     * @param object the base object for the memory access
400     * @param offset the signed offset for the memory access
401     * @param locationIdentity the identity of the write
402     * @param val the value to be written to memory
403     */
404    @Operation(opcode = Opcode.WRITE_BARRIERED)
405    public static native void writeObject(Object object, WordBase offset, Object val, LocationIdentity locationIdentity);
406
407    /**
408     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
409     *
410     * @param object the base object for the memory access
411     * @param offset the signed offset for the memory access
412     * @param locationIdentity the identity of the write
413     * @param val the value to be written to memory
414     */
415    @Operation(opcode = Opcode.WRITE_BARRIERED)
416    public static native void writeByte(Object object, int offset, byte val, LocationIdentity locationIdentity);
417
418    /**
419     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
420     *
421     * @param object the base object for the memory access
422     * @param offset the signed offset for the memory access
423     * @param locationIdentity the identity of the write
424     * @param val the value to be written to memory
425     */
426    @Operation(opcode = Opcode.WRITE_BARRIERED)
427    public static native void writeChar(Object object, int offset, char val, LocationIdentity locationIdentity);
428
429    /**
430     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
431     *
432     * @param object the base object for the memory access
433     * @param offset the signed offset for the memory access
434     * @param locationIdentity the identity of the write
435     * @param val the value to be written to memory
436     */
437    @Operation(opcode = Opcode.WRITE_BARRIERED)
438    public static native void writeShort(Object object, int offset, short val, LocationIdentity locationIdentity);
439
440    /**
441     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
442     *
443     * @param object the base object for the memory access
444     * @param offset the signed offset for the memory access
445     * @param locationIdentity the identity of the write
446     * @param val the value to be written to memory
447     */
448    @Operation(opcode = Opcode.WRITE_BARRIERED)
449    public static native void writeInt(Object object, int offset, int val, LocationIdentity locationIdentity);
450
451    /**
452     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
453     *
454     * @param object the base object for the memory access
455     * @param offset the signed offset for the memory access
456     * @param locationIdentity the identity of the write
457     * @param val the value to be written to memory
458     */
459    @Operation(opcode = Opcode.WRITE_BARRIERED)
460    public static native void writeLong(Object object, int offset, long val, LocationIdentity locationIdentity);
461
462    /**
463     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
464     *
465     * @param object the base object for the memory access
466     * @param offset the signed offset for the memory access
467     * @param locationIdentity the identity of the write
468     * @param val the value to be written to memory
469     */
470    @Operation(opcode = Opcode.WRITE_BARRIERED)
471    public static native void writeFloat(Object object, int offset, float val, LocationIdentity locationIdentity);
472
473    /**
474     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
475     *
476     * @param object the base object for the memory access
477     * @param offset the signed offset for the memory access
478     * @param locationIdentity the identity of the write
479     * @param val the value to be written to memory
480     */
481    @Operation(opcode = Opcode.WRITE_BARRIERED)
482    public static native void writeDouble(Object object, int offset, double val, LocationIdentity locationIdentity);
483
484    /**
485     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
486     *
487     * @param object the base object for the memory access
488     * @param offset the signed offset for the memory access
489     * @param locationIdentity the identity of the write
490     * @param val the value to be written to memory
491     */
492    @Operation(opcode = Opcode.WRITE_BARRIERED)
493    public static native void writeWord(Object object, int offset, WordBase val, LocationIdentity locationIdentity);
494
495    /**
496     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
497     *
498     * @param object the base object for the memory access
499     * @param offset the signed offset for the memory access
500     * @param locationIdentity the identity of the write
501     * @param val the value to be written to memory
502     */
503    @Operation(opcode = Opcode.WRITE_BARRIERED)
504    public static native void writeObject(Object object, int offset, Object val, LocationIdentity locationIdentity);
505
506    /**
507     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
508     * <p>
509     * The offset is always treated as a {@link Signed} value. However, the static type is
510     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
511     * knows that the highest-order bit of the unsigned value is never used).
512     *
513     * @param object the base object for the memory access
514     * @param offset the signed offset for the memory access
515     * @return the result of the memory access
516     */
517    @Operation(opcode = Opcode.READ_BARRIERED)
518    public static native byte readByte(Object object, WordBase offset);
519
520    /**
521     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
522     * <p>
523     * The offset is always treated as a {@link Signed} value. However, the static type is
524     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
525     * knows that the highest-order bit of the unsigned value is never used).
526     *
527     * @param object the base object for the memory access
528     * @param offset the signed offset for the memory access
529     * @return the result of the memory access
530     */
531    @Operation(opcode = Opcode.READ_BARRIERED)
532    public static native char readChar(Object object, WordBase offset);
533
534    /**
535     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
536     * <p>
537     * The offset is always treated as a {@link Signed} value. However, the static type is
538     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
539     * knows that the highest-order bit of the unsigned value is never used).
540     *
541     * @param object the base object for the memory access
542     * @param offset the signed offset for the memory access
543     * @return the result of the memory access
544     */
545    @Operation(opcode = Opcode.READ_BARRIERED)
546    public static native short readShort(Object object, WordBase offset);
547
548    /**
549     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
550     * <p>
551     * The offset is always treated as a {@link Signed} value. However, the static type is
552     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
553     * knows that the highest-order bit of the unsigned value is never used).
554     *
555     * @param object the base object for the memory access
556     * @param offset the signed offset for the memory access
557     * @return the result of the memory access
558     */
559    @Operation(opcode = Opcode.READ_BARRIERED)
560    public static native int readInt(Object object, WordBase offset);
561
562    /**
563     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
564     * <p>
565     * The offset is always treated as a {@link Signed} value. However, the static type is
566     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
567     * knows that the highest-order bit of the unsigned value is never used).
568     *
569     * @param object the base object for the memory access
570     * @param offset the signed offset for the memory access
571     * @return the result of the memory access
572     */
573    @Operation(opcode = Opcode.READ_BARRIERED)
574    public static native long readLong(Object object, WordBase offset);
575
576    /**
577     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
578     * <p>
579     * The offset is always treated as a {@link Signed} value. However, the static type is
580     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
581     * knows that the highest-order bit of the unsigned value is never used).
582     *
583     * @param object the base object for the memory access
584     * @param offset the signed offset for the memory access
585     * @return the result of the memory access
586     */
587    @Operation(opcode = Opcode.READ_BARRIERED)
588    public static native float readFloat(Object object, WordBase offset);
589
590    /**
591     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
592     * <p>
593     * The offset is always treated as a {@link Signed} value. However, the static type is
594     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
595     * knows that the highest-order bit of the unsigned value is never used).
596     *
597     * @param object the base object for the memory access
598     * @param offset the signed offset for the memory access
599     * @return the result of the memory access
600     */
601    @Operation(opcode = Opcode.READ_BARRIERED)
602    public static native double readDouble(Object object, WordBase offset);
603
604    /**
605     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
606     * <p>
607     * The offset is always treated as a {@link Signed} value. However, the static type is
608     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
609     * knows that the highest-order bit of the unsigned value is never used).
610     *
611     * @param object the base object for the memory access
612     * @param offset the signed offset for the memory access
613     * @return the result of the memory access
614     */
615    @Operation(opcode = Opcode.READ_BARRIERED)
616    public static native Word readWord(Object object, WordBase offset);
617
618    /**
619     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
620     * <p>
621     * The offset is always treated as a {@link Signed} value. However, the static type is
622     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
623     * knows that the highest-order bit of the unsigned value is never used).
624     *
625     * @param object the base object for the memory access
626     * @param offset the signed offset for the memory access
627     * @return the result of the memory access
628     */
629    @Operation(opcode = Opcode.READ_BARRIERED)
630    public static native Object readObject(Object object, WordBase offset);
631
632    /**
633     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
634     *
635     * @param object the base object for the memory access
636     * @param offset the signed offset for the memory access
637     * @return the result of the memory access
638     */
639    @Operation(opcode = Opcode.READ_BARRIERED)
640    public static native byte readByte(Object object, int offset);
641
642    /**
643     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
644     *
645     * @param object the base object for the memory access
646     * @param offset the signed offset for the memory access
647     * @return the result of the memory access
648     */
649    @Operation(opcode = Opcode.READ_BARRIERED)
650    public static native char readChar(Object object, int offset);
651
652    /**
653     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
654     *
655     * @param object the base object for the memory access
656     * @param offset the signed offset for the memory access
657     * @return the result of the memory access
658     */
659    @Operation(opcode = Opcode.READ_BARRIERED)
660    public static native short readShort(Object object, int offset);
661
662    /**
663     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
664     *
665     * @param object the base object for the memory access
666     * @param offset the signed offset for the memory access
667     * @return the result of the memory access
668     */
669    @Operation(opcode = Opcode.READ_BARRIERED)
670    public static native int readInt(Object object, int offset);
671
672    /**
673     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
674     *
675     * @param object the base object for the memory access
676     * @param offset the signed offset for the memory access
677     * @return the result of the memory access
678     */
679    @Operation(opcode = Opcode.READ_BARRIERED)
680    public static native long readLong(Object object, int offset);
681
682    /**
683     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
684     *
685     * @param object the base object for the memory access
686     * @param offset the signed offset for the memory access
687     * @return the result of the memory access
688     */
689    @Operation(opcode = Opcode.READ_BARRIERED)
690    public static native float readFloat(Object object, int offset);
691
692    /**
693     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
694     *
695     * @param object the base object for the memory access
696     * @param offset the signed offset for the memory access
697     * @return the result of the memory access
698     */
699    @Operation(opcode = Opcode.READ_BARRIERED)
700    public static native double readDouble(Object object, int offset);
701
702    /**
703     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
704     *
705     * @param object the base object for the memory access
706     * @param offset the signed offset for the memory access
707     * @return the result of the memory access
708     */
709    @Operation(opcode = Opcode.READ_BARRIERED)
710    public static native Word readWord(Object object, int offset);
711
712    /**
713     * Reads the memory at address {@code (object + offset)}. The offset is in bytes.
714     *
715     * @param object the base object for the memory access
716     * @param offset the signed offset for the memory access
717     * @return the result of the memory access
718     */
719    @Operation(opcode = Opcode.READ_BARRIERED)
720    public static native Object readObject(Object object, int offset);
721
722    /**
723     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
724     * <p>
725     * The offset is always treated as a {@link Signed} value. However, the static type is
726     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
727     * knows that the highest-order bit of the unsigned value is never used).
728     *
729     * @param object the base object for the memory access
730     * @param offset the signed offset for the memory access
731     * @param val the value to be written to memory
732     */
733    @Operation(opcode = Opcode.WRITE_BARRIERED)
734    public static native void writeByte(Object object, WordBase offset, byte val);
735
736    /**
737     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
738     * <p>
739     * The offset is always treated as a {@link Signed} value. However, the static type is
740     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
741     * knows that the highest-order bit of the unsigned value is never used).
742     *
743     * @param object the base object for the memory access
744     * @param offset the signed offset for the memory access
745     * @param val the value to be written to memory
746     */
747    @Operation(opcode = Opcode.WRITE_BARRIERED)
748    public static native void writeChar(Object object, WordBase offset, char val);
749
750    /**
751     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
752     * <p>
753     * The offset is always treated as a {@link Signed} value. However, the static type is
754     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
755     * knows that the highest-order bit of the unsigned value is never used).
756     *
757     * @param object the base object for the memory access
758     * @param offset the signed offset for the memory access
759     * @param val the value to be written to memory
760     */
761    @Operation(opcode = Opcode.WRITE_BARRIERED)
762    public static native void writeShort(Object object, WordBase offset, short val);
763
764    /**
765     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
766     * <p>
767     * The offset is always treated as a {@link Signed} value. However, the static type is
768     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
769     * knows that the highest-order bit of the unsigned value is never used).
770     *
771     * @param object the base object for the memory access
772     * @param offset the signed offset for the memory access
773     * @param val the value to be written to memory
774     */
775    @Operation(opcode = Opcode.WRITE_BARRIERED)
776    public static native void writeInt(Object object, WordBase offset, int val);
777
778    /**
779     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
780     * <p>
781     * The offset is always treated as a {@link Signed} value. However, the static type is
782     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
783     * knows that the highest-order bit of the unsigned value is never used).
784     *
785     * @param object the base object for the memory access
786     * @param offset the signed offset for the memory access
787     * @param val the value to be written to memory
788     */
789    @Operation(opcode = Opcode.WRITE_BARRIERED)
790    public static native void writeLong(Object object, WordBase offset, long val);
791
792    /**
793     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
794     * <p>
795     * The offset is always treated as a {@link Signed} value. However, the static type is
796     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
797     * knows that the highest-order bit of the unsigned value is never used).
798     *
799     * @param object the base object for the memory access
800     * @param offset the signed offset for the memory access
801     * @param val the value to be written to memory
802     */
803    @Operation(opcode = Opcode.WRITE_BARRIERED)
804    public static native void writeFloat(Object object, WordBase offset, float val);
805
806    /**
807     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
808     * <p>
809     * The offset is always treated as a {@link Signed} value. However, the static type is
810     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
811     * knows that the highest-order bit of the unsigned value is never used).
812     *
813     * @param object the base object for the memory access
814     * @param offset the signed offset for the memory access
815     * @param val the value to be written to memory
816     */
817    @Operation(opcode = Opcode.WRITE_BARRIERED)
818    public static native void writeDouble(Object object, WordBase offset, double val);
819
820    /**
821     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
822     * <p>
823     * The offset is always treated as a {@link Signed} value. However, the static type is
824     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
825     * knows that the highest-order bit of the unsigned value is never used).
826     *
827     * @param object the base object for the memory access
828     * @param offset the signed offset for the memory access
829     * @param val the value to be written to memory
830     */
831    @Operation(opcode = Opcode.WRITE_BARRIERED)
832    public static native void writeWord(Object object, WordBase offset, WordBase val);
833
834    /**
835     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
836     * <p>
837     * The offset is always treated as a {@link Signed} value. However, the static type is
838     * {@link WordBase} to avoid the frequent casts of {@link Unsigned} values (where the caller
839     * knows that the highest-order bit of the unsigned value is never used).
840     *
841     * @param object the base object for the memory access
842     * @param offset the signed offset for the memory access
843     * @param val the value to be written to memory
844     */
845    @Operation(opcode = Opcode.WRITE_BARRIERED)
846    public static native void writeObject(Object object, WordBase offset, Object val);
847
848    /**
849     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
850     *
851     * @param object the base object for the memory access
852     * @param offset the signed offset for the memory access
853     * @param val the value to be written to memory
854     */
855    @Operation(opcode = Opcode.WRITE_BARRIERED)
856    public static native void writeByte(Object object, int offset, byte val);
857
858    /**
859     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
860     *
861     * @param object the base object for the memory access
862     * @param offset the signed offset for the memory access
863     * @param val the value to be written to memory
864     */
865    @Operation(opcode = Opcode.WRITE_BARRIERED)
866    public static native void writeChar(Object object, int offset, char val);
867
868    /**
869     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
870     *
871     * @param object the base object for the memory access
872     * @param offset the signed offset for the memory access
873     * @param val the value to be written to memory
874     */
875    @Operation(opcode = Opcode.WRITE_BARRIERED)
876    public static native void writeShort(Object object, int offset, short val);
877
878    /**
879     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
880     *
881     * @param object the base object for the memory access
882     * @param offset the signed offset for the memory access
883     * @param val the value to be written to memory
884     */
885    @Operation(opcode = Opcode.WRITE_BARRIERED)
886    public static native void writeInt(Object object, int offset, int val);
887
888    /**
889     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
890     *
891     * @param object the base object for the memory access
892     * @param offset the signed offset for the memory access
893     * @param val the value to be written to memory
894     */
895    @Operation(opcode = Opcode.WRITE_BARRIERED)
896    public static native void writeLong(Object object, int offset, long val);
897
898    /**
899     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
900     *
901     * @param object the base object for the memory access
902     * @param offset the signed offset for the memory access
903     * @param val the value to be written to memory
904     */
905    @Operation(opcode = Opcode.WRITE_BARRIERED)
906    public static native void writeFloat(Object object, int offset, float val);
907
908    /**
909     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
910     *
911     * @param object the base object for the memory access
912     * @param offset the signed offset for the memory access
913     * @param val the value to be written to memory
914     */
915    @Operation(opcode = Opcode.WRITE_BARRIERED)
916    public static native void writeDouble(Object object, int offset, double val);
917
918    /**
919     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
920     *
921     * @param object the base object for the memory access
922     * @param offset the signed offset for the memory access
923     * @param val the value to be written to memory
924     */
925    @Operation(opcode = Opcode.WRITE_BARRIERED)
926    public static native void writeWord(Object object, int offset, WordBase val);
927
928    /**
929     * Writes the memory at address {@code (object + offset)}. The offset is in bytes.
930     *
931     * @param object the base object for the memory access
932     * @param offset the signed offset for the memory access
933     * @param val the value to be written to memory
934     */
935    @Operation(opcode = Opcode.WRITE_BARRIERED)
936    public static native void writeObject(Object object, int offset, Object val);
937}