1 /* 2 * Copyright (c) 2014, 2016, Oracle and/or its affiliates. All rights reserved. 3 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. 4 * 5 * This code is free software; you can redistribute it and/or modify it 6 * under the terms of the GNU General Public License version 2 only, as 7 * published by the Free Software Foundation. 8 * 9 * This code is distributed in the hope that it will be useful, but WITHOUT 10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or 11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License 12 * version 2 for more details (a copy is included in the LICENSE file that 13 * accompanied this code). 14 * 15 * You should have received a copy of the GNU General Public License version 16 * 2 along with this work; if not, write to the Free Software Foundation, 17 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. 18 * 19 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA 20 * or visit www.oracle.com if you need additional information or have any 21 * questions. 22 */ 23 package org.graalvm.compiler.hotspot.word; 24 25 import static org.graalvm.compiler.hotspot.word.HotSpotOperation.HotspotOpcode.FROM_POINTER; 26 import static org.graalvm.compiler.hotspot.word.HotSpotOperation.HotspotOpcode.IS_NULL; 27 28 import org.graalvm.compiler.core.common.LocationIdentity; 29 import org.graalvm.compiler.nodes.memory.HeapAccess.BarrierType; 30 import org.graalvm.compiler.word.Pointer; 31 import org.graalvm.compiler.word.Signed; 32 import org.graalvm.compiler.word.Unsigned; 33 import org.graalvm.compiler.word.Word; 34 import org.graalvm.compiler.word.Word.Opcode; 35 import org.graalvm.compiler.word.Word.Operation; 36 import org.graalvm.compiler.word.WordBase; 37 38 /** 39 * Marker type for a metaspace pointer. 40 */ 41 public abstract class MetaspacePointer { 42 43 @HotSpotOperation(opcode = IS_NULL) 44 public abstract boolean isNull(); 45 46 @HotSpotOperation(opcode = FROM_POINTER) 47 public abstract Pointer asWord(); 48 49 /** 50 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 51 * bytes. 52 * <p> 53 * The offset is always treated as a {@link Signed} value. However, the static type is 54 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 55 * knows that the highest-order bit of the unsigned value is never used). 56 * 57 * @param offset the signed offset for the memory access 58 * @param locationIdentity the identity of the read 59 * @return the result of the memory access 60 */ 61 @Operation(opcode = Opcode.READ_POINTER) 62 public abstract byte readByte(WordBase offset, LocationIdentity locationIdentity); 63 64 /** 65 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 66 * bytes. 67 * <p> 68 * The offset is always treated as a {@link Signed} value. However, the static type is 69 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 70 * knows that the highest-order bit of the unsigned value is never used). 71 * 72 * @param offset the signed offset for the memory access 73 * @param locationIdentity the identity of the read 74 * @return the result of the memory access 75 */ 76 @Operation(opcode = Opcode.READ_POINTER) 77 public abstract char readChar(WordBase offset, LocationIdentity locationIdentity); 78 79 /** 80 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 81 * bytes. 82 * <p> 83 * The offset is always treated as a {@link Signed} value. However, the static type is 84 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 85 * knows that the highest-order bit of the unsigned value is never used). 86 * 87 * @param offset the signed offset for the memory access 88 * @param locationIdentity the identity of the read 89 * @return the result of the memory access 90 */ 91 @Operation(opcode = Opcode.READ_POINTER) 92 public abstract short readShort(WordBase offset, LocationIdentity locationIdentity); 93 94 /** 95 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 96 * bytes. 97 * <p> 98 * The offset is always treated as a {@link Signed} value. However, the static type is 99 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 100 * knows that the highest-order bit of the unsigned value is never used). 101 * 102 * @param offset the signed offset for the memory access 103 * @param locationIdentity the identity of the read 104 * @return the result of the memory access 105 */ 106 @Operation(opcode = Opcode.READ_POINTER) 107 public abstract int readInt(WordBase offset, LocationIdentity locationIdentity); 108 109 /** 110 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 111 * bytes. 112 * <p> 113 * The offset is always treated as a {@link Signed} value. However, the static type is 114 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 115 * knows that the highest-order bit of the unsigned value is never used). 116 * 117 * @param offset the signed offset for the memory access 118 * @param locationIdentity the identity of the read 119 * @return the result of the memory access 120 */ 121 @Operation(opcode = Opcode.READ_POINTER) 122 public abstract long readLong(WordBase offset, LocationIdentity locationIdentity); 123 124 /** 125 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 126 * bytes. 127 * <p> 128 * The offset is always treated as a {@link Signed} value. However, the static type is 129 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 130 * knows that the highest-order bit of the unsigned value is never used). 131 * 132 * @param offset the signed offset for the memory access 133 * @param locationIdentity the identity of the read 134 * @return the result of the memory access 135 */ 136 @Operation(opcode = Opcode.READ_POINTER) 137 public abstract float readFloat(WordBase offset, LocationIdentity locationIdentity); 138 139 /** 140 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 141 * bytes. 142 * <p> 143 * The offset is always treated as a {@link Signed} value. However, the static type is 144 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 145 * knows that the highest-order bit of the unsigned value is never used). 146 * 147 * @param offset the signed offset for the memory access 148 * @param locationIdentity the identity of the read 149 * @return the result of the memory access 150 */ 151 @Operation(opcode = Opcode.READ_POINTER) 152 public abstract double readDouble(WordBase offset, LocationIdentity locationIdentity); 153 154 /** 155 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 156 * bytes. 157 * <p> 158 * The offset is always treated as a {@link Signed} value. However, the static type is 159 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 160 * knows that the highest-order bit of the unsigned value is never used). 161 * 162 * @param offset the signed offset for the memory access 163 * @param locationIdentity the identity of the read 164 * @return the result of the memory access 165 */ 166 @Operation(opcode = Opcode.READ_POINTER) 167 public abstract Word readWord(WordBase offset, LocationIdentity locationIdentity); 168 169 /** 170 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 171 * bytes. 172 * <p> 173 * The offset is always treated as a {@link Signed} value. However, the static type is 174 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 175 * knows that the highest-order bit of the unsigned value is never used). 176 * 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_POINTER) 182 public abstract Object readObject(WordBase offset, LocationIdentity locationIdentity); 183 184 /** 185 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 186 * bytes. 187 * 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_POINTER) 193 public abstract byte readByte(int offset, LocationIdentity locationIdentity); 194 195 /** 196 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 197 * bytes. 198 * 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_POINTER) 204 public abstract char readChar(int offset, LocationIdentity locationIdentity); 205 206 /** 207 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 208 * bytes. 209 * 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_POINTER) 215 public abstract short readShort(int offset, LocationIdentity locationIdentity); 216 217 /** 218 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 219 * bytes. 220 * 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_POINTER) 226 public abstract int readInt(int offset, LocationIdentity locationIdentity); 227 228 /** 229 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 230 * bytes. 231 * 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_POINTER) 237 public abstract long readLong(int offset, LocationIdentity locationIdentity); 238 239 /** 240 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 241 * bytes. 242 * 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_POINTER) 248 public abstract float readFloat(int offset, LocationIdentity locationIdentity); 249 250 /** 251 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 252 * bytes. 253 * 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_POINTER) 259 public abstract double readDouble(int offset, LocationIdentity locationIdentity); 260 261 /** 262 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 263 * bytes. 264 * 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_POINTER) 270 public abstract Word readWord(int offset, LocationIdentity locationIdentity); 271 272 /** 273 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 274 * bytes. 275 * 276 * @param offset the signed offset for the memory access 277 * @param locationIdentity the identity of the read 278 * @return the result of the memory access 279 */ 280 @Operation(opcode = Opcode.READ_POINTER) 281 public abstract Object readObject(int offset, LocationIdentity locationIdentity); 282 283 /** 284 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 285 * bytes. 286 * <p> 287 * The offset is always treated as a {@link Signed} value. However, the static type is 288 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 289 * knows that the highest-order bit of the unsigned value is never used). 290 * 291 * @param offset the signed offset for the memory access 292 * @param locationIdentity the identity of the write 293 * @param val the value to be written to memory 294 */ 295 @Operation(opcode = Opcode.WRITE_POINTER) 296 public abstract void writeByte(WordBase offset, byte val, LocationIdentity locationIdentity); 297 298 /** 299 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 300 * bytes. 301 * <p> 302 * The offset is always treated as a {@link Signed} value. However, the static type is 303 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 304 * knows that the highest-order bit of the unsigned value is never used). 305 * 306 * @param offset the signed offset for the memory access 307 * @param locationIdentity the identity of the write 308 * @param val the value to be written to memory 309 */ 310 @Operation(opcode = Opcode.WRITE_POINTER) 311 public abstract void writeChar(WordBase offset, char val, LocationIdentity locationIdentity); 312 313 /** 314 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 315 * bytes. 316 * <p> 317 * The offset is always treated as a {@link Signed} value. However, the static type is 318 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 319 * knows that the highest-order bit of the unsigned value is never used). 320 * 321 * @param offset the signed offset for the memory access 322 * @param locationIdentity the identity of the write 323 * @param val the value to be written to memory 324 */ 325 @Operation(opcode = Opcode.WRITE_POINTER) 326 public abstract void writeShort(WordBase offset, short val, LocationIdentity locationIdentity); 327 328 /** 329 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 330 * bytes. 331 * <p> 332 * The offset is always treated as a {@link Signed} value. However, the static type is 333 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 334 * knows that the highest-order bit of the unsigned value is never used). 335 * 336 * @param offset the signed offset for the memory access 337 * @param locationIdentity the identity of the write 338 * @param val the value to be written to memory 339 */ 340 @Operation(opcode = Opcode.WRITE_POINTER) 341 public abstract void writeInt(WordBase offset, int val, LocationIdentity locationIdentity); 342 343 /** 344 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 345 * bytes. 346 * <p> 347 * The offset is always treated as a {@link Signed} value. However, the static type is 348 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 349 * knows that the highest-order bit of the unsigned value is never used). 350 * 351 * @param offset the signed offset for the memory access 352 * @param locationIdentity the identity of the write 353 * @param val the value to be written to memory 354 */ 355 @Operation(opcode = Opcode.WRITE_POINTER) 356 public abstract void writeLong(WordBase offset, long val, LocationIdentity locationIdentity); 357 358 /** 359 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 360 * bytes. 361 * <p> 362 * The offset is always treated as a {@link Signed} value. However, the static type is 363 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 364 * knows that the highest-order bit of the unsigned value is never used). 365 * 366 * @param offset the signed offset for the memory access 367 * @param locationIdentity the identity of the write 368 * @param val the value to be written to memory 369 */ 370 @Operation(opcode = Opcode.WRITE_POINTER) 371 public abstract void writeFloat(WordBase offset, float val, LocationIdentity locationIdentity); 372 373 /** 374 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 375 * bytes. 376 * <p> 377 * The offset is always treated as a {@link Signed} value. However, the static type is 378 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 379 * knows that the highest-order bit of the unsigned value is never used). 380 * 381 * @param offset the signed offset for the memory access 382 * @param locationIdentity the identity of the write 383 * @param val the value to be written to memory 384 */ 385 @Operation(opcode = Opcode.WRITE_POINTER) 386 public abstract void writeDouble(WordBase offset, double val, LocationIdentity locationIdentity); 387 388 /** 389 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 390 * bytes. 391 * <p> 392 * The offset is always treated as a {@link Signed} value. However, the static type is 393 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 394 * knows that the highest-order bit of the unsigned value is never used). 395 * 396 * @param offset the signed offset for the memory access 397 * @param locationIdentity the identity of the write 398 * @param val the value to be written to memory 399 */ 400 @Operation(opcode = Opcode.WRITE_POINTER) 401 public abstract void writeWord(WordBase offset, WordBase val, LocationIdentity locationIdentity); 402 403 /** 404 * Initializes the memory at address {@code (this + offset)}. Both the base address and offset 405 * are in bytes. The memory must be uninitialized or zero prior to this operation. 406 * <p> 407 * The offset is always treated as a {@link Signed} value. However, the static type is 408 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 409 * knows that the highest-order bit of the unsigned value is never used). 410 * 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.INITIALIZE) 416 public abstract void initializeLong(WordBase offset, long val, LocationIdentity locationIdentity); 417 418 /** 419 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 420 * bytes. 421 * <p> 422 * The offset is always treated as a {@link Signed} value. However, the static type is 423 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 424 * knows that the highest-order bit of the unsigned value is never used). 425 * 426 * @param offset the signed offset for the memory access 427 * @param locationIdentity the identity of the write 428 * @param val the value to be written to memory 429 */ 430 @Operation(opcode = Opcode.WRITE_POINTER) 431 public abstract void writeObject(WordBase offset, Object val, LocationIdentity locationIdentity); 432 433 /** 434 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 435 * bytes. 436 * 437 * @param offset the signed offset for the memory access 438 * @param locationIdentity the identity of the write 439 * @param val the value to be written to memory 440 */ 441 @Operation(opcode = Opcode.WRITE_POINTER) 442 public abstract void writeByte(int offset, byte val, LocationIdentity locationIdentity); 443 444 /** 445 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 446 * bytes. 447 * 448 * @param offset the signed offset for the memory access 449 * @param locationIdentity the identity of the write 450 * @param val the value to be written to memory 451 */ 452 @Operation(opcode = Opcode.WRITE_POINTER) 453 public abstract void writeChar(int offset, char val, LocationIdentity locationIdentity); 454 455 /** 456 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 457 * bytes. 458 * 459 * @param offset the signed offset for the memory access 460 * @param locationIdentity the identity of the write 461 * @param val the value to be written to memory 462 */ 463 @Operation(opcode = Opcode.WRITE_POINTER) 464 public abstract void writeShort(int offset, short val, LocationIdentity locationIdentity); 465 466 /** 467 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 468 * bytes. 469 * 470 * @param offset the signed offset for the memory access 471 * @param locationIdentity the identity of the write 472 * @param val the value to be written to memory 473 */ 474 @Operation(opcode = Opcode.WRITE_POINTER) 475 public abstract void writeInt(int offset, int val, LocationIdentity locationIdentity); 476 477 /** 478 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 479 * bytes. 480 * 481 * @param offset the signed offset for the memory access 482 * @param locationIdentity the identity of the write 483 * @param val the value to be written to memory 484 */ 485 @Operation(opcode = Opcode.WRITE_POINTER) 486 public abstract void writeLong(int offset, long val, LocationIdentity locationIdentity); 487 488 /** 489 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 490 * bytes. 491 * 492 * @param offset the signed offset for the memory access 493 * @param locationIdentity the identity of the write 494 * @param val the value to be written to memory 495 */ 496 @Operation(opcode = Opcode.WRITE_POINTER) 497 public abstract void writeFloat(int offset, float val, LocationIdentity locationIdentity); 498 499 /** 500 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 501 * bytes. 502 * 503 * @param offset the signed offset for the memory access 504 * @param locationIdentity the identity of the write 505 * @param val the value to be written to memory 506 */ 507 @Operation(opcode = Opcode.WRITE_POINTER) 508 public abstract void writeDouble(int offset, double val, LocationIdentity locationIdentity); 509 510 /** 511 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 512 * bytes. 513 * 514 * @param offset the signed offset for the memory access 515 * @param locationIdentity the identity of the write 516 * @param val the value to be written to memory 517 */ 518 @Operation(opcode = Opcode.WRITE_POINTER) 519 public abstract void writeWord(int offset, WordBase val, LocationIdentity locationIdentity); 520 521 /** 522 * Initializes the memory at address {@code (this + offset)}. Both the base address and offset 523 * are in bytes. The memory must be uninitialized or zero prior to this operation. 524 * 525 * @param offset the signed offset for the memory access 526 * @param locationIdentity the identity of the write 527 * @param val the value to be written to memory 528 */ 529 @Operation(opcode = Opcode.INITIALIZE) 530 public abstract void initializeLong(int offset, long val, LocationIdentity locationIdentity); 531 532 /** 533 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 534 * bytes. 535 * 536 * @param offset the signed offset for the memory access 537 * @param locationIdentity the identity of the write 538 * @param val the value to be written to memory 539 */ 540 @Operation(opcode = Opcode.WRITE_POINTER) 541 public abstract void writeObject(int offset, Object val, LocationIdentity locationIdentity); 542 543 /** 544 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 545 * bytes. 546 * <p> 547 * The offset is always treated as a {@link Signed} value. However, the static type is 548 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 549 * knows that the highest-order bit of the unsigned value is never used). 550 * 551 * @param offset the signed offset for the memory access 552 * @return the result of the memory access 553 */ 554 @Operation(opcode = Opcode.READ_POINTER) 555 public abstract byte readByte(WordBase offset); 556 557 /** 558 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 559 * bytes. 560 * <p> 561 * The offset is always treated as a {@link Signed} value. However, the static type is 562 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 563 * knows that the highest-order bit of the unsigned value is never used). 564 * 565 * @param offset the signed offset for the memory access 566 * @return the result of the memory access 567 */ 568 @Operation(opcode = Opcode.READ_POINTER) 569 public abstract char readChar(WordBase offset); 570 571 /** 572 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 573 * bytes. 574 * <p> 575 * The offset is always treated as a {@link Signed} value. However, the static type is 576 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 577 * knows that the highest-order bit of the unsigned value is never used). 578 * 579 * @param offset the signed offset for the memory access 580 * @return the result of the memory access 581 */ 582 @Operation(opcode = Opcode.READ_POINTER) 583 public abstract short readShort(WordBase offset); 584 585 /** 586 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 587 * bytes. 588 * <p> 589 * The offset is always treated as a {@link Signed} value. However, the static type is 590 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 591 * knows that the highest-order bit of the unsigned value is never used). 592 * 593 * @param offset the signed offset for the memory access 594 * @return the result of the memory access 595 */ 596 @Operation(opcode = Opcode.READ_POINTER) 597 public abstract int readInt(WordBase offset); 598 599 /** 600 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 601 * bytes. 602 * <p> 603 * The offset is always treated as a {@link Signed} value. However, the static type is 604 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 605 * knows that the highest-order bit of the unsigned value is never used). 606 * 607 * @param offset the signed offset for the memory access 608 * @return the result of the memory access 609 */ 610 @Operation(opcode = Opcode.READ_POINTER) 611 public abstract long readLong(WordBase offset); 612 613 /** 614 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 615 * bytes. 616 * <p> 617 * The offset is always treated as a {@link Signed} value. However, the static type is 618 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 619 * knows that the highest-order bit of the unsigned value is never used). 620 * 621 * @param offset the signed offset for the memory access 622 * @return the result of the memory access 623 */ 624 @Operation(opcode = Opcode.READ_POINTER) 625 public abstract float readFloat(WordBase offset); 626 627 /** 628 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 629 * bytes. 630 * <p> 631 * The offset is always treated as a {@link Signed} value. However, the static type is 632 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 633 * knows that the highest-order bit of the unsigned value is never used). 634 * 635 * @param offset the signed offset for the memory access 636 * @return the result of the memory access 637 */ 638 @Operation(opcode = Opcode.READ_POINTER) 639 public abstract double readDouble(WordBase offset); 640 641 /** 642 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 643 * bytes. 644 * <p> 645 * The offset is always treated as a {@link Signed} value. However, the static type is 646 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 647 * knows that the highest-order bit of the unsigned value is never used). 648 * 649 * @param offset the signed offset for the memory access 650 * @return the result of the memory access 651 */ 652 @Operation(opcode = Opcode.READ_POINTER) 653 public abstract Word readWord(WordBase offset); 654 655 /** 656 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 657 * bytes. 658 * <p> 659 * The offset is always treated as a {@link Signed} value. However, the static type is 660 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 661 * knows that the highest-order bit of the unsigned value is never used). 662 * 663 * @param offset the signed offset for the memory access 664 * @return the result of the memory access 665 */ 666 @Operation(opcode = Opcode.READ_POINTER) 667 public abstract Object readObject(WordBase offset); 668 669 /** 670 * Reads the memory at address {@code (this + offset)}. This access will decompress the oop if 671 * the VM uses compressed oops, and it can be parameterized to allow read barriers (G1 referent 672 * field). 673 * <p> 674 * The offset is always treated as a {@link Signed} value. However, the static type is 675 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 676 * knows that the highest-order bit of the unsigned value is never used). 677 * 678 * @param offset the signed offset for the memory access 679 * @param barrierType the type of the read barrier to be added 680 * @return the result of the memory access 681 */ 682 @Operation(opcode = Opcode.READ_POINTER) 683 public abstract Object readObject(WordBase offset, BarrierType barrierType); 684 685 /** 686 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 687 * bytes. 688 * 689 * @param offset the signed offset for the memory access 690 * @return the result of the memory access 691 */ 692 @Operation(opcode = Opcode.READ_POINTER) 693 public abstract byte readByte(int offset); 694 695 /** 696 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 697 * bytes. 698 * 699 * @param offset the signed offset for the memory access 700 * @return the result of the memory access 701 */ 702 @Operation(opcode = Opcode.READ_POINTER) 703 public abstract char readChar(int offset); 704 705 /** 706 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 707 * bytes. 708 * 709 * @param offset the signed offset for the memory access 710 * @return the result of the memory access 711 */ 712 @Operation(opcode = Opcode.READ_POINTER) 713 public abstract short readShort(int offset); 714 715 /** 716 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 717 * bytes. 718 * 719 * @param offset the signed offset for the memory access 720 * @return the result of the memory access 721 */ 722 @Operation(opcode = Opcode.READ_POINTER) 723 public abstract int readInt(int offset); 724 725 /** 726 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 727 * bytes. 728 * 729 * @param offset the signed offset for the memory access 730 * @return the result of the memory access 731 */ 732 @Operation(opcode = Opcode.READ_POINTER) 733 public abstract long readLong(int offset); 734 735 /** 736 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 737 * bytes. 738 * 739 * @param offset the signed offset for the memory access 740 * @return the result of the memory access 741 */ 742 @Operation(opcode = Opcode.READ_POINTER) 743 public abstract float readFloat(int offset); 744 745 /** 746 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 747 * bytes. 748 * 749 * @param offset the signed offset for the memory access 750 * @return the result of the memory access 751 */ 752 @Operation(opcode = Opcode.READ_POINTER) 753 public abstract double readDouble(int offset); 754 755 /** 756 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 757 * bytes. 758 * 759 * @param offset the signed offset for the memory access 760 * @return the result of the memory access 761 */ 762 @Operation(opcode = Opcode.READ_POINTER) 763 public abstract Word readWord(int offset); 764 765 /** 766 * Reads the memory at address {@code (this + offset)}. Both the base address and offset are in 767 * bytes. 768 * 769 * @param offset the signed offset for the memory access 770 * @return the result of the memory access 771 */ 772 @Operation(opcode = Opcode.READ_POINTER) 773 public abstract Object readObject(int offset); 774 775 /** 776 * Reads the memory at address {@code (this + offset)}. This access will decompress the oop if 777 * the VM uses compressed oops, and it can be parameterized to allow read barriers (G1 referent 778 * field). 779 * 780 * @param offset the signed offset for the memory access 781 * @param barrierType the type of the read barrier to be added 782 * @return the result of the memory access 783 */ 784 @Operation(opcode = Opcode.READ_POINTER) 785 public abstract Object readObject(int offset, BarrierType barrierType); 786 787 /** 788 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 789 * bytes. 790 * <p> 791 * The offset is always treated as a {@link Signed} value. However, the static type is 792 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 793 * knows that the highest-order bit of the unsigned value is never used). 794 * 795 * @param offset the signed offset for the memory access 796 * @param val the value to be written to memory 797 */ 798 @Operation(opcode = Opcode.WRITE_POINTER) 799 public abstract void writeByte(WordBase offset, byte val); 800 801 /** 802 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 803 * bytes. 804 * <p> 805 * The offset is always treated as a {@link Signed} value. However, the static type is 806 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 807 * knows that the highest-order bit of the unsigned value is never used). 808 * 809 * @param offset the signed offset for the memory access 810 * @param val the value to be written to memory 811 */ 812 @Operation(opcode = Opcode.WRITE_POINTER) 813 public abstract void writeChar(WordBase offset, char val); 814 815 /** 816 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 817 * bytes. 818 * <p> 819 * The offset is always treated as a {@link Signed} value. However, the static type is 820 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 821 * knows that the highest-order bit of the unsigned value is never used). 822 * 823 * @param offset the signed offset for the memory access 824 * @param val the value to be written to memory 825 */ 826 @Operation(opcode = Opcode.WRITE_POINTER) 827 public abstract void writeShort(WordBase offset, short val); 828 829 /** 830 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 831 * bytes. 832 * <p> 833 * The offset is always treated as a {@link Signed} value. However, the static type is 834 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 835 * knows that the highest-order bit of the unsigned value is never used). 836 * 837 * @param offset the signed offset for the memory access 838 * @param val the value to be written to memory 839 */ 840 @Operation(opcode = Opcode.WRITE_POINTER) 841 public abstract void writeInt(WordBase offset, int val); 842 843 /** 844 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 845 * bytes. 846 * <p> 847 * The offset is always treated as a {@link Signed} value. However, the static type is 848 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 849 * knows that the highest-order bit of the unsigned value is never used). 850 * 851 * @param offset the signed offset for the memory access 852 * @param val the value to be written to memory 853 */ 854 @Operation(opcode = Opcode.WRITE_POINTER) 855 public abstract void writeLong(WordBase offset, long val); 856 857 /** 858 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 859 * bytes. 860 * <p> 861 * The offset is always treated as a {@link Signed} value. However, the static type is 862 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 863 * knows that the highest-order bit of the unsigned value is never used). 864 * 865 * @param offset the signed offset for the memory access 866 * @param val the value to be written to memory 867 */ 868 @Operation(opcode = Opcode.WRITE_POINTER) 869 public abstract void writeFloat(WordBase offset, float val); 870 871 /** 872 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 873 * bytes. 874 * <p> 875 * The offset is always treated as a {@link Signed} value. However, the static type is 876 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 877 * knows that the highest-order bit of the unsigned value is never used). 878 * 879 * @param offset the signed offset for the memory access 880 * @param val the value to be written to memory 881 */ 882 @Operation(opcode = Opcode.WRITE_POINTER) 883 public abstract void writeDouble(WordBase offset, double val); 884 885 /** 886 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 887 * bytes. 888 * <p> 889 * The offset is always treated as a {@link Signed} value. However, the static type is 890 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 891 * knows that the highest-order bit of the unsigned value is never used). 892 * 893 * @param offset the signed offset for the memory access 894 * @param val the value to be written to memory 895 */ 896 @Operation(opcode = Opcode.WRITE_POINTER) 897 public abstract void writeWord(WordBase offset, WordBase val); 898 899 /** 900 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 901 * bytes. 902 * <p> 903 * The offset is always treated as a {@link Signed} value. However, the static type is 904 * {@link WordBase} to avoid the frequent casts to of {@link Unsigned} values (where the caller 905 * knows that the highest-order bit of the unsigned value is never used). 906 * 907 * @param offset the signed offset for the memory access 908 * @param val the value to be written to memory 909 */ 910 @Operation(opcode = Opcode.WRITE_POINTER) 911 public abstract void writeObject(WordBase offset, Object val); 912 913 /** 914 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 915 * bytes. 916 * 917 * @param offset the signed offset for the memory access 918 * @param val the value to be written to memory 919 */ 920 @Operation(opcode = Opcode.WRITE_POINTER) 921 public abstract void writeByte(int offset, byte val); 922 923 /** 924 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 925 * bytes. 926 * 927 * @param offset the signed offset for the memory access 928 * @param val the value to be written to memory 929 */ 930 @Operation(opcode = Opcode.WRITE_POINTER) 931 public abstract void writeChar(int offset, char val); 932 933 /** 934 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 935 * bytes. 936 * 937 * @param offset the signed offset for the memory access 938 * @param val the value to be written to memory 939 */ 940 @Operation(opcode = Opcode.WRITE_POINTER) 941 public abstract void writeShort(int offset, short val); 942 943 /** 944 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 945 * bytes. 946 * 947 * @param offset the signed offset for the memory access 948 * @param val the value to be written to memory 949 */ 950 @Operation(opcode = Opcode.WRITE_POINTER) 951 public abstract void writeInt(int offset, int val); 952 953 /** 954 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 955 * bytes. 956 * 957 * @param offset the signed offset for the memory access 958 * @param val the value to be written to memory 959 */ 960 @Operation(opcode = Opcode.WRITE_POINTER) 961 public abstract void writeLong(int offset, long val); 962 963 /** 964 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 965 * bytes. 966 * 967 * @param offset the signed offset for the memory access 968 * @param val the value to be written to memory 969 */ 970 @Operation(opcode = Opcode.WRITE_POINTER) 971 public abstract void writeFloat(int offset, float val); 972 973 /** 974 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 975 * bytes. 976 * 977 * @param offset the signed offset for the memory access 978 * @param val the value to be written to memory 979 */ 980 @Operation(opcode = Opcode.WRITE_POINTER) 981 public abstract void writeDouble(int offset, double val); 982 983 /** 984 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 985 * bytes. 986 * 987 * @param offset the signed offset for the memory access 988 * @param val the value to be written to memory 989 */ 990 @Operation(opcode = Opcode.WRITE_POINTER) 991 public abstract void writeWord(int offset, WordBase val); 992 993 /** 994 * Writes the memory at address {@code (this + offset)}. Both the base address and offset are in 995 * bytes. 996 * 997 * @param offset the signed offset for the memory access 998 * @param val the value to be written to memory 999 */ 1000 @Operation(opcode = Opcode.WRITE_POINTER) 1001 public abstract void writeObject(int offset, Object val); 1002 }