@@ -2772,51 +2772,23 @@ void TemplateTable::getfield_or_static(int byte_no, bool is_static, RewriteContr
2772
2772
} else { // Valhalla
2773
2773
if (is_static) {
2774
2774
__ load_heap_oop (r0, field, rscratch1, rscratch2);
2775
- Label is_null_free_inline_type, uninitialized;
2776
- // Issue below if the static field has not been initialized yet
2777
- __ test_field_is_null_free_inline_type (flags, noreg /* temp*/ , is_null_free_inline_type);
2778
- // field is not a null free inline type
2779
- __ push (atos);
2780
- __ b (Done);
2781
- // field is a null free inline type, must not return null even if uninitialized
2782
- __ bind (is_null_free_inline_type);
2783
- __ cbz (r0, uninitialized);
2784
- __ push (atos);
2785
- __ b (Done);
2786
- __ bind (uninitialized);
2787
- __ b (ExternalAddress (Interpreter::_throw_NPE_UninitializedField_entry));
2775
+ __ push (atos);
2776
+ __ b (Done);
2788
2777
} else {
2789
- Label is_flat, nonnull, is_inline_type, has_null_marker, rewrite_inline;
2790
- __ test_field_is_null_free_inline_type (flags, noreg /* temp*/ , is_inline_type);
2791
- __ test_field_has_null_marker (flags, noreg /* temp*/ , has_null_marker);
2792
- // Non-inline field case
2793
- __ load_heap_oop (r0, field, rscratch1, rscratch2);
2778
+ Label is_flat, rewrite_inline;
2779
+ __ test_field_is_flat (flags, noreg /* temp*/ , is_flat);
2780
+ __ load_heap_oop (r0, field, rscratch1, rscratch2);
2781
+ __ push (atos);
2782
+ if (rc == may_rewrite) {
2783
+ patch_bytecode (Bytecodes::_fast_agetfield, bc, r1);
2784
+ }
2785
+ __ b (Done);
2786
+ __ bind (is_flat);
2787
+ // field is flat (null-free or nullable with a null-marker)
2788
+ __ mov (r0, obj);
2789
+ __ read_flat_field (cache, field_index, off, inline_klass /* temp */ , r0);
2790
+ __ verify_oop (r0);
2794
2791
__ push (atos);
2795
- if (rc == may_rewrite) {
2796
- patch_bytecode (Bytecodes::_fast_agetfield, bc, r1);
2797
- }
2798
- __ b (Done);
2799
- __ bind (is_inline_type);
2800
- __ test_field_is_flat (flags, noreg /* temp */ , is_flat);
2801
- // field is not flat
2802
- __ load_heap_oop (r0, field, rscratch1, rscratch2);
2803
- __ cbnz (r0, nonnull);
2804
- __ b (ExternalAddress (Interpreter::_throw_NPE_UninitializedField_entry));
2805
- __ bind (nonnull);
2806
- __ verify_oop (r0);
2807
- __ push (atos);
2808
- __ b (rewrite_inline);
2809
- __ bind (is_flat);
2810
- // field is flat
2811
- __ mov (r0, obj);
2812
- __ read_flat_field (cache, field_index, off, inline_klass /* temp */ , r0);
2813
- __ verify_oop (r0);
2814
- __ push (atos);
2815
- __ b (rewrite_inline);
2816
- __ bind (has_null_marker);
2817
- call_VM (r0, CAST_FROM_FN_PTR (address, InterpreterRuntime::read_nullable_flat_field), obj, cache);
2818
- __ verify_oop (r0);
2819
- __ push (atos);
2820
2792
__ bind (rewrite_inline);
2821
2793
if (rc == may_rewrite) {
2822
2794
patch_bytecode (Bytecodes::_fast_vgetfield, bc, r1);
@@ -3057,52 +3029,35 @@ void TemplateTable::putfield_or_static(int byte_no, bool is_static, RewriteContr
3057
3029
} else { // Valhalla
3058
3030
__ pop (atos);
3059
3031
if (is_static) {
3060
- Label is_inline_type ;
3061
- __ test_field_is_not_null_free_inline_type (flags, noreg /* temp */ , is_inline_type );
3062
- __ null_check (r0);
3063
- __ bind (is_inline_type );
3032
+ Label is_nullable ;
3033
+ __ test_field_is_not_null_free_inline_type (flags, noreg /* temp */ , is_nullable );
3034
+ __ null_check (r0); // FIXME JDK-8341120
3035
+ __ bind (is_nullable );
3064
3036
do_oop_store (_masm, field, r0, IN_HEAP);
3065
3037
__ b (Done);
3066
3038
} else {
3067
- Label is_inline_type, is_flat, has_null_marker, rewrite_not_inline, rewrite_inline;
3068
- __ test_field_is_null_free_inline_type (flags, noreg /* temp*/ , is_inline_type);
3069
- __ test_field_has_null_marker (flags, noreg /* temp*/ , has_null_marker);
3070
- // Not an inline type
3039
+ Label null_free_reference, is_flat, rewrite_inline;
3040
+ __ test_field_is_flat (flags, noreg /* temp*/ , is_flat);
3041
+ __ test_field_is_null_free_inline_type (flags, noreg /* temp*/ , null_free_reference);
3071
3042
pop_and_check_object (obj);
3072
3043
// Store into the field
3073
3044
// Clobbers: r10, r11, r3
3074
3045
do_oop_store (_masm, field, r0, IN_HEAP);
3075
- __ bind (rewrite_not_inline);
3076
3046
if (rc == may_rewrite) {
3077
3047
patch_bytecode (Bytecodes::_fast_aputfield, bc, r19, true , byte_no);
3078
3048
}
3079
3049
__ b (Done);
3080
3050
// Implementation of the inline type semantic
3081
- __ bind (is_inline_type);
3082
- __ null_check (r0);
3083
- __ test_field_is_flat (flags, noreg /* temp*/ , is_flat);
3084
- // field is not flat
3051
+ __ bind (null_free_reference);
3052
+ __ null_check (r0); // FIXME JDK-8341120
3085
3053
pop_and_check_object (obj);
3086
3054
// Store into the field
3087
3055
// Clobbers: r10, r11, r3
3088
3056
do_oop_store (_masm, field, r0, IN_HEAP);
3089
3057
__ b (rewrite_inline);
3090
3058
__ bind (is_flat);
3091
- __ load_field_entry (cache, index); // reload field entry (cache) because it was erased by tos_state
3092
- __ load_unsigned_short (index, Address (cache, in_bytes (ResolvedFieldEntry::field_index_offset ())));
3093
- __ ldr (r2, Address (cache, in_bytes (ResolvedFieldEntry::field_holder_offset ())));
3094
- __ inline_layout_info (r2, index, r6);
3095
- pop_and_check_object (obj);
3096
- __ load_klass (inline_klass, r0);
3097
- __ payload_address (r0, r0, inline_klass);
3098
- __ add (obj, obj, off);
3099
- // because we use InlineLayoutInfo, we need special value access code specialized for fields (arrays will need a different API)
3100
- __ flat_field_copy (IN_HEAP, r0, obj, r6);
3101
- __ b (rewrite_inline);
3102
- __ bind (has_null_marker);
3103
- assert_different_registers (r0, cache, r19);
3104
- pop_and_check_object (r19);
3105
- __ call_VM (noreg, CAST_FROM_FN_PTR (address, InterpreterRuntime::write_nullable_flat_field), r19, r0, cache);
3059
+ pop_and_check_object (r7);
3060
+ __ write_flat_field (cache, off, r3, r6, r7);
3106
3061
__ bind (rewrite_inline);
3107
3062
if (rc == may_rewrite) {
3108
3063
patch_bytecode (Bytecodes::_fast_vputfield, bc, r19, true , byte_no);
@@ -3323,29 +3278,18 @@ void TemplateTable::fast_storefield(TosState state)
3323
3278
// access field
3324
3279
switch (bytecode ()) {
3325
3280
case Bytecodes::_fast_vputfield:
3326
- {
3281
+ {
3327
3282
Label is_flat, has_null_marker, done;
3328
- __ test_field_has_null_marker (r5, noreg /* temp */ , has_null_marker);
3329
- __ null_check (r0);
3330
3283
__ test_field_is_flat (r5, noreg /* temp */ , is_flat);
3331
- // field is not flat
3284
+ __ null_check (r0);
3332
3285
do_oop_store (_masm, field, r0, IN_HEAP);
3333
3286
__ b (done);
3334
3287
__ bind (is_flat);
3335
- // field is flat
3336
3288
__ load_field_entry (r4, r5);
3337
- __ load_unsigned_short (r5, Address (r4, in_bytes (ResolvedFieldEntry::field_index_offset ())));
3338
- __ ldr (r4, Address (r4, in_bytes (ResolvedFieldEntry::field_holder_offset ())));
3339
- __ inline_layout_info (r4, r5, r6);
3340
- __ load_klass (r4, r0);
3341
- __ payload_address (r0, r0, r4);
3342
- __ lea (rscratch1, field);
3343
- __ flat_field_copy (IN_HEAP, r0, rscratch1, r6);
3344
- __ b (done);
3345
- __ bind (has_null_marker);
3346
- __ load_field_entry (r4, r1);
3347
- __ mov (r1, r2);
3348
- __ call_VM (noreg, CAST_FROM_FN_PTR (address, InterpreterRuntime::write_nullable_flat_field), r1, r0, r4);
3289
+ // Re-shuffle registers because of VM calls calling convention
3290
+ __ mov (r19, r1);
3291
+ __ mov (r7, r2);
3292
+ __ write_flat_field (r4, r19, r6, r8, r7);
3349
3293
__ bind (done);
3350
3294
}
3351
3295
break ;
@@ -3444,27 +3388,11 @@ void TemplateTable::fast_accessfield(TosState state)
3444
3388
switch (bytecode ()) {
3445
3389
case Bytecodes::_fast_vgetfield:
3446
3390
{
3447
- Register index = r4, klass = r5, inline_klass = r6, tmp = r7;
3448
- Label is_flat, has_null_marker, nonnull, Done;
3449
- __ test_field_has_null_marker (r3, noreg /* temp*/ , has_null_marker);
3450
- __ test_field_is_flat (r3, noreg /* temp */ , is_flat);
3451
- // field is not flat
3452
- __ load_heap_oop (r0, field, rscratch1, rscratch2);
3453
- __ cbnz (r0, nonnull);
3454
- __ b (ExternalAddress (Interpreter::_throw_NPE_UninitializedField_entry));
3455
- __ bind (nonnull);
3456
- __ verify_oop (r0);
3457
- __ b (Done);
3458
- __ bind (is_flat);
3391
+ Register index = r4, tmp = r7;
3459
3392
// field is flat
3460
- __ load_unsigned_short (index, Address (r2, in_bytes (ResolvedFieldEntry::field_index_offset ())));
3461
- __ read_flat_field (r2, index, r1, tmp /* temp */ , r0);
3462
- __ verify_oop (r0);
3463
- __ b (Done);
3464
- __ bind (has_null_marker);
3465
- call_VM (r0, CAST_FROM_FN_PTR (address, InterpreterRuntime::read_nullable_flat_field), r0, r2);
3466
- __ verify_oop (r0);
3467
- __ bind (Done);
3393
+ __ load_unsigned_short (index, Address (r2, in_bytes (ResolvedFieldEntry::field_index_offset ())));
3394
+ __ read_flat_field (r2, index, r1, tmp /* temp */ , r0);
3395
+ __ verify_oop (r0);
3468
3396
}
3469
3397
break ;
3470
3398
case Bytecodes::_fast_agetfield:
0 commit comments