--- a/src/hotspot/cpu/s390/templateTable_s390.cpp Fri Nov 10 19:10:54 2017 +0100
+++ b/src/hotspot/cpu/s390/templateTable_s390.cpp Thu Nov 30 17:13:33 2017 +0100
@@ -1181,8 +1181,20 @@
__ pop_i(Z_ARG3);
__ pop_ptr(Z_tmp_2);
// Z_tos : value
- // Z_ARG3 : index
+ // Z_ARG3 : index
// Z_tmp_2 : array
+
+ // Need to check whether array is boolean or byte
+ // since both types share the bastore bytecode.
+ __ load_klass(Z_tmp_1, Z_tmp_2);
+ __ z_llgf(Z_tmp_1, Address(Z_tmp_1, Klass::layout_helper_offset()));
+ __ z_tmll(Z_tmp_1, Klass::layout_helper_boolean_diffbit());
+ Label L_skip;
+ __ z_bfalse(L_skip);
+ // if it is a T_BOOLEAN array, mask the stored value to 0/1
+ __ z_nilf(Z_tos, 0x1);
+ __ bind(L_skip);
+
// No index shift necessary - pass 0.
index_check(Z_tmp_2, Z_ARG3, 0); // Prefer index in Z_ARG3.
__ z_stc(Z_tos,
@@ -2328,6 +2340,13 @@
__ bind(skip_register_finalizer);
}
+ if (state == itos) {
+ // Narrow result if state is itos but result type is smaller.
+ // Need to narrow in the return bytecode rather than in generate_return_entry
+ // since compiled code callers expect the result to already be narrowed.
+ __ narrow(Z_tos, Z_tmp_1); /* fall through */
+ }
+
__ remove_activation(state, Z_R14);
__ z_br(Z_R14);
}