Shenandoah: Simplify WALK_FORWARD_IN_BLOCK_START use

XMLWordPrintable

    • gc

      Sonar complains there is define/undefine of a global macro WALK_FORWARD_IN_BLOCK_START.

      After JDK-8358735, we have this:

      #ifdef ASSERT
      #define WALK_FORWARD_IN_BLOCK_START true
      #else
      #define WALK_FORWARD_IN_BLOCK_START false
      #endif // ASSERT
        while (WALK_FORWARD_IN_BLOCK_START && p + obj->size() < left) {
          p += obj->size();
          obj = cast_to_oop(p);
          assert(oopDesc::is_oop(obj), "Should be an object");
          assert(Klass::is_valid(obj->klass()), "Not a valid klass ptr");
          // Check assumptions in previous block comment if this assert fires
          guarantee(false, "Should never need forward walk in block start");
        }
      #undef WALK_FORWARD_IN_BLOCK_START

      But it makes no sense, since we can just wrap the entire while loop with #ifdef ASSERT.

            Assignee:
            Aleksey Shipilev
            Reporter:
            Aleksey Shipilev
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated: