# HG changeset patch # User mbaesken # Date 1569411452 -7200 # Wed Sep 25 13:37:32 2019 +0200 # Node ID 2a358f68d970ca4acd88f9737f6ce01f79b0c56d # Parent 88fce7eea1f670bc2f8b2e5ec441586a768f1e7c 8231448: s390 and ppc - replace JVM type comparisons to T_OBJECT and T_ARRAY with call to is_reference_type diff --git a/src/hotspot/cpu/ppc/c1_FrameMap_ppc.cpp b/src/hotspot/cpu/ppc/c1_FrameMap_ppc.cpp --- a/src/hotspot/cpu/ppc/c1_FrameMap_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_FrameMap_ppc.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 1999, 2015, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2015 SAP SE. All rights reserved. + * Copyright (c) 1999, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -52,7 +52,7 @@ //} if (r_2->is_Register() && (type == T_LONG || type == T_DOUBLE)) { opr = as_long_opr(reg); - } else if (type == T_OBJECT || type == T_ARRAY) { + } else if (is_reference_type(type)) { opr = as_oop_opr(reg); } else { opr = as_opr(reg); diff --git a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp --- a/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_LIRAssembler_ppc.cpp @@ -1237,7 +1237,7 @@ } else { ShouldNotReachHere(); } - if (to_reg->type() == T_OBJECT || to_reg->type() == T_ARRAY) { + if (is_reference_type(to_reg->type())) { __ verify_oop(to_reg->as_register()); } } @@ -1253,7 +1253,7 @@ Register disp_reg = noreg; int disp_value = addr->disp(); bool needs_patching = (patch_code != lir_patch_none); - bool compress_oop = (type == T_ARRAY || type == T_OBJECT) && UseCompressedOops && !wide && + bool compress_oop = (is_reference_type(type)) && UseCompressedOops && !wide && CompressedOops::mode() != CompressedOops::UnscaledNarrowOop; bool load_disp = addr->index()->is_illegal() && !Assembler::is_simm16(disp_value); bool use_R29 = compress_oop && load_disp; // Avoid register conflict, also do null check before killing R29. @@ -1473,7 +1473,7 @@ } } else { assert(opr1->type() != T_ADDRESS && opr2->type() != T_ADDRESS, "currently unsupported"); - if (opr1->type() == T_OBJECT || opr1->type() == T_ARRAY) { + if (is_reference_type(opr1->type())) { // There are only equal/notequal comparisons on objects. assert(condition == lir_cond_equal || condition == lir_cond_notEqual, "oops"); __ cmpd(BOOL_RESULT, opr1->as_register(), opr2->as_register()); @@ -2315,8 +2315,8 @@ void LIR_Assembler::emit_alloc_array(LIR_OpAllocArray* op) { LP64_ONLY( __ extsw(op->len()->as_register(), op->len()->as_register()); ) if (UseSlowPath || - (!UseFastNewObjectArray && (op->type() == T_OBJECT || op->type() == T_ARRAY)) || - (!UseFastNewTypeArray && (op->type() != T_OBJECT && op->type() != T_ARRAY))) { + (!UseFastNewObjectArray && (is_reference_type(op->type()))) || + (!UseFastNewTypeArray && (!is_reference_type(op->type())))) { __ b(*op->stub()->entry()); } else { __ allocate_array(op->obj()->as_register(), diff --git a/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp b/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp --- a/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp +++ b/src/hotspot/cpu/ppc/c1_LIRGenerator_ppc.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2005, 2018, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2017, SAP SE. All rights reserved. + * Copyright (c) 2005, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2012, 2019, SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -648,7 +648,7 @@ __ membar_release(); } - if (type == T_OBJECT || type == T_ARRAY) { + if (is_reference_type(type)) { if (UseCompressedOops) { t1 = new_register(T_OBJECT); t2 = new_register(T_OBJECT); diff --git a/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp b/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp --- a/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/gc/g1/g1BarrierSetAssembler_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, SAP SE. All rights reserved. + * Copyright (c) 2018, 2019, SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -305,7 +305,7 @@ void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register base, RegisterOrConstant ind_or_offs, Register dst, Register tmp1, Register tmp2, bool needs_frame, Label *L_handle_null) { - bool on_oop = type == T_OBJECT || type == T_ARRAY; + bool on_oop = is_reference_type(type); bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0; bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0; bool on_reference = on_weak || on_phantom; diff --git a/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.cpp b/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.cpp --- a/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.cpp +++ b/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, SAP SE. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -59,7 +59,7 @@ void ModRefBarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register base, RegisterOrConstant ind_or_offs, Register val, Register tmp1, Register tmp2, Register tmp3, bool needs_frame) { - if (type == T_OBJECT || type == T_ARRAY) { + if (is_reference_type(type)) { oop_store_at(masm, decorators, type, base, ind_or_offs, val, tmp1, tmp2, tmp3, needs_frame); } else { BarrierSetAssembler::store_at(masm, decorators, type, base, ind_or_offs, val, tmp1, tmp2, tmp3, needs_frame); diff --git a/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.hpp b/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.hpp --- a/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.hpp +++ b/src/hotspot/cpu/ppc/gc/shared/modRefBarrierSetAssembler_ppc.hpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, SAP SE. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it diff --git a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp --- a/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp +++ b/src/hotspot/cpu/ppc/sharedRuntime_ppc.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 1997, 2019, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2012, 2018 SAP SE. All rights reserved. + * Copyright (c) 2012, 2019 SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -1142,7 +1142,7 @@ } if (!r_2->is_valid()) { // Not sure we need to do this but it shouldn't hurt. - if (sig_bt[i] == T_OBJECT || sig_bt[i] == T_ADDRESS || sig_bt[i] == T_ARRAY) { + if (is_reference_type(sig_bt[i]) || sig_bt[i] == T_ADDRESS) { __ ld(r, ld_offset, ld_ptr); ld_offset-=wordSize; } else { @@ -1739,8 +1739,7 @@ Register temp_reg = R19_method; // not part of any compiled calling seq if (VerifyOops) { for (int i = 0; i < method->size_of_parameters(); i++) { - if (sig_bt[i] == T_OBJECT || - sig_bt[i] == T_ARRAY) { + if (is_reference_type(sig_bt[i])) { VMReg r = regs[i].first(); assert(r->is_valid(), "bad oop arg"); if (r->is_stack()) { @@ -2602,7 +2601,7 @@ // Unbox oop result, e.g. JNIHandles::resolve value. // -------------------------------------------------------------------------- - if (ret_type == T_OBJECT || ret_type == T_ARRAY) { + if (is_reference_type(ret_type)) { __ resolve_jobject(R3_RET, r_temp_1, r_temp_2, /* needs_frame */ false); } diff --git a/src/hotspot/cpu/s390/c1_FrameMap_s390.cpp b/src/hotspot/cpu/s390/c1_FrameMap_s390.cpp --- a/src/hotspot/cpu/s390/c1_FrameMap_s390.cpp +++ b/src/hotspot/cpu/s390/c1_FrameMap_s390.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2016, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016 SAP SE. All rights reserved. + * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2016, 2019, SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -46,7 +46,7 @@ Register reg = r_1->as_Register(); if (r_2->is_Register() && (type == T_LONG || type == T_DOUBLE)) { opr = as_long_opr(reg); - } else if (type == T_OBJECT || type == T_ARRAY) { + } else if (is_reference_type(type)) { opr = as_oop_opr(reg); } else if (type == T_METADATA) { opr = as_metadata_opr(reg); diff --git a/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp b/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp --- a/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/c1_LIRAssembler_s390.cpp @@ -972,6 +972,7 @@ } else { __ z_lg(dest->as_register(), disp_value, disp_reg, src); } + __ verify_oop(dest->as_register()); break; } case T_FLOAT: @@ -991,9 +992,6 @@ case T_LONG : __ z_lg(dest->as_register_lo(), disp_value, disp_reg, src); break; default : ShouldNotReachHere(); } - if (type == T_ARRAY || type == T_OBJECT) { - __ verify_oop(dest->as_register()); - } if (patch != NULL) { patching_epilog(patch, patch_code, src, info); @@ -1006,7 +1004,7 @@ assert(dest->is_register(), "should not call otherwise"); if (dest->is_single_cpu()) { - if (type == T_ARRAY || type == T_OBJECT) { + if (is_reference_type(type)) { __ mem2reg_opt(dest->as_register(), frame_map()->address_for_slot(src->single_stack_ix()), true); __ verify_oop(dest->as_register()); } else if (type == T_METADATA) { @@ -1034,7 +1032,7 @@ if (src->is_single_cpu()) { const Address dst = frame_map()->address_for_slot(dest->single_stack_ix()); - if (type == T_OBJECT || type == T_ARRAY) { + if (is_reference_type(type)) { __ verify_oop(src->as_register()); __ reg2mem_opt(src->as_register(), dst, true); } else if (type == T_METADATA) { @@ -1080,7 +1078,7 @@ } else { ShouldNotReachHere(); } - if (to_reg->type() == T_OBJECT || to_reg->type() == T_ARRAY) { + if (is_reference_type(to_reg->type())) { __ verify_oop(to_reg->as_register()); } } @@ -1131,7 +1129,7 @@ assert(disp_reg != Z_R0 || Immediate::is_simm20(disp_value), "should have set this up"); - if (type == T_ARRAY || type == T_OBJECT) { + if (is_reference_type(type)) { __ verify_oop(from->as_register()); } @@ -1294,10 +1292,10 @@ Register reg1 = opr1->as_register(); if (opr2->is_single_cpu()) { // cpu register - cpu register - if (opr1->type() == T_OBJECT || opr1->type() == T_ARRAY) { + if (is_reference_type(opr1->type())) { __ z_clgr(reg1, opr2->as_register()); } else { - assert(opr2->type() != T_OBJECT && opr2->type() != T_ARRAY, "cmp int, oop?"); + assert(! is_reference_type(opr2->type()), "cmp int, oop?"); if (unsigned_comp) { __ z_clr(reg1, opr2->as_register()); } else { @@ -1306,7 +1304,7 @@ } } else if (opr2->is_stack()) { // cpu register - stack - if (opr1->type() == T_OBJECT || opr1->type() == T_ARRAY) { + if (is_reference_type(opr1->type())) { __ z_cg(reg1, frame_map()->address_for_slot(opr2->single_stack_ix())); } else { if (unsigned_comp) { @@ -1324,7 +1322,7 @@ } else { __ z_cfi(reg1, c->as_jint()); } - } else if (c->type() == T_OBJECT || c->type() == T_ARRAY) { + } else if (is_reference_type(c->type())) { // In 64bit oops are single register. jobject o = c->as_jobject(); if (o == NULL) { @@ -1767,7 +1765,7 @@ } } else { Register r_lo; - if (right->type() == T_OBJECT || right->type() == T_ARRAY) { + if (is_reference_type(right->type())) { r_lo = right->as_register(); } else { r_lo = right->as_register_lo(); @@ -2413,8 +2411,8 @@ __ move_reg_if_needed(len, T_LONG, len, T_INT); // sign extend if (UseSlowPath || - (!UseFastNewObjectArray && (op->type() == T_OBJECT || op->type() == T_ARRAY)) || - (!UseFastNewTypeArray && (op->type() != T_OBJECT && op->type() != T_ARRAY))) { + (!UseFastNewObjectArray && (is_reference_type(op->type()))) || + (!UseFastNewTypeArray && (!is_reference_type(op->type())))) { __ z_brul(*op->stub()->entry()); } else { __ allocate_array(op->obj()->as_register(), diff --git a/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp b/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp --- a/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/gc/g1/g1BarrierSetAssembler_s390.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, SAP SE. All rights reserved. + * Copyright (c) 2018, 2019, SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -100,7 +100,7 @@ void G1BarrierSetAssembler::load_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, const Address& src, Register dst, Register tmp1, Register tmp2, Label *L_handle_null) { - bool on_oop = type == T_OBJECT || type == T_ARRAY; + bool on_oop = is_reference_type(type); bool on_weak = (decorators & ON_WEAK_OOP_REF) != 0; bool on_phantom = (decorators & ON_PHANTOM_OOP_REF) != 0; bool on_reference = on_weak || on_phantom; diff --git a/src/hotspot/cpu/s390/gc/shared/modRefBarrierSetAssembler_s390.cpp b/src/hotspot/cpu/s390/gc/shared/modRefBarrierSetAssembler_s390.cpp --- a/src/hotspot/cpu/s390/gc/shared/modRefBarrierSetAssembler_s390.cpp +++ b/src/hotspot/cpu/s390/gc/shared/modRefBarrierSetAssembler_s390.cpp @@ -1,6 +1,6 @@ /* - * Copyright (c) 2018, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2018, SAP SE. All rights reserved. + * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 2018, 2019, SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -36,14 +36,14 @@ void ModRefBarrierSetAssembler::arraycopy_prologue(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register src, Register dst, Register count) { - if (type == T_OBJECT || type == T_ARRAY) { + if (is_reference_type(type)) { gen_write_ref_array_pre_barrier(masm, decorators, dst, count); } } void ModRefBarrierSetAssembler::arraycopy_epilogue(MacroAssembler* masm, DecoratorSet decorators, BasicType type, Register dst, Register count, bool do_return) { - if (type == T_OBJECT || type == T_ARRAY) { + if (is_reference_type(type)) { gen_write_ref_array_post_barrier(masm, decorators, dst, count, do_return); } else { if (do_return) { __ z_br(Z_R14); } @@ -52,7 +52,7 @@ void ModRefBarrierSetAssembler::store_at(MacroAssembler* masm, DecoratorSet decorators, BasicType type, const Address& dst, Register val, Register tmp1, Register tmp2, Register tmp3) { - if (type == T_OBJECT || type == T_ARRAY) { + if (is_reference_type(type)) { oop_store_at(masm, decorators, type, dst, val, tmp1, tmp2, tmp3); } else { BarrierSetAssembler::store_at(masm, decorators, type, dst, val, tmp1, tmp2, tmp3); diff --git a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp b/src/hotspot/cpu/s390/sharedRuntime_s390.cpp --- a/src/hotspot/cpu/s390/sharedRuntime_s390.cpp +++ b/src/hotspot/cpu/s390/sharedRuntime_s390.cpp @@ -1,6 +1,6 @@ /* * Copyright (c) 2016, 2019, Oracle and/or its affiliates. All rights reserved. - * Copyright (c) 2016, 2018 SAP SE. All rights reserved. + * Copyright (c) 2016, 2019, SAP SE. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it @@ -883,7 +883,7 @@ if (!VerifyOops) { return; } for (int i = 0; i < total_args_passed; i++) { - if (sig_bt[i] == T_OBJECT || sig_bt[i] == T_ARRAY) { + if (is_reference_type(sig_bt[i])) { VMReg r = regs[i].first(); assert(r->is_valid(), "bad oop arg"); @@ -2318,7 +2318,7 @@ __ reset_last_Java_frame(); // Unpack oop result, e.g. JNIHandles::resolve result. - if (ret_type == T_OBJECT || ret_type == T_ARRAY) { + if (is_reference_type(ret_type)) { __ resolve_jobject(Z_RET, /* tmp1 */ Z_R13, /* tmp2 */ Z_R7); } @@ -2621,7 +2621,7 @@ } else { if (!r_2->is_valid()) { // Not sure we need to do this but it shouldn't hurt. - if (sig_bt[i] == T_OBJECT || sig_bt[i] == T_ADDRESS || sig_bt[i] == T_ARRAY) { + if (is_reference_type(sig_bt[i]) || sig_bt[i] == T_ADDRESS) { __ z_lg(r_1->as_Register(), ld_offset, ld_ptr); } else { __ z_l(r_1->as_Register(), ld_offset, ld_ptr);