On Thu, 5 May 2022 01:42:48 GMT, Xiaohong Gong <xg...@openjdk.org> wrote:

> > > Yeah, I agree that it's not good by adding a branch checking for 
> > > `offsetInRange`. But actually I met the constant issue that passing the 
> > > values all the way cannot guarantee the argument a constant in compiler 
> > > at the compile time. Do you have any better idea to fixing this?
> > 
> > 
> > That's odd, `boolean` constants are passed that are then converted to `int` 
> > constants. Did you try passing integer constants all the way through?
> 
> I will try again. I remember the main cause is the calling of `fromArray0` 
> from `fromArray`, it is not annotated with `ForceInline`. The arguments might 
> not be compiled to a constant for cases that the offset is not in the array 
> range like tail loop.

I tried to pass the integer constant all the way, and unfortunate that the 
`offsetInRange` is not compiled to a constant. The following assertion in the 
`vectorIntrinsics.cpp` will fail:

  --- a/src/hotspot/share/opto/vectorIntrinsics.cpp
+++ b/src/hotspot/share/opto/vectorIntrinsics.cpp
@@ -1236,6 +1236,7 @@ bool 
LibraryCallKit::inline_vector_mem_masked_operation(bool is_store) {
     } else {
       // Masked vector load with IOOBE always uses the predicated load.
       const TypeInt* offset_in_range = gvn().type(argument(8))->isa_int();
+      assert(offset_in_range->is_con(), "not a constant");
       if (!offset_in_range->is_con()) {
         if (C->print_intrinsics()) {
           tty->print_cr("  ** missing constant: offsetInRange=%s",

-------------

PR: https://git.openjdk.java.net/jdk/pull/8035

Reply via email to