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.hotspot.word;
024
025import static com.oracle.graal.hotspot.word.HotSpotOperation.HotspotOpcode.*;
026import jdk.internal.jvmci.meta.*;
027
028import com.oracle.graal.nodes.memory.HeapAccess.BarrierType;
029import com.oracle.graal.word.*;
030import com.oracle.graal.word.Word.Opcode;
031import com.oracle.graal.word.Word.Operation;
032
033/**
034 * Marker type for a metaspace pointer.
035 */
036public abstract class MetaspacePointer {
037
038    @HotSpotOperation(opcode = IS_NULL)
039    public abstract boolean isNull();
040
041    @HotSpotOperation(opcode = FROM_POINTER)
042    public abstract Pointer asWord();
043
044    /**
045     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
046     * bytes.
047     * <p>
048     * The offset is always treated as a {@link Signed} value. However, the static type is
049     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
050     * knows that the highest-order bit of the unsigned value is never used).
051     *
052     * @param offset the signed offset for the memory access
053     * @param locationIdentity the identity of the read
054     * @return the result of the memory access
055     */
056    @Operation(opcode = Opcode.READ_POINTER)
057    public abstract byte readByte(WordBase offset, LocationIdentity locationIdentity);
058
059    /**
060     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
061     * bytes.
062     * <p>
063     * The offset is always treated as a {@link Signed} value. However, the static type is
064     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
065     * knows that the highest-order bit of the unsigned value is never used).
066     *
067     * @param offset the signed offset for the memory access
068     * @param locationIdentity the identity of the read
069     * @return the result of the memory access
070     */
071    @Operation(opcode = Opcode.READ_POINTER)
072    public abstract char readChar(WordBase offset, LocationIdentity locationIdentity);
073
074    /**
075     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
076     * bytes.
077     * <p>
078     * The offset is always treated as a {@link Signed} value. However, the static type is
079     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
080     * knows that the highest-order bit of the unsigned value is never used).
081     *
082     * @param offset the signed offset for the memory access
083     * @param locationIdentity the identity of the read
084     * @return the result of the memory access
085     */
086    @Operation(opcode = Opcode.READ_POINTER)
087    public abstract short readShort(WordBase offset, LocationIdentity locationIdentity);
088
089    /**
090     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
091     * bytes.
092     * <p>
093     * The offset is always treated as a {@link Signed} value. However, the static type is
094     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
095     * knows that the highest-order bit of the unsigned value is never used).
096     *
097     * @param offset the signed offset for the memory access
098     * @param locationIdentity the identity of the read
099     * @return the result of the memory access
100     */
101    @Operation(opcode = Opcode.READ_POINTER)
102    public abstract int readInt(WordBase offset, LocationIdentity locationIdentity);
103
104    /**
105     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
106     * bytes.
107     * <p>
108     * The offset is always treated as a {@link Signed} value. However, the static type is
109     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
110     * knows that the highest-order bit of the unsigned value is never used).
111     *
112     * @param offset the signed offset for the memory access
113     * @param locationIdentity the identity of the read
114     * @return the result of the memory access
115     */
116    @Operation(opcode = Opcode.READ_POINTER)
117    public abstract long readLong(WordBase offset, LocationIdentity locationIdentity);
118
119    /**
120     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
121     * bytes.
122     * <p>
123     * The offset is always treated as a {@link Signed} value. However, the static type is
124     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
125     * knows that the highest-order bit of the unsigned value is never used).
126     *
127     * @param offset the signed offset for the memory access
128     * @param locationIdentity the identity of the read
129     * @return the result of the memory access
130     */
131    @Operation(opcode = Opcode.READ_POINTER)
132    public abstract float readFloat(WordBase offset, LocationIdentity locationIdentity);
133
134    /**
135     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
136     * bytes.
137     * <p>
138     * The offset is always treated as a {@link Signed} value. However, the static type is
139     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
140     * knows that the highest-order bit of the unsigned value is never used).
141     *
142     * @param offset the signed offset for the memory access
143     * @param locationIdentity the identity of the read
144     * @return the result of the memory access
145     */
146    @Operation(opcode = Opcode.READ_POINTER)
147    public abstract double readDouble(WordBase offset, LocationIdentity locationIdentity);
148
149    /**
150     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
151     * bytes.
152     * <p>
153     * The offset is always treated as a {@link Signed} value. However, the static type is
154     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
155     * knows that the highest-order bit of the unsigned value is never used).
156     *
157     * @param offset the signed offset for the memory access
158     * @param locationIdentity the identity of the read
159     * @return the result of the memory access
160     */
161    @Operation(opcode = Opcode.READ_POINTER)
162    public abstract Word readWord(WordBase offset, LocationIdentity locationIdentity);
163
164    /**
165     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
166     * bytes.
167     * <p>
168     * The offset is always treated as a {@link Signed} value. However, the static type is
169     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
170     * knows that the highest-order bit of the unsigned value is never used).
171     *
172     * @param offset the signed offset for the memory access
173     * @param locationIdentity the identity of the read
174     * @return the result of the memory access
175     */
176    @Operation(opcode = Opcode.READ_POINTER)
177    public abstract Object readObject(WordBase offset, LocationIdentity locationIdentity);
178
179    /**
180     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
181     * bytes.
182     *
183     * @param offset the signed offset for the memory access
184     * @param locationIdentity the identity of the read
185     * @return the result of the memory access
186     */
187    @Operation(opcode = Opcode.READ_POINTER)
188    public abstract byte readByte(int offset, LocationIdentity locationIdentity);
189
190    /**
191     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
192     * bytes.
193     *
194     * @param offset the signed offset for the memory access
195     * @param locationIdentity the identity of the read
196     * @return the result of the memory access
197     */
198    @Operation(opcode = Opcode.READ_POINTER)
199    public abstract char readChar(int offset, LocationIdentity locationIdentity);
200
201    /**
202     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
203     * bytes.
204     *
205     * @param offset the signed offset for the memory access
206     * @param locationIdentity the identity of the read
207     * @return the result of the memory access
208     */
209    @Operation(opcode = Opcode.READ_POINTER)
210    public abstract short readShort(int offset, LocationIdentity locationIdentity);
211
212    /**
213     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
214     * bytes.
215     *
216     * @param offset the signed offset for the memory access
217     * @param locationIdentity the identity of the read
218     * @return the result of the memory access
219     */
220    @Operation(opcode = Opcode.READ_POINTER)
221    public abstract int readInt(int offset, LocationIdentity locationIdentity);
222
223    /**
224     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
225     * bytes.
226     *
227     * @param offset the signed offset for the memory access
228     * @param locationIdentity the identity of the read
229     * @return the result of the memory access
230     */
231    @Operation(opcode = Opcode.READ_POINTER)
232    public abstract long readLong(int offset, LocationIdentity locationIdentity);
233
234    /**
235     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
236     * bytes.
237     *
238     * @param offset the signed offset for the memory access
239     * @param locationIdentity the identity of the read
240     * @return the result of the memory access
241     */
242    @Operation(opcode = Opcode.READ_POINTER)
243    public abstract float readFloat(int offset, LocationIdentity locationIdentity);
244
245    /**
246     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
247     * bytes.
248     *
249     * @param offset the signed offset for the memory access
250     * @param locationIdentity the identity of the read
251     * @return the result of the memory access
252     */
253    @Operation(opcode = Opcode.READ_POINTER)
254    public abstract double readDouble(int offset, LocationIdentity locationIdentity);
255
256    /**
257     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
258     * bytes.
259     *
260     * @param offset the signed offset for the memory access
261     * @param locationIdentity the identity of the read
262     * @return the result of the memory access
263     */
264    @Operation(opcode = Opcode.READ_POINTER)
265    public abstract Word readWord(int offset, LocationIdentity locationIdentity);
266
267    /**
268     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
269     * bytes.
270     *
271     * @param offset the signed offset for the memory access
272     * @param locationIdentity the identity of the read
273     * @return the result of the memory access
274     */
275    @Operation(opcode = Opcode.READ_POINTER)
276    public abstract Object readObject(int offset, LocationIdentity locationIdentity);
277
278    /**
279     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
280     * bytes.
281     * <p>
282     * The offset is always treated as a {@link Signed} value. However, the static type is
283     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
284     * knows that the highest-order bit of the unsigned value is never used).
285     *
286     * @param offset the signed offset for the memory access
287     * @param locationIdentity the identity of the write
288     * @param val the value to be written to memory
289     */
290    @Operation(opcode = Opcode.WRITE_POINTER)
291    public abstract void writeByte(WordBase offset, byte val, LocationIdentity locationIdentity);
292
293    /**
294     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
295     * bytes.
296     * <p>
297     * The offset is always treated as a {@link Signed} value. However, the static type is
298     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
299     * knows that the highest-order bit of the unsigned value is never used).
300     *
301     * @param offset the signed offset for the memory access
302     * @param locationIdentity the identity of the write
303     * @param val the value to be written to memory
304     */
305    @Operation(opcode = Opcode.WRITE_POINTER)
306    public abstract void writeChar(WordBase offset, char val, LocationIdentity locationIdentity);
307
308    /**
309     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
310     * bytes.
311     * <p>
312     * The offset is always treated as a {@link Signed} value. However, the static type is
313     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
314     * knows that the highest-order bit of the unsigned value is never used).
315     *
316     * @param offset the signed offset for the memory access
317     * @param locationIdentity the identity of the write
318     * @param val the value to be written to memory
319     */
320    @Operation(opcode = Opcode.WRITE_POINTER)
321    public abstract void writeShort(WordBase offset, short val, LocationIdentity locationIdentity);
322
323    /**
324     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
325     * bytes.
326     * <p>
327     * The offset is always treated as a {@link Signed} value. However, the static type is
328     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
329     * knows that the highest-order bit of the unsigned value is never used).
330     *
331     * @param offset the signed offset for the memory access
332     * @param locationIdentity the identity of the write
333     * @param val the value to be written to memory
334     */
335    @Operation(opcode = Opcode.WRITE_POINTER)
336    public abstract void writeInt(WordBase offset, int val, LocationIdentity locationIdentity);
337
338    /**
339     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
340     * bytes.
341     * <p>
342     * The offset is always treated as a {@link Signed} value. However, the static type is
343     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
344     * knows that the highest-order bit of the unsigned value is never used).
345     *
346     * @param offset the signed offset for the memory access
347     * @param locationIdentity the identity of the write
348     * @param val the value to be written to memory
349     */
350    @Operation(opcode = Opcode.WRITE_POINTER)
351    public abstract void writeLong(WordBase offset, long val, LocationIdentity locationIdentity);
352
353    /**
354     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
355     * bytes.
356     * <p>
357     * The offset is always treated as a {@link Signed} value. However, the static type is
358     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
359     * knows that the highest-order bit of the unsigned value is never used).
360     *
361     * @param offset the signed offset for the memory access
362     * @param locationIdentity the identity of the write
363     * @param val the value to be written to memory
364     */
365    @Operation(opcode = Opcode.WRITE_POINTER)
366    public abstract void writeFloat(WordBase offset, float val, LocationIdentity locationIdentity);
367
368    /**
369     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
370     * bytes.
371     * <p>
372     * The offset is always treated as a {@link Signed} value. However, the static type is
373     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
374     * knows that the highest-order bit of the unsigned value is never used).
375     *
376     * @param offset the signed offset for the memory access
377     * @param locationIdentity the identity of the write
378     * @param val the value to be written to memory
379     */
380    @Operation(opcode = Opcode.WRITE_POINTER)
381    public abstract void writeDouble(WordBase offset, double val, LocationIdentity locationIdentity);
382
383    /**
384     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
385     * bytes.
386     * <p>
387     * The offset is always treated as a {@link Signed} value. However, the static type is
388     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
389     * knows that the highest-order bit of the unsigned value is never used).
390     *
391     * @param offset the signed offset for the memory access
392     * @param locationIdentity the identity of the write
393     * @param val the value to be written to memory
394     */
395    @Operation(opcode = Opcode.WRITE_POINTER)
396    public abstract void writeWord(WordBase offset, WordBase val, LocationIdentity locationIdentity);
397
398    /**
399     * Initializes the memory at address {@code (this + offset)}. Both the base address and offset
400     * are in bytes. The memory must be uninitialized or zero prior to this operation.
401     * <p>
402     * The offset is always treated as a {@link Signed} value. However, the static type is
403     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
404     * knows that the highest-order bit of the unsigned value is never used).
405     *
406     * @param offset the signed offset for the memory access
407     * @param locationIdentity the identity of the write
408     * @param val the value to be written to memory
409     */
410    @Operation(opcode = Opcode.INITIALIZE)
411    public abstract void initializeLong(WordBase offset, long val, LocationIdentity locationIdentity);
412
413    /**
414     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
415     * bytes.
416     * <p>
417     * The offset is always treated as a {@link Signed} value. However, the static type is
418     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
419     * knows that the highest-order bit of the unsigned value is never used).
420     *
421     * @param offset the signed offset for the memory access
422     * @param locationIdentity the identity of the write
423     * @param val the value to be written to memory
424     */
425    @Operation(opcode = Opcode.WRITE_POINTER)
426    public abstract void writeObject(WordBase offset, Object val, LocationIdentity locationIdentity);
427
428    /**
429     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
430     * bytes.
431     *
432     * @param offset the signed offset for the memory access
433     * @param locationIdentity the identity of the write
434     * @param val the value to be written to memory
435     */
436    @Operation(opcode = Opcode.WRITE_POINTER)
437    public abstract void writeByte(int offset, byte val, LocationIdentity locationIdentity);
438
439    /**
440     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
441     * bytes.
442     *
443     * @param offset the signed offset for the memory access
444     * @param locationIdentity the identity of the write
445     * @param val the value to be written to memory
446     */
447    @Operation(opcode = Opcode.WRITE_POINTER)
448    public abstract void writeChar(int offset, char val, LocationIdentity locationIdentity);
449
450    /**
451     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
452     * bytes.
453     *
454     * @param offset the signed offset for the memory access
455     * @param locationIdentity the identity of the write
456     * @param val the value to be written to memory
457     */
458    @Operation(opcode = Opcode.WRITE_POINTER)
459    public abstract void writeShort(int offset, short val, LocationIdentity locationIdentity);
460
461    /**
462     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
463     * bytes.
464     *
465     * @param offset the signed offset for the memory access
466     * @param locationIdentity the identity of the write
467     * @param val the value to be written to memory
468     */
469    @Operation(opcode = Opcode.WRITE_POINTER)
470    public abstract void writeInt(int offset, int val, LocationIdentity locationIdentity);
471
472    /**
473     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
474     * bytes.
475     *
476     * @param offset the signed offset for the memory access
477     * @param locationIdentity the identity of the write
478     * @param val the value to be written to memory
479     */
480    @Operation(opcode = Opcode.WRITE_POINTER)
481    public abstract void writeLong(int offset, long val, LocationIdentity locationIdentity);
482
483    /**
484     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
485     * bytes.
486     *
487     * @param offset the signed offset for the memory access
488     * @param locationIdentity the identity of the write
489     * @param val the value to be written to memory
490     */
491    @Operation(opcode = Opcode.WRITE_POINTER)
492    public abstract void writeFloat(int offset, float val, LocationIdentity locationIdentity);
493
494    /**
495     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
496     * bytes.
497     *
498     * @param offset the signed offset for the memory access
499     * @param locationIdentity the identity of the write
500     * @param val the value to be written to memory
501     */
502    @Operation(opcode = Opcode.WRITE_POINTER)
503    public abstract void writeDouble(int offset, double val, LocationIdentity locationIdentity);
504
505    /**
506     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
507     * bytes.
508     *
509     * @param offset the signed offset for the memory access
510     * @param locationIdentity the identity of the write
511     * @param val the value to be written to memory
512     */
513    @Operation(opcode = Opcode.WRITE_POINTER)
514    public abstract void writeWord(int offset, WordBase val, LocationIdentity locationIdentity);
515
516    /**
517     * Initializes the memory at address {@code (this + offset)}. Both the base address and offset
518     * are in bytes. The memory must be uninitialized or zero prior to this operation.
519     *
520     * @param offset the signed offset for the memory access
521     * @param locationIdentity the identity of the write
522     * @param val the value to be written to memory
523     */
524    @Operation(opcode = Opcode.INITIALIZE)
525    public abstract void initializeLong(int offset, long val, LocationIdentity locationIdentity);
526
527    /**
528     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
529     * bytes.
530     *
531     * @param offset the signed offset for the memory access
532     * @param locationIdentity the identity of the write
533     * @param val the value to be written to memory
534     */
535    @Operation(opcode = Opcode.WRITE_POINTER)
536    public abstract void writeObject(int offset, Object val, LocationIdentity locationIdentity);
537
538    /**
539     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
540     * bytes.
541     * <p>
542     * The offset is always treated as a {@link Signed} value. However, the static type is
543     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
544     * knows that the highest-order bit of the unsigned value is never used).
545     *
546     * @param offset the signed offset for the memory access
547     * @return the result of the memory access
548     */
549    @Operation(opcode = Opcode.READ_POINTER)
550    public abstract byte readByte(WordBase offset);
551
552    /**
553     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
554     * bytes.
555     * <p>
556     * The offset is always treated as a {@link Signed} value. However, the static type is
557     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
558     * knows that the highest-order bit of the unsigned value is never used).
559     *
560     * @param offset the signed offset for the memory access
561     * @return the result of the memory access
562     */
563    @Operation(opcode = Opcode.READ_POINTER)
564    public abstract char readChar(WordBase offset);
565
566    /**
567     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
568     * bytes.
569     * <p>
570     * The offset is always treated as a {@link Signed} value. However, the static type is
571     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
572     * knows that the highest-order bit of the unsigned value is never used).
573     *
574     * @param offset the signed offset for the memory access
575     * @return the result of the memory access
576     */
577    @Operation(opcode = Opcode.READ_POINTER)
578    public abstract short readShort(WordBase offset);
579
580    /**
581     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
582     * bytes.
583     * <p>
584     * The offset is always treated as a {@link Signed} value. However, the static type is
585     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
586     * knows that the highest-order bit of the unsigned value is never used).
587     *
588     * @param offset the signed offset for the memory access
589     * @return the result of the memory access
590     */
591    @Operation(opcode = Opcode.READ_POINTER)
592    public abstract int readInt(WordBase offset);
593
594    /**
595     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
596     * bytes.
597     * <p>
598     * The offset is always treated as a {@link Signed} value. However, the static type is
599     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
600     * knows that the highest-order bit of the unsigned value is never used).
601     *
602     * @param offset the signed offset for the memory access
603     * @return the result of the memory access
604     */
605    @Operation(opcode = Opcode.READ_POINTER)
606    public abstract long readLong(WordBase offset);
607
608    /**
609     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
610     * bytes.
611     * <p>
612     * The offset is always treated as a {@link Signed} value. However, the static type is
613     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
614     * knows that the highest-order bit of the unsigned value is never used).
615     *
616     * @param offset the signed offset for the memory access
617     * @return the result of the memory access
618     */
619    @Operation(opcode = Opcode.READ_POINTER)
620    public abstract float readFloat(WordBase offset);
621
622    /**
623     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
624     * bytes.
625     * <p>
626     * The offset is always treated as a {@link Signed} value. However, the static type is
627     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
628     * knows that the highest-order bit of the unsigned value is never used).
629     *
630     * @param offset the signed offset for the memory access
631     * @return the result of the memory access
632     */
633    @Operation(opcode = Opcode.READ_POINTER)
634    public abstract double readDouble(WordBase offset);
635
636    /**
637     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
638     * bytes.
639     * <p>
640     * The offset is always treated as a {@link Signed} value. However, the static type is
641     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
642     * knows that the highest-order bit of the unsigned value is never used).
643     *
644     * @param offset the signed offset for the memory access
645     * @return the result of the memory access
646     */
647    @Operation(opcode = Opcode.READ_POINTER)
648    public abstract Word readWord(WordBase offset);
649
650    /**
651     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
652     * bytes.
653     * <p>
654     * The offset is always treated as a {@link Signed} value. However, the static type is
655     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
656     * knows that the highest-order bit of the unsigned value is never used).
657     *
658     * @param offset the signed offset for the memory access
659     * @return the result of the memory access
660     */
661    @Operation(opcode = Opcode.READ_POINTER)
662    public abstract Object readObject(WordBase offset);
663
664    /**
665     * Reads the memory at address {@code (this + offset)}. This access will decompress the oop if
666     * the VM uses compressed oops, and it can be parameterized to allow read barriers (G1 referent
667     * field).
668     * <p>
669     * The offset is always treated as a {@link Signed} value. However, the static type is
670     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
671     * knows that the highest-order bit of the unsigned value is never used).
672     *
673     * @param offset the signed offset for the memory access
674     * @param barrierType the type of the read barrier to be added
675     * @return the result of the memory access
676     */
677    @Operation(opcode = Opcode.READ_POINTER)
678    public abstract Object readObject(WordBase offset, BarrierType barrierType);
679
680    /**
681     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
682     * bytes.
683     *
684     * @param offset the signed offset for the memory access
685     * @return the result of the memory access
686     */
687    @Operation(opcode = Opcode.READ_POINTER)
688    public abstract byte readByte(int offset);
689
690    /**
691     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
692     * bytes.
693     *
694     * @param offset the signed offset for the memory access
695     * @return the result of the memory access
696     */
697    @Operation(opcode = Opcode.READ_POINTER)
698    public abstract char readChar(int offset);
699
700    /**
701     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
702     * bytes.
703     *
704     * @param offset the signed offset for the memory access
705     * @return the result of the memory access
706     */
707    @Operation(opcode = Opcode.READ_POINTER)
708    public abstract short readShort(int offset);
709
710    /**
711     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
712     * bytes.
713     *
714     * @param offset the signed offset for the memory access
715     * @return the result of the memory access
716     */
717    @Operation(opcode = Opcode.READ_POINTER)
718    public abstract int readInt(int offset);
719
720    /**
721     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
722     * bytes.
723     *
724     * @param offset the signed offset for the memory access
725     * @return the result of the memory access
726     */
727    @Operation(opcode = Opcode.READ_POINTER)
728    public abstract long readLong(int offset);
729
730    /**
731     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
732     * bytes.
733     *
734     * @param offset the signed offset for the memory access
735     * @return the result of the memory access
736     */
737    @Operation(opcode = Opcode.READ_POINTER)
738    public abstract float readFloat(int offset);
739
740    /**
741     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
742     * bytes.
743     *
744     * @param offset the signed offset for the memory access
745     * @return the result of the memory access
746     */
747    @Operation(opcode = Opcode.READ_POINTER)
748    public abstract double readDouble(int offset);
749
750    /**
751     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
752     * bytes.
753     *
754     * @param offset the signed offset for the memory access
755     * @return the result of the memory access
756     */
757    @Operation(opcode = Opcode.READ_POINTER)
758    public abstract Word readWord(int offset);
759
760    /**
761     * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in
762     * bytes.
763     *
764     * @param offset the signed offset for the memory access
765     * @return the result of the memory access
766     */
767    @Operation(opcode = Opcode.READ_POINTER)
768    public abstract Object readObject(int offset);
769
770    /**
771     * Reads the memory at address {@code (this + offset)}. This access will decompress the oop if
772     * the VM uses compressed oops, and it can be parameterized to allow read barriers (G1 referent
773     * field).
774     *
775     * @param offset the signed offset for the memory access
776     * @param barrierType the type of the read barrier to be added
777     * @return the result of the memory access
778     */
779    @Operation(opcode = Opcode.READ_POINTER)
780    public abstract Object readObject(int offset, BarrierType barrierType);
781
782    /**
783     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
784     * bytes.
785     * <p>
786     * The offset is always treated as a {@link Signed} value. However, the static type is
787     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
788     * knows that the highest-order bit of the unsigned value is never used).
789     *
790     * @param offset the signed offset for the memory access
791     * @param val the value to be written to memory
792     */
793    @Operation(opcode = Opcode.WRITE_POINTER)
794    public abstract void writeByte(WordBase offset, byte val);
795
796    /**
797     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
798     * bytes.
799     * <p>
800     * The offset is always treated as a {@link Signed} value. However, the static type is
801     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
802     * knows that the highest-order bit of the unsigned value is never used).
803     *
804     * @param offset the signed offset for the memory access
805     * @param val the value to be written to memory
806     */
807    @Operation(opcode = Opcode.WRITE_POINTER)
808    public abstract void writeChar(WordBase offset, char val);
809
810    /**
811     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
812     * bytes.
813     * <p>
814     * The offset is always treated as a {@link Signed} value. However, the static type is
815     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
816     * knows that the highest-order bit of the unsigned value is never used).
817     *
818     * @param offset the signed offset for the memory access
819     * @param val the value to be written to memory
820     */
821    @Operation(opcode = Opcode.WRITE_POINTER)
822    public abstract void writeShort(WordBase offset, short val);
823
824    /**
825     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
826     * bytes.
827     * <p>
828     * The offset is always treated as a {@link Signed} value. However, the static type is
829     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
830     * knows that the highest-order bit of the unsigned value is never used).
831     *
832     * @param offset the signed offset for the memory access
833     * @param val the value to be written to memory
834     */
835    @Operation(opcode = Opcode.WRITE_POINTER)
836    public abstract void writeInt(WordBase offset, int val);
837
838    /**
839     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
840     * bytes.
841     * <p>
842     * The offset is always treated as a {@link Signed} value. However, the static type is
843     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
844     * knows that the highest-order bit of the unsigned value is never used).
845     *
846     * @param offset the signed offset for the memory access
847     * @param val the value to be written to memory
848     */
849    @Operation(opcode = Opcode.WRITE_POINTER)
850    public abstract void writeLong(WordBase offset, long val);
851
852    /**
853     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
854     * bytes.
855     * <p>
856     * The offset is always treated as a {@link Signed} value. However, the static type is
857     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
858     * knows that the highest-order bit of the unsigned value is never used).
859     *
860     * @param offset the signed offset for the memory access
861     * @param val the value to be written to memory
862     */
863    @Operation(opcode = Opcode.WRITE_POINTER)
864    public abstract void writeFloat(WordBase offset, float val);
865
866    /**
867     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
868     * bytes.
869     * <p>
870     * The offset is always treated as a {@link Signed} value. However, the static type is
871     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
872     * knows that the highest-order bit of the unsigned value is never used).
873     *
874     * @param offset the signed offset for the memory access
875     * @param val the value to be written to memory
876     */
877    @Operation(opcode = Opcode.WRITE_POINTER)
878    public abstract void writeDouble(WordBase offset, double val);
879
880    /**
881     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
882     * bytes.
883     * <p>
884     * The offset is always treated as a {@link Signed} value. However, the static type is
885     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
886     * knows that the highest-order bit of the unsigned value is never used).
887     *
888     * @param offset the signed offset for the memory access
889     * @param val the value to be written to memory
890     */
891    @Operation(opcode = Opcode.WRITE_POINTER)
892    public abstract void writeWord(WordBase offset, WordBase val);
893
894    /**
895     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
896     * bytes.
897     * <p>
898     * The offset is always treated as a {@link Signed} value. However, the static type is
899     * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller
900     * knows that the highest-order bit of the unsigned value is never used).
901     *
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_POINTER)
906    public abstract void writeObject(WordBase offset, Object val);
907
908    /**
909     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
910     * bytes.
911     *
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_POINTER)
916    public abstract void writeByte(int offset, byte val);
917
918    /**
919     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
920     * bytes.
921     *
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_POINTER)
926    public abstract void writeChar(int offset, char val);
927
928    /**
929     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
930     * bytes.
931     *
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_POINTER)
936    public abstract void writeShort(int offset, short val);
937
938    /**
939     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
940     * bytes.
941     *
942     * @param offset the signed offset for the memory access
943     * @param val the value to be written to memory
944     */
945    @Operation(opcode = Opcode.WRITE_POINTER)
946    public abstract void writeInt(int offset, int val);
947
948    /**
949     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
950     * bytes.
951     *
952     * @param offset the signed offset for the memory access
953     * @param val the value to be written to memory
954     */
955    @Operation(opcode = Opcode.WRITE_POINTER)
956    public abstract void writeLong(int offset, long val);
957
958    /**
959     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
960     * bytes.
961     *
962     * @param offset the signed offset for the memory access
963     * @param val the value to be written to memory
964     */
965    @Operation(opcode = Opcode.WRITE_POINTER)
966    public abstract void writeFloat(int offset, float val);
967
968    /**
969     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
970     * bytes.
971     *
972     * @param offset the signed offset for the memory access
973     * @param val the value to be written to memory
974     */
975    @Operation(opcode = Opcode.WRITE_POINTER)
976    public abstract void writeDouble(int offset, double val);
977
978    /**
979     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
980     * bytes.
981     *
982     * @param offset the signed offset for the memory access
983     * @param val the value to be written to memory
984     */
985    @Operation(opcode = Opcode.WRITE_POINTER)
986    public abstract void writeWord(int offset, WordBase val);
987
988    /**
989     * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in
990     * bytes.
991     *
992     * @param offset the signed offset for the memory access
993     * @param val the value to be written to memory
994     */
995    @Operation(opcode = Opcode.WRITE_POINTER)
996    public abstract void writeObject(int offset, Object val);
997}