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

G1: Remove redundant is-marking-active checks in C1 barrier

XMLWordPrintable

    • Icon: Enhancement Enhancement
    • Resolution: Fixed
    • Icon: P4 P4
    • 20
    • 20
    • hotspot
    • gc
    • b04

      There are three methods involved in G1 C1 pre-barrier and they are connected by the call-chain:

      ```
         G1BarrierSetC1::pre_barrier
      -> G1BarrierSetAssembler::gen_pre_barrier_stub
      -> G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub
      ```

      In `G1BarrierSetAssembler::generate_c1_pre_barrier_runtime_stub`, it contains a is-marking-active check. Its caller, essentially `G1BarrierSetAssembler::gen_pre_barrier_stub` already knows marking is active, `// At this point we know that marking is in progress`, and actual check is in `G1BarrierSetC1::pre_barrier`.

      Therefore, the following code (from x86, other arch have the same pattern) is redundant.

      ```
        // Is marking still active?
        if (in_bytes(SATBMarkQueue::byte_width_of_active()) == 4) {
          __ cmpl(queue_active, 0);
        } else {
          assert(in_bytes(SATBMarkQueue::byte_width_of_active()) == 1, "Assumption");
          __ cmpb(queue_active, 0);
        }
        __ jcc(Assembler::equal, done);
      ```

            ayang Albert Yang
            ayang Albert Yang
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: