Re: [rvm-research] Strange behavior in baseline compiler
"David P Grove" <[email protected]> Thu, 7 Jun 2018 21:36:31 -0400
| Newsgroups | gmane.comp.java.jikes.rvm.devel |
|---|---|
| Message-ID | <OF52F15E30.EF0C6BCC-ON852582A6.0008B77C-852582A6.0008D64D@notes.na.collabserv.com> |
Shoaib Akram <[email protected]> wrote on 06/07/2018 07:06:40 PM: > > 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. > My guess is that the code is executed during BootImageWriting. The value 43044 is the value of the field at the time the bootimage is written, so that value is carried over into runtime. --dave ------------------------------------------------------------------------------ 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