[rvm-research] Strange behavior in baseline compiler

Shoaib Akram <[email protected]> Fri, 8 Jun 2018 01:06:40 +0200
Newsgroups gmane.comp.java.jikes.rvm.devel
Message-ID <[email protected]>
Hi All,

I am observing a strange behavior in my code additions to the baseline compiler. I cut a long story short and provide a simplified example. I  obtain a monotonically increasing integer value from a new module which I have placed in myJikes/rvm/src/org/jikesrvm/ot/OriginTracking.java. All this class does is:

private static int allocation_site = 2;

  public static final int getValueFromLocation() {
    allocation_site += 2;
    return allocation_site;
  }

In the BaselineCompilerImpl.java I obtain a value by calling getValueFromLocation() in the emit_unresolved_new() method:

protected final void emit_unresolved_new(TypeReference typeRef) {
    int value = OriginTracking.getValueFromLocation();
    VM.sysWriteln(value);
    rest of the method ….
}

The first time getValueFromLocation() is called the value printed on screen is 43044. How can this happen?

This behavior is consistent across benchmarks and invocations :(

If I comment out the allocation_site += 2 line in getValueFromLocation, I get the correct value of 2.

Any insight is welcome.

Thanks,
Shoaib
------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, Slashdot.org! http://sdm.link/slashdot
_______________________________________________
Jikesrvm-researchers mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/jikesrvm-researchers