changeset 53560:09d9f9085910 lworld

8216260: [lworld] C2 compilation fails with assert(_base == ValueType) failed: Not a value type
author thartmann
date Mon, 07 Jan 2019 10:53:29 +0100
parents d964b3a65184
children 530ea41023b2
files src/hotspot/share/opto/type.cpp src/hotspot/share/opto/type.hpp test/hotspot/jtreg/compiler/valhalla/valuetypes/TestCallingConvention.java
diffstat 3 files changed, 15 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/hotspot/share/opto/type.cpp	Sun Jan 06 21:05:53 2019 -0800
+++ b/src/hotspot/share/opto/type.cpp	Mon Jan 07 10:53:29 2019 +0100
@@ -1945,14 +1945,10 @@
 // Make a TypeTuple from the range of a method signature
 const TypeTuple *TypeTuple::make_range(ciSignature* sig, bool ret_vt_fields) {
   ciType* return_type = sig->return_type();
-  return make_range(return_type, sig->returns_never_null(), ret_vt_fields);
-}
-
-const TypeTuple *TypeTuple::make_range(ciType* return_type, bool never_null, bool ret_vt_fields) {
+  bool never_null = sig->returns_never_null();
+
   uint arg_cnt = 0;
-  if (ret_vt_fields) {
-    ret_vt_fields = return_type->is_valuetype() && ((ciValueKlass*)return_type)->can_be_returned_as_fields();
-  }
+  ret_vt_fields = ret_vt_fields && never_null && return_type->is_valuetype() && ((ciValueKlass*)return_type)->can_be_returned_as_fields();
   if (ret_vt_fields) {
     ciValueKlass* vk = (ciValueKlass*)return_type;
     arg_cnt = vk->value_arg_slots()+1;
--- a/src/hotspot/share/opto/type.hpp	Sun Jan 06 21:05:53 2019 -0800
+++ b/src/hotspot/share/opto/type.hpp	Mon Jan 07 10:53:29 2019 +0100
@@ -690,7 +690,6 @@
 
   static const TypeTuple *make( uint cnt, const Type **fields );
   static const TypeTuple *make_range(ciSignature* sig, bool ret_vt_fields = false);
-  static const TypeTuple *make_range(ciType* return_type, bool never_null = false, bool ret_vt_fields = false);
   static const TypeTuple *make_domain(ciMethod* method, bool vt_fields_as_args = false);
 
   // Subroutine call type with space allocated for argument types
--- a/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestCallingConvention.java	Sun Jan 06 21:05:53 2019 -0800
+++ b/test/hotspot/jtreg/compiler/valhalla/valuetypes/TestCallingConvention.java	Mon Jan 07 10:53:29 2019 +0100
@@ -467,4 +467,16 @@
         Asserts.assertEQ(res1, res2);
         Asserts.assertEQ(res2, res3);
     }
+
+    // Should not return a nullable value type as fields
+    @Test
+    public MyValue2.box test24() {
+        return null;
+    }
+
+    @DontCompile
+    public void test24_verifier(boolean warmup) {
+        MyValue2.box vt = test24();
+        Asserts.assertEQ(vt, null);
+    }
 }