c1 crashes ?
    forax at univ-mlv.fr 
    forax at univ-mlv.fr
       
    Mon Jun 25 09:29:17 UTC 2018
    
    
  
----- Mail original -----
> De: "Roland Westrelin" <rwestrel at redhat.com>
> À: "Remi Forax" <forax at univ-mlv.fr>
> Cc: "valhalla-dev" <valhalla-dev at openjdk.java.net>
> Envoyé: Lundi 25 Juin 2018 11:13:06
> Objet: Re: c1 crashes ?
>> it seems to work without (apart c1 crash).
> 
> Do you have a test case for the c1 crash?
yes, sure, see below.
> 
> Roland.
Rémi
---
public final __ByValue class IntBox {
  private final int value;
  private IntBox() {
    this.value = 0;
  }
  @Override
  public String toString() {
    return "" + value;
  }
  public int compareTo(IntBox box) {
    return Integer.compare(value, box.value);
  }
  
  public IntBox add(IntBox box) {
    return IntBox.valueOf(value + box.value);
  }
  
  public static IntBox valueOf(int value) {
    IntBox box = __MakeDefault IntBox();
    box = __WithField(box.value, value);
    return box;
  }
  private static IntBox sum(IntBox n) {
    IntBox sum = IntBox.valueOf(0);
    for(IntBox i = IntBox.valueOf(0); i.compareTo(n) < 0; i = i.add(IntBox.valueOf(1))) {
      sum = sum.add(i);
    }
    return sum;
  }
  
  public static void main(String[] args) {
    for(int i = 0; i < 100_000; i++) {
      sum(IntBox.valueOf(i));
    }
  }
}
    
    
More information about the valhalla-dev
mailing list