+TraceTruffleCompilation: More detailed infos on optimization

Gero Leinemann gero.leinemann at oracle.com
Tue Sep 30 11:06:36 UTC 2014


Hi Christian,
>> a) the function which got called and
> CallTarget#toString() delegates to RootNode#toString() which is 
> controlled by the guest language.  So feel free to implement your own 
> overwritten version of RootNode#toString() in R that fits your need to 
> identify the guest language function.
yes. I wanted to stress the point that a function is most easily 
identified by the name of the variable it's assigned to, which is a 
property of the call site and not the function/CallTarget itself.
Instead of modifying "RootNode.toString" or implement 
"getDebugProperties()", it'd be useful to be able to pass information 
from the call site, too.
>> b) from where it got called,
> Do you mean the call site that made the CallTarget hot? We could just 
> go up the guest language stack trace once to see where it got hot. How 
> did you implement that, and can you give me an example output with 
> your modifications?
The call site that triggered the "compile()", yes. Because R needs to 
know how each function was called (at least for error messages, maybe 
even for introspection), we store the SourceSection of the call site 
(say, "f(x, y)") in the frame.
I extract it in "OptimizedCallTarget.interpreterCall", pass it down to 
"OptimizedCallTargetLog.logOptimizingDone" and add it as output property 
so a line looks like this:
> [truffle] opt done         function(item, depth) {\n    if (depth == 
> 0L)\n      <opt>  |ASTSize 324 (5/0) |Time  3212(2115+1097)ms 
> |*CallSrc tree(left_item, next_depth)* |CallNodes I     0/D     2 
> |GraalNodes  4201/ 4193 |CodeSize        19749 |Source 
> /home/gero/oracle-dev/r/r_benchmarks/r.benchmarks/bin/r/benchmarks/shootout/shootout-binarytrees.r:8
Maybe it's possible to "simply" forward the SourceSection information 
present in the OptimizedDirectCallNode to the 
"OptimizedCallTarget.compile" (and so on), but I don't know how to do 
this without changing the "CallTarget.call(args)" signature, which is 
not desired I guess.

Best,
Gero





More information about the graal-dev mailing list