RFR: Milestone 1

Roman Kennke rkennke at openjdk.java.net
Thu Jan 21 21:13:48 UTC 2021


On Thu, 21 Jan 2021 18:31:05 GMT, Kelvin Nilsen <kdnilsen at openjdk.org> wrote:

> 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;
>   }
> }

Very nice! Only one question regarding what looks like a rogue include. Also, maybe the testprogram can be readily included as first jtreg test that exercises genshen when running make test TEST=hotspot_gc_shenandoah (even when it probably doesn't test anything except that it doesn't crash)?

src/hotspot/share/gc/shenandoah/shenandoahCardTable.cpp line 26:

> 24: 
> 25: #include "precompiled.hpp"
> 26: #include "gc/shenandoah/shenandoahHeap.inline.hpp"

What is this include used for?

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

Changes requested by rkennke (Reviewer).

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


More information about the shenandoah-dev mailing list