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