Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-8293172

[lworld] Folding of default value loads is broken

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: P4 P4
    • repo-valhalla
    • repo-valhalla
    • hotspot

      tkls->isa_inlinetype() in below test can never be true:

      @@ -2059,11 +2055,11 @@ const Type* LoadNode::Value(PhaseGVN* phase) const {
             Node* base = AddPNode::Ideal_base_and_offset(adr, phase, offset);
             if (base != NULL && base->is_Load() && offset == in_bytes(InlineKlass::default_value_offset_offset())) {
               const TypeKlassPtr* tkls = phase->type(base->in(MemNode::Address))->isa_klassptr();
      - if (tkls != NULL && tkls->is_loaded() && tkls->klass_is_exact() && tkls->isa_inlinetype() &&
      + if (tkls != NULL && tkls->is_loaded() && tkls->klass_is_exact() && tkls->exact_klass()->is_inlinetype() &&
                   tkls->offset() == in_bytes(InstanceKlass::adr_inlineklass_fixed_block_offset())) {
                 assert(base->Opcode() == Op_LoadP, "must load an oop from klass");
                 assert(Opcode() == Op_LoadI, "must load an int from fixed block");
      - return TypeInt::make(tkls->klass()->as_inline_klass()->default_value_offset());
      + return TypeInt::make(tkls->exact_klass()->as_inline_klass()->default_value_offset());
               }
             }
           }

      We should add a corresponding IR verification test:

      --- a/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java
      +++ b/test/hotspot/jtreg/compiler/valhalla/inlinetypes/TestIntrinsics.java
      @@ -468,6 +468,7 @@ public class TestIntrinsics {
           }
       
           @Test
      + @IR(failOn = IRNode.LOAD_I) // Load of the default value should be folded
           public Object test26() {
               Class<?>[] ca = new Class<?>[1];
               for (int i = 0; i < 1; ++i) {

            thartmann Tobias Hartmann
            thartmann Tobias Hartmann
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: