vvysotskyi opened a new pull request #1687: DRILL-2326: Fix scalar replacement 
for the case when static method which does not return values is called
URL: https://github.com/apache/drill/pull/1687
 
 
   For the case when the generated code contains a call of the method which 
does not return any results, scalar replacement fails.
   Example of such code (it is taken from `binary_string` UDF):
   ```
       out.buffer = buffer.reallocIfNeeded(in.end - in.start);
       out.start = out.end = 0;
       out.end = 
org.apache.drill.common.util.DrillStringUtils.parseBinaryString(in.buffer, 
in.start, in.end, out.buffer);
       out.buffer.setIndex(out.start, out.end);
   ```
   In this case scalar replacement framework assumes that stack contains object 
returned by this method and adds `aload` instruction for the object from the 
top of stack trace. But if scalar replacement happened for that oblect, aload 
instruction will have incorrect index.
   To fix this issue a check for the method return type was added.
   
   Also, this PR contains the fix for the case when created object is returned 
without assigning it to the local variable. Before this change, the object 
wasn't marked as a function return value and therefore was replaced by its 
fields.

----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
 
For queries about this service, please contact Infrastructure at:
[email protected]


With regards,
Apache Git Services

Reply via email to