RFR: Milestone 1

Kelvin Nilsen kdnilsen at openjdk.java.net
Thu Jan 21 18:39:20 UTC 2021


The objective of Milestone-1 is to demonstrate that certain heap regions can be designated as representing old-gen, card marking and remembered set implementation do not crash. Since the current implementation does not promote objects into old-gen space, much of the implementation of card marking and remembered set scanning is not exercised.

The following simple test program was used to demonstrate execution:

public class hello {
  public static void main(String args[]) {
    Node n = null;
    for (int count = 10000; count > 0; count--) {
      n = Node.upheaval(n);
      System.out.print(count);
      System.out.print(": Hello world: ");
      for (int i = 0; i < args.length; i++) {
	System.out.print(args[i]);
	System.out.print(" ");
      }
      System.out.print("[node value is " + n.value() + "]");
      System.out.println("");
    }
  }
}

import java.util.Random;

public class Node {
  static private final int NeighborCount = 5;
  static private Random random = new Random(46);

  private int val;
  private Object field_o;

  private int[] field_ints;
  private Node [] neighbors;

  // Copy each neighbor of n into new node's neighbor array.  Then overwrite
  // arbitrarily selected neighbor with newly allocated leaf node.
  public static Node upheaval(Node n) {
    int first_val = random.nextInt();
    if (first_val < 0) first_val = -first_val;
    if (first_val < 0) first_val = 0;
    Node result = new Node(first_val);
    if (n != null) {
      for (int i = 0; i < NeighborCount; i++)
	result.neighbors[i] = n.neighbors[i];
    }
    int second_val = random.nextInt();
    if (second_val < 0) second_val = -second_val;
    if (second_val < 0) second_val = 0;
    int overwrite_index = first_val % NeighborCount;
    result.neighbors[overwrite_index] = new Node(second_val);
    return result;
  }
  
  public Node(int val) {
    this.val = val;
    this.field_o = new Object();
    this.field_ints = new int[8];
    this.field_ints[0] = 0xca;
    this.field_ints[1] = 0xfe;
    this.field_ints[2] = 0xba;
    this.field_ints[3] = 0xbe;
    this.field_ints[4] = 0xba;
    this.field_ints[5] = 0xad;
    this.field_ints[6] = 0xba;
    this.field_ints[7] = 0xbe;
    this.neighbors = new Node[NeighborCount];
  }

  public int value() {
    return val;
  }
}

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

Commit messages:
 - Remove trailing whitespace
 - Initialize barrier set before it's used.
 - Allocate humongous objects in young gen
 - Fix includes in shenandoahCardTable file.
 - Public GenShen docs.
 - Fixed GC configuration report to JFR to reflect Shenandoah young collections.

Changes: https://git.openjdk.java.net/shenandoah/pull/13/files
 Webrev: https://webrevs.openjdk.java.net/?repo=shenandoah&pr=13&range=00
  Stats: 789 lines in 7 files changed: 787 ins; 1 del; 1 mod
  Patch: https://git.openjdk.java.net/shenandoah/pull/13.diff
  Fetch: git fetch https://git.openjdk.java.net/shenandoah pull/13/head:pull/13

PR: https://git.openjdk.java.net/shenandoah/pull/13


More information about the shenandoah-dev mailing list