781 } |
781 } |
782 } |
782 } |
783 |
783 |
784 UNSAFE_ENTRY(jint, Unsafe_ArrayBaseOffset(JNIEnv *env, jobject unsafe, jclass acls)) |
784 UNSAFE_ENTRY(jint, Unsafe_ArrayBaseOffset(JNIEnv *env, jobject unsafe, jclass acls)) |
785 UnsafeWrapper("Unsafe_ArrayBaseOffset"); |
785 UnsafeWrapper("Unsafe_ArrayBaseOffset"); |
786 int base, scale; |
786 int base = 0, scale = 0; |
787 getBaseAndScale(base, scale, acls, CHECK_0); |
787 getBaseAndScale(base, scale, acls, CHECK_0); |
788 return field_offset_from_byte_offset(base); |
788 return field_offset_from_byte_offset(base); |
789 UNSAFE_END |
789 UNSAFE_END |
790 |
790 |
791 |
791 |
792 UNSAFE_ENTRY(jint, Unsafe_ArrayIndexScale(JNIEnv *env, jobject unsafe, jclass acls)) |
792 UNSAFE_ENTRY(jint, Unsafe_ArrayIndexScale(JNIEnv *env, jobject unsafe, jclass acls)) |
793 UnsafeWrapper("Unsafe_ArrayIndexScale"); |
793 UnsafeWrapper("Unsafe_ArrayIndexScale"); |
794 int base, scale; |
794 int base = 0, scale = 0; |
795 getBaseAndScale(base, scale, acls, CHECK_0); |
795 getBaseAndScale(base, scale, acls, CHECK_0); |
796 // This VM packs both fields and array elements down to the byte. |
796 // This VM packs both fields and array elements down to the byte. |
797 // But watch out: If this changes, so that array references for |
797 // But watch out: If this changes, so that array references for |
798 // a given primitive type (say, T_BOOLEAN) use different memory units |
798 // a given primitive type (say, T_BOOLEAN) use different memory units |
799 // than fields, this method MUST return zero for such arrays. |
799 // than fields, this method MUST return zero for such arrays. |