Mercurial > hg > truffle
comparison graal/com.oracle.truffle.api/src/com/oracle/truffle/api/CompilerDirectives.java @ 13956:fca29edf5667
experimental CompilerDirectives.unsafeGetFinal*
author | Andreas Woess <andreas.woess@jku.at> |
---|---|
date | Fri, 14 Feb 2014 16:45:53 +0100 |
parents | 1541afe9cf15 |
children | 73546bd550f0 |
comparison
equal
deleted
inserted
replaced
13955:1541afe9cf15 | 13956:fca29edf5667 |
---|---|
442 public static void unsafePutObject(Object receiver, long offset, Object value, Object locationIdentity) { | 442 public static void unsafePutObject(Object receiver, long offset, Object value, Object locationIdentity) { |
443 UNSAFE.putObject(receiver, offset, value); | 443 UNSAFE.putObject(receiver, offset, value); |
444 } | 444 } |
445 | 445 |
446 /** | 446 /** |
447 * Unsafe access to a final boolean value within an object. The condition parameter gives a hint | |
448 * to the compiler under which circumstances this access can be moved to an earlier location in | |
449 * the program. The location identity gives a hint to the compiler for improved global value | |
450 * numbering. | |
451 * | |
452 * @param receiver the object that is accessed | |
453 * @param offset the offset at which to access the object in bytes | |
454 * @param condition the condition that makes this access safe also at an earlier location in the | |
455 * program | |
456 * @param locationIdentity the location identity token that can be used for improved global | |
457 * value numbering or null | |
458 * @return the accessed value | |
459 */ | |
460 public static boolean unsafeGetFinalBoolean(Object receiver, long offset, boolean condition, Object locationIdentity) { | |
461 return UNSAFE.getBoolean(receiver, offset); | |
462 } | |
463 | |
464 /** | |
465 * Unsafe access to a final byte value within an object. The condition parameter gives a hint to | |
466 * the compiler under which circumstances this access can be moved to an earlier location in the | |
467 * program. The location identity gives a hint to the compiler for improved global value | |
468 * numbering. | |
469 * | |
470 * @param receiver the object that is accessed | |
471 * @param offset the offset at which to access the object in bytes | |
472 * @param condition the condition that makes this access safe also at an earlier location in the | |
473 * program | |
474 * @param locationIdentity the location identity token that can be used for improved global | |
475 * value numbering or null | |
476 * @return the accessed value | |
477 */ | |
478 public static byte unsafeGetFinalByte(Object receiver, long offset, boolean condition, Object locationIdentity) { | |
479 return UNSAFE.getByte(receiver, offset); | |
480 } | |
481 | |
482 /** | |
483 * Unsafe access to a final short value within an object. The condition parameter gives a hint | |
484 * to the compiler under which circumstances this access can be moved to an earlier location in | |
485 * the program. The location identity gives a hint to the compiler for improved global value | |
486 * numbering. | |
487 * | |
488 * @param receiver the object that is accessed | |
489 * @param offset the offset at which to access the object in bytes | |
490 * @param condition the condition that makes this access safe also at an earlier location in the | |
491 * program | |
492 * @param locationIdentity the location identity token that can be used for improved global | |
493 * value numbering or null | |
494 * @return the accessed value | |
495 */ | |
496 public static short unsafeGetFinalShort(Object receiver, long offset, boolean condition, Object locationIdentity) { | |
497 return UNSAFE.getShort(receiver, offset); | |
498 } | |
499 | |
500 /** | |
501 * Unsafe access to a final int value within an object. The condition parameter gives a hint to | |
502 * the compiler under which circumstances this access can be moved to an earlier location in the | |
503 * program. The location identity gives a hint to the compiler for improved global value | |
504 * numbering. | |
505 * | |
506 * @param receiver the object that is accessed | |
507 * @param offset the offset at which to access the object in bytes | |
508 * @param condition the condition that makes this access safe also at an earlier location in the | |
509 * program | |
510 * @param locationIdentity the location identity token that can be used for improved global | |
511 * value numbering or null | |
512 * @return the accessed value | |
513 */ | |
514 public static int unsafeGetFinalInt(Object receiver, long offset, boolean condition, Object locationIdentity) { | |
515 return UNSAFE.getInt(receiver, offset); | |
516 } | |
517 | |
518 /** | |
519 * Unsafe access to a final long value within an object. The condition parameter gives a hint to | |
520 * the compiler under which circumstances this access can be moved to an earlier location in the | |
521 * program. The location identity gives a hint to the compiler for improved global value | |
522 * numbering. | |
523 * | |
524 * @param receiver the object that is accessed | |
525 * @param offset the offset at which to access the object in bytes | |
526 * @param condition the condition that makes this access safe also at an earlier location in the | |
527 * program | |
528 * @param locationIdentity the location identity token that can be used for improved global | |
529 * value numbering or null | |
530 * @return the accessed value | |
531 */ | |
532 public static long unsafeGetFinalLong(Object receiver, long offset, boolean condition, Object locationIdentity) { | |
533 return UNSAFE.getLong(receiver, offset); | |
534 } | |
535 | |
536 /** | |
537 * Unsafe access to a final float value within an object. The condition parameter gives a hint | |
538 * to the compiler under which circumstances this access can be moved to an earlier location in | |
539 * the program. The location identity gives a hint to the compiler for improved global value | |
540 * numbering. | |
541 * | |
542 * @param receiver the object that is accessed | |
543 * @param offset the offset at which to access the object in bytes | |
544 * @param condition the condition that makes this access safe also at an earlier location in the | |
545 * program | |
546 * @param locationIdentity the location identity token that can be used for improved global | |
547 * value numbering or null | |
548 * @return the accessed value | |
549 */ | |
550 public static float unsafeGetFinalFloat(Object receiver, long offset, boolean condition, Object locationIdentity) { | |
551 return UNSAFE.getFloat(receiver, offset); | |
552 } | |
553 | |
554 /** | |
555 * Unsafe access to a final double value within an object. The condition parameter gives a hint | |
556 * to the compiler under which circumstances this access can be moved to an earlier location in | |
557 * the program. The location identity gives a hint to the compiler for improved global value | |
558 * numbering. | |
559 * | |
560 * @param receiver the object that is accessed | |
561 * @param offset the offset at which to access the object in bytes | |
562 * @param condition the condition that makes this access safe also at an earlier location in the | |
563 * program | |
564 * @param locationIdentity the location identity token that can be used for improved global | |
565 * value numbering or null | |
566 * @return the accessed value | |
567 */ | |
568 public static double unsafeGetFinalDouble(Object receiver, long offset, boolean condition, Object locationIdentity) { | |
569 return UNSAFE.getDouble(receiver, offset); | |
570 } | |
571 | |
572 /** | |
573 * Unsafe access to a final Object value within an object. The condition parameter gives a hint | |
574 * to the compiler under which circumstances this access can be moved to an earlier location in | |
575 * the program. The location identity gives a hint to the compiler for improved global value | |
576 * numbering. | |
577 * | |
578 * @param receiver the object that is accessed | |
579 * @param offset the offset at which to access the object in bytes | |
580 * @param condition the condition that makes this access safe also at an earlier location in the | |
581 * program | |
582 * @param locationIdentity the location identity token that can be used for improved global | |
583 * value numbering or null | |
584 * @return the accessed value | |
585 */ | |
586 public static Object unsafeGetFinalObject(Object receiver, long offset, boolean condition, Object locationIdentity) { | |
587 return UNSAFE.getObject(receiver, offset); | |
588 } | |
589 | |
590 /** | |
447 * Marks methods that are considered slowpath and should therefore not be inlined by default. | 591 * Marks methods that are considered slowpath and should therefore not be inlined by default. |
448 */ | 592 */ |
449 @Retention(RetentionPolicy.RUNTIME) | 593 @Retention(RetentionPolicy.RUNTIME) |
450 @Target({ElementType.METHOD}) | 594 @Target({ElementType.METHOD}) |
451 public @interface SlowPath { | 595 public @interface SlowPath { |