--- old/src/hotspot/share/ci/ciSignature.cpp 2019-03-11 14:25:28.146355681 +0100 +++ new/src/hotspot/share/ci/ciSignature.cpp 2019-03-11 14:25:27.946355684 +0100 @@ -1,5 +1,5 @@ /* - * Copyright (c) 1999, 2016, Oracle and/or its affiliates. All rights reserved. + * Copyright (c) 1999, 2019, Oracle and/or its affiliates. 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 @@ -68,6 +68,9 @@ ciSymbol* klass_name = env->get_symbol(name); type = env->get_klass_by_name_impl(_accessing_klass, cpool, klass_name, false); } + if (type->is_valuetype() && ss.type() == T_VALUETYPE) { + type = env->make_never_null_wrapper(type); + } } _types->append(type); if (ss.at_return_type()) { @@ -91,12 +94,23 @@ { ASSERT_IN_VM; EXCEPTION_CONTEXT; - Arena* arena = CURRENT_ENV->arena(); + ciEnv* env = CURRENT_ENV; + Arena* arena = env->arena(); _types = new (arena) GrowableArray(arena, _count + 1, 0, NULL); + ciType* type = NULL; + bool never_null = false; for (int i = 0; i < _count; i++) { - _types->append(method_type->ptype_at(i)); + type = method_type->ptype_at(i, never_null); + if (type->is_valuetype() && never_null) { + type = env->make_never_null_wrapper(type); + } + _types->append(type); } - _types->append(method_type->rtype()); + type = method_type->rtype(never_null); + if (type->is_valuetype() && never_null) { + type = env->make_never_null_wrapper(type); + } + _types->append(type); } // ------------------------------------------------------------------ @@ -104,7 +118,7 @@ // // What is the return type of this signature? ciType* ciSignature::return_type() const { - return _types->at(_count); + return _types->at(_count)->unwrap(); } // ------------------------------------------------------------------ @@ -115,7 +129,24 @@ ciType* ciSignature::type_at(int index) const { assert(index < _count, "out of bounds"); // The first _klasses element holds the return klass. - return _types->at(index); + return _types->at(index)->unwrap(); +} + +// ------------------------------------------------------------------ +// ciSignature::return_never_null +// +// True if we statically know that the return value is never null. +bool ciSignature::returns_never_null() const { + return _types->at(_count)->is_never_null(); +} + +// ------------------------------------------------------------------ +// ciSignature::never_null_at +// +// True if we statically know that the argument at 'index' is never null. +bool ciSignature::is_never_null_at(int index) const { + assert(index < _count, "out of bounds"); + return _types->at(index)->is_never_null(); } // ------------------------------------------------------------------