RFR: Milestone 1 [v3]

Roman Kennke rkennke at openjdk.java.net
Wed Feb 3 16:09:03 UTC 2021


On Tue, 2 Feb 2021 22:36:41 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;
>>   }
>> }
>
> Kelvin Nilsen has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Remove trailing white space

Looks good to me!

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

Marked as reviewed by rkennke (Reviewer).

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


More information about the shenandoah-dev mailing list