One more: Method invalidation for strange example code

Stefan Marr java at stefan-marr.de
Wed Jan 22 05:11:54 PST 2014


Hi:

I tried to track the last issue in the Richards benchmark, and might have condensed it to the attached example.

The code is the following:

benchmark = (
  | bar |
  bar := 1234.
        
  1 to: 20000 do: [:i |
    counter := 2122.
  ]
)

I was not able to track down why the invalidation happens, however, I have the feeling that it is a complex interplay of things.
Note the local variable `bar`, which gets mapped to a FieldSlot in a VirtualFrame. The value is never read, but just assigning it causes the method invalidation. Also note that the value is significant. If it is between 1 and 100 or so, the method does not get invalidated. And, adding -G:Dump= to the VM parameters also makes the invalidation disappear.

All in all, very mysterious.

Note that the block gets completely inlined into the loop node. So, I was investigating a couple of leads, but in the end, the whole thing seems to stabilize correctly and FrameSlots seem to be initialized correctly as well, even though they are inlined.

Any hints how I could track what causes the invalidation? All invalidations done in TruffleSOM directly are tracked, in my version locally, I think.

With the latest code, the benchmark is started like this: (having the file in the Examples/Benchmarks folder)


./mx.sh --vm server vm -XX:+UnlockDiagnosticVMOptions -XX:+LogCompilation -G:+TraceTruffleExpansion -G:+TraceTruffleExpansionSource -XX:+TraceDeoptimization -G:-TruffleBackgroundCompilation -G:+TraceTruffleCompilationDetails -Xbootclasspath/a:../som/build/classes:../som/libs/truffle.jar som.vm.Universe -cp ../som/Smalltalk ../som/Examples/Benchmarks/BenchmarkHarness.som FieldWrite 200 10 100


-------------- next part --------------


Best regards
Stefan

-- 
Stefan Marr
INRIA Lille - Nord Europe
http://stefan-marr.de/research/





More information about the graal-dev mailing list