[ 
https://issues.apache.org/jira/browse/DRILL-5116?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15816477#comment-15816477
 ] 

ASF GitHub Bot commented on DRILL-5116:
---------------------------------------

Github user paul-rogers commented on a diff in the pull request:

    https://github.com/apache/drill/pull/716#discussion_r95471607
  
    --- Diff: 
exec/java-exec/src/main/java/org/apache/drill/exec/compile/CodeCompiler.java ---
    @@ -41,12 +39,87 @@
      */
     
     public class CodeCompiler {
    +  private static final org.slf4j.Logger logger = 
org.slf4j.LoggerFactory.getLogger(CodeCompiler.class);
    +
    +  /**
    +   * Abstracts out the details of compiling code using the two available
    +   * mechanisms. Allows this mechanism to be unit tested separately from
    +   * the code cache.
    +   */
    +
    +  public static class CodeGenCompiler {
    +    private final ClassTransformer transformer;
    +    private final ClassBuilder classBuilder;
    +
    +    public CodeGenCompiler(final DrillConfig config, final OptionManager 
optionManager) {
    +      transformer = new ClassTransformer(config, optionManager);
    +      classBuilder = new ClassBuilder(config, optionManager);
    +    }
    +
    +    /**
    +     * Compile the code already generated by the code generator.
    +     *
    +     * @param cg the code generator for the class
    +     * @return the compiled class
    +     * @throws Exception if anything goes wrong
    +     */
    +
    +    public Class<?> compile(final CodeGenerator<?> cg) throws Exception {
    +       if (cg.isPlainOldJava()) {
    --- End diff --
    
    Done. Trace logging will identify if the class was found in the code cache, 
or compile via plain-Java or byte code manipulation. Also logged the compiler 
selection and debug code options (which are set statically). This should 
provide most information needed to understand a run.
    
    Also added the requested information about a plain-Java compilation: the 
byte code size and elapsed time. Revised both log messages to include class 
name to provide some context for the compilation messages.
    
    The missing information is whether a particular class was compiled with 
Janino or JDK.


> Enable generated code debugging in each Drill operator
> ------------------------------------------------------
>
>                 Key: DRILL-5116
>                 URL: https://issues.apache.org/jira/browse/DRILL-5116
>             Project: Apache Drill
>          Issue Type: Improvement
>    Affects Versions: 1.9.0
>            Reporter: Paul Rogers
>            Assignee: Paul Rogers
>            Priority: Minor
>              Labels: ready-to-commit
>
> DRILL-5052 adds the ability to debug generated code. Some of the code 
> generated by Drill's operators has minor problems when compiled directly 
> using the new technique. These issues are ignore by the byte-code-merge 
> technique uses in production. This ticket asks to try the DRILL-5052 feature 
> in each operator, clean up any minor problems, and ensure each operator 
> generates code suitable for debugging. Use the new 
> {{CodeGenerator.plainOldJavaCapable()}} method to mark each generated class 
> as ready for "plain-old Java" code gen.
> The advantages of this feature are two:
> 1. Ability to step through the generated code to increase understanding of 
> existing operators and to ease development of improvements to existing 
> operators and of any new operators we choose to create.
> 2. Open the door to experimenting with how to improve performance of the 
> generated code.



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Reply via email to