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 */ 23package org.graalvm.compiler.word; 24 25import org.graalvm.compiler.word.Word.Opcode; 26import org.graalvm.compiler.word.Word.Operation; 27import org.graalvm.word.LocationIdentity; 28import org.graalvm.word.Pointer; 29import org.graalvm.word.SignedWord; 30import org.graalvm.word.UnsignedWord; 31import org.graalvm.word.WordBase; 32 33/** 34 * Medium-level memory access for Objects. Similarly to the readXxx and writeXxx methods defined for 35 * {@link Pointer} and {@link ObjectAccess}, these methods access the memory without any null 36 * checks. However, these methods use read- or write barriers. When the VM uses compressed pointers, 37 * then readObject and writeObject methods access compressed pointers. 38 */ 39public final class BarrieredAccess { 40 41 /** 42 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 43 * <p> 44 * The offset is always treated as a {@link SignedWord} value. However, the static type is 45 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 46 * knows that the highest-order bit of the unsigned value is never used). 47 * 48 * @param object the base object for the memory access 49 * @param offset the signed offset for the memory access 50 * @param locationIdentity the identity of the read 51 * @return the result of the memory access 52 */ 53 @Operation(opcode = Opcode.READ_BARRIERED) 54 public static native byte readByte(Object object, WordBase offset, LocationIdentity locationIdentity); 55 56 /** 57 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 58 * <p> 59 * The offset is always treated as a {@link SignedWord} value. However, the static type is 60 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 61 * knows that the highest-order bit of the unsigned value is never used). 62 * 63 * @param object the base object for the memory access 64 * @param offset the signed offset for the memory access 65 * @param locationIdentity the identity of the read 66 * @return the result of the memory access 67 */ 68 @Operation(opcode = Opcode.READ_BARRIERED) 69 public static native char readChar(Object object, WordBase offset, LocationIdentity locationIdentity); 70 71 /** 72 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 73 * <p> 74 * The offset is always treated as a {@link SignedWord} value. However, the static type is 75 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 76 * knows that the highest-order bit of the unsigned value is never used). 77 * 78 * @param object the base object for the memory access 79 * @param offset the signed offset for the memory access 80 * @param locationIdentity the identity of the read 81 * @return the result of the memory access 82 */ 83 @Operation(opcode = Opcode.READ_BARRIERED) 84 public static native short readShort(Object object, WordBase offset, LocationIdentity locationIdentity); 85 86 /** 87 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 88 * <p> 89 * The offset is always treated as a {@link SignedWord} value. However, the static type is 90 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 91 * knows that the highest-order bit of the unsigned value is never used). 92 * 93 * @param object the base object for the memory access 94 * @param offset the signed offset for the memory access 95 * @param locationIdentity the identity of the read 96 * @return the result of the memory access 97 */ 98 @Operation(opcode = Opcode.READ_BARRIERED) 99 public static native int readInt(Object object, WordBase offset, LocationIdentity locationIdentity); 100 101 /** 102 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 103 * <p> 104 * The offset is always treated as a {@link SignedWord} value. However, the static type is 105 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 106 * knows that the highest-order bit of the unsigned value is never used). 107 * 108 * @param object the base object for the memory access 109 * @param offset the signed offset for the memory access 110 * @param locationIdentity the identity of the read 111 * @return the result of the memory access 112 */ 113 @Operation(opcode = Opcode.READ_BARRIERED) 114 public static native long readLong(Object object, WordBase offset, LocationIdentity locationIdentity); 115 116 /** 117 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 118 * <p> 119 * The offset is always treated as a {@link SignedWord} value. However, the static type is 120 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 121 * knows that the highest-order bit of the unsigned value is never used). 122 * 123 * @param object the base object for the memory access 124 * @param offset the signed offset for the memory access 125 * @param locationIdentity the identity of the read 126 * @return the result of the memory access 127 */ 128 @Operation(opcode = Opcode.READ_BARRIERED) 129 public static native float readFloat(Object object, WordBase offset, LocationIdentity locationIdentity); 130 131 /** 132 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 133 * <p> 134 * The offset is always treated as a {@link SignedWord} value. However, the static type is 135 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 136 * knows that the highest-order bit of the unsigned value is never used). 137 * 138 * @param object the base object for the memory access 139 * @param offset the signed offset for the memory access 140 * @param locationIdentity the identity of the read 141 * @return the result of the memory access 142 */ 143 @Operation(opcode = Opcode.READ_BARRIERED) 144 public static native double readDouble(Object object, WordBase offset, LocationIdentity locationIdentity); 145 146 /** 147 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 148 * <p> 149 * The offset is always treated as a {@link SignedWord} value. However, the static type is 150 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 151 * knows that the highest-order bit of the unsigned value is never used). 152 * 153 * @param object the base object for the memory access 154 * @param offset the signed offset for the memory access 155 * @param locationIdentity the identity of the read 156 * @return the result of the memory access 157 */ 158 @Operation(opcode = Opcode.READ_BARRIERED) 159 public static native <T extends WordBase> T readWord(Object object, WordBase offset, LocationIdentity locationIdentity); 160 161 /** 162 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 163 * <p> 164 * The offset is always treated as a {@link SignedWord} value. However, the static type is 165 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 166 * knows that the highest-order bit of the unsigned value is never used). 167 * 168 * @param object the base object for the memory access 169 * @param offset the signed offset for the memory access 170 * @param locationIdentity the identity of the read 171 * @return the result of the memory access 172 */ 173 @Operation(opcode = Opcode.READ_BARRIERED) 174 public static native Object readObject(Object object, WordBase offset, LocationIdentity locationIdentity); 175 176 /** 177 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 178 * 179 * @param object the base object for the memory access 180 * @param offset the signed offset for the memory access 181 * @param locationIdentity the identity of the read 182 * @return the result of the memory access 183 */ 184 @Operation(opcode = Opcode.READ_BARRIERED) 185 public static native byte readByte(Object object, int offset, LocationIdentity locationIdentity); 186 187 /** 188 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 189 * 190 * @param object the base object for the memory access 191 * @param offset the signed offset for the memory access 192 * @param locationIdentity the identity of the read 193 * @return the result of the memory access 194 */ 195 @Operation(opcode = Opcode.READ_BARRIERED) 196 public static native char readChar(Object object, int offset, LocationIdentity locationIdentity); 197 198 /** 199 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 200 * 201 * @param object the base object for the memory access 202 * @param offset the signed offset for the memory access 203 * @param locationIdentity the identity of the read 204 * @return the result of the memory access 205 */ 206 @Operation(opcode = Opcode.READ_BARRIERED) 207 public static native short readShort(Object object, int offset, LocationIdentity locationIdentity); 208 209 /** 210 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 211 * 212 * @param object the base object for the memory access 213 * @param offset the signed offset for the memory access 214 * @param locationIdentity the identity of the read 215 * @return the result of the memory access 216 */ 217 @Operation(opcode = Opcode.READ_BARRIERED) 218 public static native int readInt(Object object, int offset, LocationIdentity locationIdentity); 219 220 /** 221 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 222 * 223 * @param object the base object for the memory access 224 * @param offset the signed offset for the memory access 225 * @param locationIdentity the identity of the read 226 * @return the result of the memory access 227 */ 228 @Operation(opcode = Opcode.READ_BARRIERED) 229 public static native long readLong(Object object, int offset, LocationIdentity locationIdentity); 230 231 /** 232 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 233 * 234 * @param object the base object for the memory access 235 * @param offset the signed offset for the memory access 236 * @param locationIdentity the identity of the read 237 * @return the result of the memory access 238 */ 239 @Operation(opcode = Opcode.READ_BARRIERED) 240 public static native float readFloat(Object object, int offset, LocationIdentity locationIdentity); 241 242 /** 243 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 244 * 245 * @param object the base object for the memory access 246 * @param offset the signed offset for the memory access 247 * @param locationIdentity the identity of the read 248 * @return the result of the memory access 249 */ 250 @Operation(opcode = Opcode.READ_BARRIERED) 251 public static native double readDouble(Object object, int offset, LocationIdentity locationIdentity); 252 253 /** 254 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 255 * 256 * @param object the base object for the memory access 257 * @param offset the signed offset for the memory access 258 * @param locationIdentity the identity of the read 259 * @return the result of the memory access 260 */ 261 @Operation(opcode = Opcode.READ_BARRIERED) 262 public static native <T extends WordBase> T readWord(Object object, int offset, LocationIdentity locationIdentity); 263 264 /** 265 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 266 * 267 * @param object the base object for the memory access 268 * @param offset the signed offset for the memory access 269 * @param locationIdentity the identity of the read 270 * @return the result of the memory access 271 */ 272 @Operation(opcode = Opcode.READ_BARRIERED) 273 public static native Object readObject(Object object, int offset, LocationIdentity locationIdentity); 274 275 /** 276 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 277 * <p> 278 * The offset is always treated as a {@link SignedWord} value. However, the static type is 279 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 280 * knows that the highest-order bit of the unsigned value is never used). 281 * 282 * @param object the base object for the memory access 283 * @param offset the signed offset for the memory access 284 * @param locationIdentity the identity of the write 285 * @param val the value to be written to memory 286 */ 287 @Operation(opcode = Opcode.WRITE_BARRIERED) 288 public static native void writeByte(Object object, WordBase offset, byte val, LocationIdentity locationIdentity); 289 290 /** 291 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 292 * <p> 293 * The offset is always treated as a {@link SignedWord} value. However, the static type is 294 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 295 * knows that the highest-order bit of the unsigned value is never used). 296 * 297 * @param object the base object for the memory access 298 * @param offset the signed offset for the memory access 299 * @param locationIdentity the identity of the write 300 * @param val the value to be written to memory 301 */ 302 @Operation(opcode = Opcode.WRITE_BARRIERED) 303 public static native void writeChar(Object object, WordBase offset, char val, LocationIdentity locationIdentity); 304 305 /** 306 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 307 * <p> 308 * The offset is always treated as a {@link SignedWord} value. However, the static type is 309 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 310 * knows that the highest-order bit of the unsigned value is never used). 311 * 312 * @param object the base object for the memory access 313 * @param offset the signed offset for the memory access 314 * @param locationIdentity the identity of the write 315 * @param val the value to be written to memory 316 */ 317 @Operation(opcode = Opcode.WRITE_BARRIERED) 318 public static native void writeShort(Object object, WordBase offset, short val, LocationIdentity locationIdentity); 319 320 /** 321 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 322 * <p> 323 * The offset is always treated as a {@link SignedWord} value. However, the static type is 324 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 325 * knows that the highest-order bit of the unsigned value is never used). 326 * 327 * @param object the base object for the memory access 328 * @param offset the signed offset for the memory access 329 * @param locationIdentity the identity of the write 330 * @param val the value to be written to memory 331 */ 332 @Operation(opcode = Opcode.WRITE_BARRIERED) 333 public static native void writeInt(Object object, WordBase offset, int val, LocationIdentity locationIdentity); 334 335 /** 336 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 337 * <p> 338 * The offset is always treated as a {@link SignedWord} value. However, the static type is 339 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 340 * knows that the highest-order bit of the unsigned value is never used). 341 * 342 * @param object the base object for the memory access 343 * @param offset the signed offset for the memory access 344 * @param locationIdentity the identity of the write 345 * @param val the value to be written to memory 346 */ 347 @Operation(opcode = Opcode.WRITE_BARRIERED) 348 public static native void writeLong(Object object, WordBase offset, long val, LocationIdentity locationIdentity); 349 350 /** 351 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 352 * <p> 353 * The offset is always treated as a {@link SignedWord} value. However, the static type is 354 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 355 * knows that the highest-order bit of the unsigned value is never used). 356 * 357 * @param object the base object for the memory access 358 * @param offset the signed offset for the memory access 359 * @param locationIdentity the identity of the write 360 * @param val the value to be written to memory 361 */ 362 @Operation(opcode = Opcode.WRITE_BARRIERED) 363 public static native void writeFloat(Object object, WordBase offset, float val, LocationIdentity locationIdentity); 364 365 /** 366 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 367 * <p> 368 * The offset is always treated as a {@link SignedWord} value. However, the static type is 369 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 370 * knows that the highest-order bit of the unsigned value is never used). 371 * 372 * @param object the base object for the memory access 373 * @param offset the signed offset for the memory access 374 * @param locationIdentity the identity of the write 375 * @param val the value to be written to memory 376 */ 377 @Operation(opcode = Opcode.WRITE_BARRIERED) 378 public static native void writeDouble(Object object, WordBase offset, double val, LocationIdentity locationIdentity); 379 380 /** 381 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 382 * <p> 383 * The offset is always treated as a {@link SignedWord} value. However, the static type is 384 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 385 * knows that the highest-order bit of the unsigned value is never used). 386 * 387 * @param object the base object for the memory access 388 * @param offset the signed offset for the memory access 389 * @param locationIdentity the identity of the write 390 * @param val the value to be written to memory 391 */ 392 @Operation(opcode = Opcode.WRITE_BARRIERED) 393 public static native void writeWord(Object object, WordBase offset, WordBase val, LocationIdentity locationIdentity); 394 395 /** 396 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 397 * <p> 398 * The offset is always treated as a {@link SignedWord} value. However, the static type is 399 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 400 * knows that the highest-order bit of the unsigned value is never used). 401 * 402 * @param object the base object for the memory access 403 * @param offset the signed offset for the memory access 404 * @param locationIdentity the identity of the write 405 * @param val the value to be written to memory 406 */ 407 @Operation(opcode = Opcode.WRITE_BARRIERED) 408 public static native void writeObject(Object object, WordBase offset, Object val, LocationIdentity locationIdentity); 409 410 /** 411 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 412 * 413 * @param object the base object for the memory access 414 * @param offset the signed offset for the memory access 415 * @param locationIdentity the identity of the write 416 * @param val the value to be written to memory 417 */ 418 @Operation(opcode = Opcode.WRITE_BARRIERED) 419 public static native void writeByte(Object object, int offset, byte val, LocationIdentity locationIdentity); 420 421 /** 422 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 423 * 424 * @param object the base object for the memory access 425 * @param offset the signed offset for the memory access 426 * @param locationIdentity the identity of the write 427 * @param val the value to be written to memory 428 */ 429 @Operation(opcode = Opcode.WRITE_BARRIERED) 430 public static native void writeChar(Object object, int offset, char val, LocationIdentity locationIdentity); 431 432 /** 433 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 434 * 435 * @param object the base object for the memory access 436 * @param offset the signed offset for the memory access 437 * @param locationIdentity the identity of the write 438 * @param val the value to be written to memory 439 */ 440 @Operation(opcode = Opcode.WRITE_BARRIERED) 441 public static native void writeShort(Object object, int offset, short val, LocationIdentity locationIdentity); 442 443 /** 444 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 445 * 446 * @param object the base object for the memory access 447 * @param offset the signed offset for the memory access 448 * @param locationIdentity the identity of the write 449 * @param val the value to be written to memory 450 */ 451 @Operation(opcode = Opcode.WRITE_BARRIERED) 452 public static native void writeInt(Object object, int offset, int val, LocationIdentity locationIdentity); 453 454 /** 455 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 456 * 457 * @param object the base object for the memory access 458 * @param offset the signed offset for the memory access 459 * @param locationIdentity the identity of the write 460 * @param val the value to be written to memory 461 */ 462 @Operation(opcode = Opcode.WRITE_BARRIERED) 463 public static native void writeLong(Object object, int offset, long val, LocationIdentity locationIdentity); 464 465 /** 466 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 467 * 468 * @param object the base object for the memory access 469 * @param offset the signed offset for the memory access 470 * @param locationIdentity the identity of the write 471 * @param val the value to be written to memory 472 */ 473 @Operation(opcode = Opcode.WRITE_BARRIERED) 474 public static native void writeFloat(Object object, int offset, float val, LocationIdentity locationIdentity); 475 476 /** 477 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 478 * 479 * @param object the base object for the memory access 480 * @param offset the signed offset for the memory access 481 * @param locationIdentity the identity of the write 482 * @param val the value to be written to memory 483 */ 484 @Operation(opcode = Opcode.WRITE_BARRIERED) 485 public static native void writeDouble(Object object, int offset, double val, LocationIdentity locationIdentity); 486 487 /** 488 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 489 * 490 * @param object the base object for the memory access 491 * @param offset the signed offset for the memory access 492 * @param locationIdentity the identity of the write 493 * @param val the value to be written to memory 494 */ 495 @Operation(opcode = Opcode.WRITE_BARRIERED) 496 public static native void writeWord(Object object, int offset, WordBase val, LocationIdentity locationIdentity); 497 498 /** 499 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 500 * 501 * @param object the base object for the memory access 502 * @param offset the signed offset for the memory access 503 * @param locationIdentity the identity of the write 504 * @param val the value to be written to memory 505 */ 506 @Operation(opcode = Opcode.WRITE_BARRIERED) 507 public static native void writeObject(Object object, int offset, Object val, LocationIdentity locationIdentity); 508 509 /** 510 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 511 * <p> 512 * The offset is always treated as a {@link SignedWord} value. However, the static type is 513 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 514 * knows that the highest-order bit of the unsigned value is never used). 515 * 516 * @param object the base object for the memory access 517 * @param offset the signed offset for the memory access 518 * @return the result of the memory access 519 */ 520 @Operation(opcode = Opcode.READ_BARRIERED) 521 public static native byte readByte(Object object, WordBase offset); 522 523 /** 524 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 525 * <p> 526 * The offset is always treated as a {@link SignedWord} value. However, the static type is 527 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 528 * knows that the highest-order bit of the unsigned value is never used). 529 * 530 * @param object the base object for the memory access 531 * @param offset the signed offset for the memory access 532 * @return the result of the memory access 533 */ 534 @Operation(opcode = Opcode.READ_BARRIERED) 535 public static native char readChar(Object object, WordBase offset); 536 537 /** 538 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 539 * <p> 540 * The offset is always treated as a {@link SignedWord} value. However, the static type is 541 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 542 * knows that the highest-order bit of the unsigned value is never used). 543 * 544 * @param object the base object for the memory access 545 * @param offset the signed offset for the memory access 546 * @return the result of the memory access 547 */ 548 @Operation(opcode = Opcode.READ_BARRIERED) 549 public static native short readShort(Object object, WordBase offset); 550 551 /** 552 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 553 * <p> 554 * The offset is always treated as a {@link SignedWord} value. However, the static type is 555 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 556 * knows that the highest-order bit of the unsigned value is never used). 557 * 558 * @param object the base object for the memory access 559 * @param offset the signed offset for the memory access 560 * @return the result of the memory access 561 */ 562 @Operation(opcode = Opcode.READ_BARRIERED) 563 public static native int readInt(Object object, WordBase offset); 564 565 /** 566 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 567 * <p> 568 * The offset is always treated as a {@link SignedWord} value. However, the static type is 569 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 570 * knows that the highest-order bit of the unsigned value is never used). 571 * 572 * @param object the base object for the memory access 573 * @param offset the signed offset for the memory access 574 * @return the result of the memory access 575 */ 576 @Operation(opcode = Opcode.READ_BARRIERED) 577 public static native long readLong(Object object, WordBase offset); 578 579 /** 580 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 581 * <p> 582 * The offset is always treated as a {@link SignedWord} value. However, the static type is 583 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 584 * knows that the highest-order bit of the unsigned value is never used). 585 * 586 * @param object the base object for the memory access 587 * @param offset the signed offset for the memory access 588 * @return the result of the memory access 589 */ 590 @Operation(opcode = Opcode.READ_BARRIERED) 591 public static native float readFloat(Object object, WordBase offset); 592 593 /** 594 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 595 * <p> 596 * The offset is always treated as a {@link SignedWord} value. However, the static type is 597 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 598 * knows that the highest-order bit of the unsigned value is never used). 599 * 600 * @param object the base object for the memory access 601 * @param offset the signed offset for the memory access 602 * @return the result of the memory access 603 */ 604 @Operation(opcode = Opcode.READ_BARRIERED) 605 public static native double readDouble(Object object, WordBase offset); 606 607 /** 608 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 609 * <p> 610 * The offset is always treated as a {@link SignedWord} value. However, the static type is 611 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 612 * knows that the highest-order bit of the unsigned value is never used). 613 * 614 * @param object the base object for the memory access 615 * @param offset the signed offset for the memory access 616 * @return the result of the memory access 617 */ 618 @Operation(opcode = Opcode.READ_BARRIERED) 619 public static native <T extends WordBase> T readWord(Object object, WordBase offset); 620 621 /** 622 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 623 * <p> 624 * The offset is always treated as a {@link SignedWord} value. However, the static type is 625 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 626 * knows that the highest-order bit of the unsigned value is never used). 627 * 628 * @param object the base object for the memory access 629 * @param offset the signed offset for the memory access 630 * @return the result of the memory access 631 */ 632 @Operation(opcode = Opcode.READ_BARRIERED) 633 public static native Object readObject(Object object, WordBase offset); 634 635 /** 636 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 637 * 638 * @param object the base object for the memory access 639 * @param offset the signed offset for the memory access 640 * @return the result of the memory access 641 */ 642 @Operation(opcode = Opcode.READ_BARRIERED) 643 public static native byte readByte(Object object, int offset); 644 645 /** 646 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 647 * 648 * @param object the base object for the memory access 649 * @param offset the signed offset for the memory access 650 * @return the result of the memory access 651 */ 652 @Operation(opcode = Opcode.READ_BARRIERED) 653 public static native char readChar(Object object, int offset); 654 655 /** 656 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 657 * 658 * @param object the base object for the memory access 659 * @param offset the signed offset for the memory access 660 * @return the result of the memory access 661 */ 662 @Operation(opcode = Opcode.READ_BARRIERED) 663 public static native short readShort(Object object, int offset); 664 665 /** 666 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 667 * 668 * @param object the base object for the memory access 669 * @param offset the signed offset for the memory access 670 * @return the result of the memory access 671 */ 672 @Operation(opcode = Opcode.READ_BARRIERED) 673 public static native int readInt(Object object, int offset); 674 675 /** 676 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 677 * 678 * @param object the base object for the memory access 679 * @param offset the signed offset for the memory access 680 * @return the result of the memory access 681 */ 682 @Operation(opcode = Opcode.READ_BARRIERED) 683 public static native long readLong(Object object, int offset); 684 685 /** 686 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 687 * 688 * @param object the base object for the memory access 689 * @param offset the signed offset for the memory access 690 * @return the result of the memory access 691 */ 692 @Operation(opcode = Opcode.READ_BARRIERED) 693 public static native float readFloat(Object object, int offset); 694 695 /** 696 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 697 * 698 * @param object the base object for the memory access 699 * @param offset the signed offset for the memory access 700 * @return the result of the memory access 701 */ 702 @Operation(opcode = Opcode.READ_BARRIERED) 703 public static native double readDouble(Object object, int offset); 704 705 /** 706 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 707 * 708 * @param object the base object for the memory access 709 * @param offset the signed offset for the memory access 710 * @return the result of the memory access 711 */ 712 @Operation(opcode = Opcode.READ_BARRIERED) 713 public static native <T extends WordBase> T readWord(Object object, int offset); 714 715 /** 716 * Reads the memory at address {@code (object + offset)}. The offset is in bytes. 717 * 718 * @param object the base object for the memory access 719 * @param offset the signed offset for the memory access 720 * @return the result of the memory access 721 */ 722 @Operation(opcode = Opcode.READ_BARRIERED) 723 public static native Object readObject(Object object, int offset); 724 725 /** 726 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 727 * <p> 728 * The offset is always treated as a {@link SignedWord} value. However, the static type is 729 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 730 * knows that the highest-order bit of the unsigned value is never used). 731 * 732 * @param object the base object for the memory access 733 * @param offset the signed offset for the memory access 734 * @param val the value to be written to memory 735 */ 736 @Operation(opcode = Opcode.WRITE_BARRIERED) 737 public static native void writeByte(Object object, WordBase offset, byte val); 738 739 /** 740 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 741 * <p> 742 * The offset is always treated as a {@link SignedWord} value. However, the static type is 743 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 744 * knows that the highest-order bit of the unsigned value is never used). 745 * 746 * @param object the base object for the memory access 747 * @param offset the signed offset for the memory access 748 * @param val the value to be written to memory 749 */ 750 @Operation(opcode = Opcode.WRITE_BARRIERED) 751 public static native void writeChar(Object object, WordBase offset, char val); 752 753 /** 754 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 755 * <p> 756 * The offset is always treated as a {@link SignedWord} value. However, the static type is 757 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 758 * knows that the highest-order bit of the unsigned value is never used). 759 * 760 * @param object the base object for the memory access 761 * @param offset the signed offset for the memory access 762 * @param val the value to be written to memory 763 */ 764 @Operation(opcode = Opcode.WRITE_BARRIERED) 765 public static native void writeShort(Object object, WordBase offset, short val); 766 767 /** 768 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 769 * <p> 770 * The offset is always treated as a {@link SignedWord} value. However, the static type is 771 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 772 * knows that the highest-order bit of the unsigned value is never used). 773 * 774 * @param object the base object for the memory access 775 * @param offset the signed offset for the memory access 776 * @param val the value to be written to memory 777 */ 778 @Operation(opcode = Opcode.WRITE_BARRIERED) 779 public static native void writeInt(Object object, WordBase offset, int val); 780 781 /** 782 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 783 * <p> 784 * The offset is always treated as a {@link SignedWord} value. However, the static type is 785 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 786 * knows that the highest-order bit of the unsigned value is never used). 787 * 788 * @param object the base object for the memory access 789 * @param offset the signed offset for the memory access 790 * @param val the value to be written to memory 791 */ 792 @Operation(opcode = Opcode.WRITE_BARRIERED) 793 public static native void writeLong(Object object, WordBase offset, long val); 794 795 /** 796 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 797 * <p> 798 * The offset is always treated as a {@link SignedWord} value. However, the static type is 799 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 800 * knows that the highest-order bit of the unsigned value is never used). 801 * 802 * @param object the base object for the memory access 803 * @param offset the signed offset for the memory access 804 * @param val the value to be written to memory 805 */ 806 @Operation(opcode = Opcode.WRITE_BARRIERED) 807 public static native void writeFloat(Object object, WordBase offset, float val); 808 809 /** 810 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 811 * <p> 812 * The offset is always treated as a {@link SignedWord} value. However, the static type is 813 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 814 * knows that the highest-order bit of the unsigned value is never used). 815 * 816 * @param object the base object for the memory access 817 * @param offset the signed offset for the memory access 818 * @param val the value to be written to memory 819 */ 820 @Operation(opcode = Opcode.WRITE_BARRIERED) 821 public static native void writeDouble(Object object, WordBase offset, double val); 822 823 /** 824 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 825 * <p> 826 * The offset is always treated as a {@link SignedWord} value. However, the static type is 827 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 828 * knows that the highest-order bit of the unsigned value is never used). 829 * 830 * @param object the base object for the memory access 831 * @param offset the signed offset for the memory access 832 * @param val the value to be written to memory 833 */ 834 @Operation(opcode = Opcode.WRITE_BARRIERED) 835 public static native void writeWord(Object object, WordBase offset, WordBase val); 836 837 /** 838 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 839 * <p> 840 * The offset is always treated as a {@link SignedWord} value. However, the static type is 841 * {@link WordBase} to avoid the frequent casts of {@link UnsignedWord} values (where the caller 842 * knows that the highest-order bit of the unsigned value is never used). 843 * 844 * @param object the base object for the memory access 845 * @param offset the signed offset for the memory access 846 * @param val the value to be written to memory 847 */ 848 @Operation(opcode = Opcode.WRITE_BARRIERED) 849 public static native void writeObject(Object object, WordBase offset, Object val); 850 851 /** 852 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 853 * 854 * @param object the base object for the memory access 855 * @param offset the signed offset for the memory access 856 * @param val the value to be written to memory 857 */ 858 @Operation(opcode = Opcode.WRITE_BARRIERED) 859 public static native void writeByte(Object object, int offset, byte val); 860 861 /** 862 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 863 * 864 * @param object the base object for the memory access 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_BARRIERED) 869 public static native void writeChar(Object object, int offset, char val); 870 871 /** 872 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 873 * 874 * @param object the base object for the memory access 875 * @param offset the signed offset for the memory access 876 * @param val the value to be written to memory 877 */ 878 @Operation(opcode = Opcode.WRITE_BARRIERED) 879 public static native void writeShort(Object object, int offset, short val); 880 881 /** 882 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 883 * 884 * @param object the base object for the memory access 885 * @param offset the signed offset for the memory access 886 * @param val the value to be written to memory 887 */ 888 @Operation(opcode = Opcode.WRITE_BARRIERED) 889 public static native void writeInt(Object object, int offset, int val); 890 891 /** 892 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 893 * 894 * @param object the base object for the memory access 895 * @param offset the signed offset for the memory access 896 * @param val the value to be written to memory 897 */ 898 @Operation(opcode = Opcode.WRITE_BARRIERED) 899 public static native void writeLong(Object object, int offset, long val); 900 901 /** 902 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 903 * 904 * @param object the base object for the memory access 905 * @param offset the signed offset for the memory access 906 * @param val the value to be written to memory 907 */ 908 @Operation(opcode = Opcode.WRITE_BARRIERED) 909 public static native void writeFloat(Object object, int offset, float val); 910 911 /** 912 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 913 * 914 * @param object the base object for the memory access 915 * @param offset the signed offset for the memory access 916 * @param val the value to be written to memory 917 */ 918 @Operation(opcode = Opcode.WRITE_BARRIERED) 919 public static native void writeDouble(Object object, int offset, double val); 920 921 /** 922 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 923 * 924 * @param object the base object for the memory access 925 * @param offset the signed offset for the memory access 926 * @param val the value to be written to memory 927 */ 928 @Operation(opcode = Opcode.WRITE_BARRIERED) 929 public static native void writeWord(Object object, int offset, WordBase val); 930 931 /** 932 * Writes the memory at address {@code (object + offset)}. The offset is in bytes. 933 * 934 * @param object the base object for the memory access 935 * @param offset the signed offset for the memory access 936 * @param val the value to be written to memory 937 */ 938 @Operation(opcode = Opcode.WRITE_BARRIERED) 939 public static native void writeObject(Object object, int offset, Object val); 940} 941