JIT

Starting with Oracle 11gR1 Oracle JVM includes Just-in-Time compiler. Its goal is to convert JVM bytecode into platform-specific native code based on the performance data gathered in run-time. It is stated in the documentation that JIT “enables much faster execution” – and this is, in general, true. There are ways to control the behavior of JIT, one way is described in the MOS Doc ID 1309858.1, and another one here.

Actually the way to control JIT (apart from completely disabling it with JAVA_JIT_ENABLED), is mentioned in the documentation – it is the new method, SET_NATIVE_COMPILER_OPTION in the DBMS_JAVA package. Unfortunately there’s no any information on what are possible incoming values to the procedure and their meaning. It looks like they are documented in the function DBMS_JAVA.NATIVE_COMPILER_OPTIONS. The way the function is implemented looks very odd to me, so I wrote a query to transform the returned table of VARCHAR2 into more readable/”query-able” form:

col option_name         format a35
col opt_desc            format a40 word_wrap
col opt_values          format a30 word_wrap
col opt_format          format a40 word_wrap

select option_name,
       opt_desc,
       opt_values,
       opt_format
  from
   (select nvl(option_name, (lag(option_name ignore nulls) over (order by rn))) option_name,
           start_of_group,
           listagg(line, chr(10)) within group (order by rn) over (partition by gr) full_line
      from 
       (select case when start_of_group = 1 then
                   trim(both '''' from substr(line, instr(line, '''')))
               end option_name,
               nvl(start_of_group, (lag(start_of_group ignore nulls) over (order by rn))) start_of_group,
               sum(start_of_group) over (order by rn) gr,
               line,
               rn
          from
           (select case when option_line like 'Option %''' then 1
                        when option_line like 'Values:%'   then 2
                        when option_line like 'Format:%'   then 3
                   end start_of_group,
                   option_line line,
                   rownum rn
              from table(dbms_java.native_compiler_options) t
             where t.option_line is not null
            )
        )
    )
 pivot (max(full_line) for start_of_group in (1 as opt_desc, 2 as opt_values, 3 as opt_format))
 order by option_name;

And here is query output from my Oracle 11.2.0.2 instance

OPTION_NAME                         OPT_DESC                                 OPT_VALUES                     OPT_FORMAT
----------------------------------- ---------------------------------------- ------------------------------ ----------------------------------------
asyncPollLevel                      Option 'asyncPollLevel'                  Values:                        Format:
                                    Level of polling used by generated code. SysEventsOnly - Poll on        'asyncPollLevel', '<value>'
                                    Asycynchronous events (such as Ctrl-C    System-events (such as GC)
                                    interrupt) are polled for in             only.  This is default.
                                    compiled code.  This option specifies    MethodEntry - Poll on each
                                    how compiled-code should poll            method-entry.
                                    for these events.                        MethodEntryAndBranches - Poll
                                                                             on each method-entry and
                                                                             backwards-branch.

cpuFeatureFlagOverride              Option 'cpuFeatureFlagOverride'          Values: [int]                  Format:
                                    override the value of the current                                       'cpuFeatureFlagOverride', '<value>'
                                    cpu-feature flags

debugAssertLevel                    Option 'debugAssertLevel'                Values:                        Format:
                                    Level of debugging assertions used by    None - No assertions.  This is 'debugAssertLevel', '<value>'
                                    the compiler.                            default.
                                                                             Minimal - Minimal assertions.
                                                                             All - All assertions.

debugPrettyPrintMIR                 Option 'debugPrettyPrintMIR'             Values: { true, false }        Format:
                                    Pretty-print before/after MIR graphs                                    'debugPrettyPrintMIR', '<value>'

debugPrintAnnotatedAsm              Option 'debugPrintAnnotatedAsm'          Values: { true, false }        Format:
                                    Print annotated assembly listing for                                    'debugPrintAnnotatedAsm', '<value>'
                                    generated code

debugPrintBytecodes                 Option 'debugPrintBytecodes'             Values: { true, false }        Format:
                                    Print the input bytecodes                                               'debugPrintBytecodes', '<value>'

debugPrintClonedMIR                 Option 'debugPrintClonedMIR'             Values: { true, false }        Format:
                                    Print Cloned MIR.                                                       'debugPrintClonedMIR', '<value>'

debugPrintGCMap                     Option 'debugPrintGCMap'                 Values: { true, false }        Format:
                                    Print the GC Map                                                        'debugPrintGCMap', '<value>'

debugPrintHeapSSAAfterRepairSSA     Option 'debugPrintHeapSSAAfterRepairSSA' Values: { true, false }        Format:
                                    Print Heap-SSA after repair-SSA.                                        'debugPrintHeapSSAAfterRepairSSA',
                                                                                                            '<value>'

debugPrintHeapSSAAfterToSSA         Option 'debugPrintHeapSSAAfterToSSA'     Values: { true, false }        Format:
                                    Print Heap-SSA after SSA conversion.                                    'debugPrintHeapSSAAfterToSSA', '<value>'


debugPrintHeapSSABeforeLSE          Option 'debugPrintHeapSSABeforeLSE'      Values: { true, false }        Format:
                                    Print HeapSSA before Load-Store                                         'debugPrintHeapSSABeforeLSE', '<value>'
                                    Elimination.

debugPrintLIRAfterToLIR             Option 'debugPrintLIRAfterToLIR'         Values: { true, false }        Format:
                                    Print LIR after doing MIR-to-LIR                                        'debugPrintLIRAfterToLIR', '<value>'
                                    conversion.

debugPrintLIRPseudoBlocks           Option 'debugPrintLIRPseudoBlocks'       Values: { true, false }        Format:
                                    Print LIR pseudo blocks when printing                                   'debugPrintLIRPseudoBlocks', '<value>'
                                    LIR.

debugPrintLSEIPLattice              Option 'debugPrintLSEIPLattice'          Values: { true, false }        Format:
                                    Print Load-Store Elimination                                            'debugPrintLSEIPLattice', '<value>'
                                    Index-propagation Lattice.

debugPrintMIRAfterABCD              Option 'debugPrintMIRAfterABCD'          Values: { true, false }        Format:
                                    Print MIR after Array Bounds-Check                                      'debugPrintMIRAfterABCD', '<value>'
                                    removal.

debugPrintMIRAfterBranchSimplificat Option                                   Values: { true, false }        Format:
ion                                 'debugPrintMIRAfterBranchSimplification'                                'debugPrintMIRAfterBranchSimplification'
                                    Print MIR after Branch Simplification.                                  , '<value>'

debugPrintMIRAfterCFGDiamond        Option 'debugPrintMIRAfterCFGDiamond'    Values: { true, false }        Format:
                                    Print MIR after CFG Diamond Analysis.                                   'debugPrintMIRAfterCFGDiamond',
                                                                                                            '<value>'

debugPrintMIRAfterFromSSA           Option 'debugPrintMIRAfterFromSSA'       Values: { true, false }        Format:
                                    Print MIR after converting out of SSA.                                  'debugPrintMIRAfterFromSSA', '<value>'

debugPrintMIRAfterInlining          Option 'debugPrintMIRAfterInlining'      Values: { true, false }        Format:
                                    Print MIR after Method Inlining.                                        'debugPrintMIRAfterInlining', '<value>'

debugPrintMIRAfterLSE               Option 'debugPrintMIRAfterLSE'           Values: { true, false }        Format:
                                    Print MIR after Load-Store Elimination.                                 'debugPrintMIRAfterLSE', '<value>'

debugPrintMIRAfterLoopOpts          Option 'debugPrintMIRAfterLoopOpts'      Values: { true, false }        Format:
                                    Print MIR after Loop Optimizations.                                     'debugPrintMIRAfterLoopOpts', '<value>'

debugPrintMIRAfterOSDTransformation Option                                   Values: { true, false }        Format:
                                    'debugPrintMIRAfterOSDTransformation'                                   'debugPrintMIRAfterOSDTransformation',
                                    Print MIR after doing platform-specific                                 '<value>'
                                    transformation.

debugPrintMIRAfterRepairSSA         Option 'debugPrintMIRAfterRepairSSA'     Values: { true, false }        Format:
                                    Print MIR after repair-SSA.                                             'debugPrintMIRAfterRepairSSA', '<value>'


debugPrintMIRAfterToSSA             Option 'debugPrintMIRAfterToSSA'         Values: { true, false }        Format:
                                    Print MIR after SSA conversion.                                         'debugPrintMIRAfterToSSA', '<value>'

debugPrintMIRAfterTraceProfiles     Option 'debugPrintMIRAfterTraceProfiles' Values: { true, false }        Format:
                                    Print MIR after doing TraceProfile                                      'debugPrintMIRAfterTraceProfiles',
                                    analysis.                                                               '<value>'

debugPrintMIRAfterUnfactor          Option 'debugPrintMIRAfterUnfactor'      Values: { true, false }        Format:
                                    Print MIR after unfactorization.                                        'debugPrintMIRAfterUnfactor', '<value>'

debugPrintMIRBeforeABCD             Option 'debugPrintMIRBeforeABCD'         Values: { true, false }        Format:
                                    Print MIR before Array Bounds-Check                                     'debugPrintMIRBeforeABCD', '<value>'
                                    removal.

debugPrintMIRBeforeBranchSimplifica Option                                   Values: { true, false }        Format:
tion                                'debugPrintMIRBeforeBranchSimplification                                'debugPrintMIRBeforeBranchSimplification
                                    '                                                                       ', '<value>'
                                    Print MIR before Branch Simplification.

debugPrintMIRBeforeCFGDiamond       Option 'debugPrintMIRBeforeCFGDiamond'   Values: { true, false }        Format:
                                    Print MIR before CFG Diamond Analysis.                                  'debugPrintMIRBeforeCFGDiamond',
                                                                                                            '<value>'

debugPrintMIRBeforeFromSSA          Option 'debugPrintMIRBeforeFromSSA'      Values: { true, false }        Format:
                                    Print MIR before converting out of SSA.                                 'debugPrintMIRBeforeFromSSA', '<value>'

debugPrintMIRBeforeGVN              Option 'debugPrintMIRBeforeGVN'          Values: { true, false }        Format:
                                    Print MIR before GlobalValueNumbering.                                  'debugPrintMIRBeforeGVN', '<value>'

debugPrintMIRBeforeInlining         Option 'debugPrintMIRBeforeInlining'     Values: { true, false }        Format:
                                    Print MIR before Method Inlining.                                       'debugPrintMIRBeforeInlining', '<value>'


debugPrintMIRBeforeLSE              Option 'debugPrintMIRBeforeLSE'          Values: { true, false }        Format:
                                    Print MIR before Load-Store Elimination.                                'debugPrintMIRBeforeLSE', '<value>'

debugPrintMIRBeforeLoopOpts         Option 'debugPrintMIRBeforeLoopOpts'     Values: { true, false }        Format:
                                    Print MIR before Loop Optimizations.                                    'debugPrintMIRBeforeLoopOpts', '<value>'


debugPrintMIRBeforeOSDTransformatio Option                                   Values: { true, false }        Format:
n                                   'debugPrintMIRBeforeOSDTransformation'                                  'debugPrintMIRBeforeOSDTransformation',
                                    Print MIR before doing platform-specific                                '<value>'
                                    transformation.

debugPrintMIRBeforeRepairSSA        Option 'debugPrintMIRBeforeRepairSSA'    Values: { true, false }        Format:
                                    Print MIR before repair-SSA.                                            'debugPrintMIRBeforeRepairSSA',
                                                                                                            '<value>'

debugPrintMIRBeforeToSSA            Option 'debugPrintMIRBeforeToSSA'        Values: { true, false }        Format:
                                    Print MIR before SSA conversion.                                        'debugPrintMIRBeforeToSSA', '<value>'

debugPrintMIRBeforeTraceProfiles    Option                                   Values: { true, false }        Format:
                                    'debugPrintMIRBeforeTraceProfiles'                                      'debugPrintMIRBeforeTraceProfiles',
                                    Print MIR before doing TraceProfile                                     '<value>'
                                    analysis.

debugPrintMIRBeforeUnfactor         Option 'debugPrintMIRBeforeUnfactor'     Values: { true, false }        Format:
                                    Print MIR before unfactorization.                                       'debugPrintMIRBeforeUnfactor', '<value>'


debugTraceDataFlowSolver            Option 'debugTraceDataFlowSolver'        Values: { true, false }        Format:
                                    Trace the dataflow solver                                               'debugTraceDataFlowSolver', '<value>'

debugTraceLevel                     Option 'debugTraceLevel'                 Values:                        Format:
                                    Level of debugging trace used by the     None - No debugging.  This is  'debugTraceLevel', '<value>'
                                    compiler.                                default.
                                                                             Minimal - Minimal debugging.
                                                                             OptimizationsSummary - Minimal
                                                                             debugging and summarize
                                                                             optimizer decisions.
                                                                             OptimizationsDetail - Minimal
                                                                             debugging and detail optimizer
                                                                             decisions.
                                                                             Verbose - Verbose debugging.
                                                                             All - All debugging.

exclude                             Option 'exclude'                                                        Format:
                                    Exclude method from compilation.                                        'exclude', 'java.util.Hashtable'
                                                                                                            'exclude',
                                                                                                            'java.util.Hashtable.get(java.lang.Objec
                                                                                                            t)'
                                                                                                            'exclude',
                                                                                                            'java.util.Hashtable.get(java.lang.Objec
                                                                                                            t) return java.lang.Object'
                                                                                                            'exclude',
                                                                                                            'java/util/Hashtable.get(Ljava/lang/Obje
                                                                                                            ct;)Ljava/lang/Object;
                                                                                                            Java Virtual-Machine Specification style
                                                                                                            method signatures,
                                                                                                            javap-style method signatures and
                                                                                                            call-spec style method signatures are
                                                                                                            all
                                                                                                            accepted.
                                                                                                            If no method name/signature is given,
                                                                                                            all methods in the indicated class
                                                                                                            will be excluded

optimizerAnnotationConstraints      Option 'optimizerAnnotationConstraints'  Values: { true, false }        Format:
                                    Enable annotated class constraints.                                     'optimizerAnnotationConstraints',
                                                                                                            '<value>'

optimizerBatchWKExceptions          Option 'optimizerBatchWKExceptions'      Values: { true, false }        Format:
                                    Enable batching of well-known (implicit)                                'optimizerBatchWKExceptions', '<value>'
                                    exception throws.

optimizerBoundsCheckRemoval         Option 'optimizerBoundsCheckRemoval'     Values: { true, false }        Format:
                                    Enable array bounds-check removal                                       'optimizerBoundsCheckRemoval', '<value>'
                                    optimization.

optimizerBoundsCheckRemovalSubtract Option                                   Values: { true, false }        Format:
ionVertices                         'optimizerBoundsCheckRemovalSubtractionV                                'optimizerBoundsCheckRemovalSubtractionV
                                    ertices'                                                                ertices', '<value>'
                                    Enable subtraction vertices in array
                                    bounds-check removal.

optimizerBranchElimination          Option 'optimizerBranchElimination'      Values: { true, false }        Format:
                                    Enable branch-elimination optimization.                                 'optimizerBranchElimination', '<value>'

optimizerBranchSimplification       Option 'optimizerBranchSimplification'   Values: { true, false }        Format:
                                    Enable branch-simplification                                            'optimizerBranchSimplification',
                                    optimization.                                                           '<value>'

optimizerCombineDivMod              Option 'optimizerCombineDivMod'          Values: { true, false }        Format:
                                    Enable combination of div and mod                                       'optimizerCombineDivMod', '<value>'
                                    operations.

optimizerCommonSubexpressionElimina Option                                   Values: { true, false }        Format:
tion                                'optimizerCommonSubexpressionElimination                                'optimizerCommonSubexpressionElimination
                                    '                                                                       ', '<value>'
                                    Enable common-subexpression elimination
                                    optimization.

optimizerConditionalMoves           Option 'optimizerConditionalMoves'       Values: { true, false }        Format:
                                    Enable analysis of CFG diamonds                                         'optimizerConditionalMoves', '<value>'
                                    (conditional move optimization).

optimizerConstantFolding            Option 'optimizerConstantFolding'        Values: { true, false }        Format:
                                    Enable constant-folding optimization.                                   'optimizerConstantFolding', '<value>'

optimizerCopyPropagation            Option 'optimizerCopyPropagation'        Values: { true, false }        Format:
                                    Enable copy-propagation optimization.                                   'optimizerCopyPropagation', '<value>'

optimizerDeadCodeElimination        Option 'optimizerDeadCodeElimination'    Values: { true, false }        Format:
                                    Enable dead-code elimination                                            'optimizerDeadCodeElimination',
                                    optimization.                                                           '<value>'

optimizerEagerlyCompileForInlining  Option                                   Values: { true, false }        Format:
                                    'optimizerEagerlyCompileForInlining'                                    'optimizerEagerlyCompileForInlining',
                                    Enable eager inlining-driven                                            '<value>'
                                    compilation.

optimizerExceptionTraceHandling     Option 'optimizerExceptionTraceHandling' Values: { true, false }        Format:
                                    Enable analysis of exception-trace                                      'optimizerExceptionTraceHandling',
                                    usages to suppress unnecessary                                          '<value>'
                                    backtraces.

optimizerHnumConditionalMethodInlin Option                                   Values: { true, false }        Format:
ing                                 'optimizerHnumConditionalMethodInlining'                                'optimizerHnumConditionalMethodInlining'
                                    Enable hierarchy-number conditional                                     , '<value>'
                                    method-inlining.

optimizerInlineExceptionalMethods   Option                                   Values: { true, false }        Format:
                                    'optimizerInlineExceptionalMethods'                                     'optimizerInlineExceptionalMethods',
                                    Enable inlining of methods that may                                     '<value>'
                                    potentially throw exceptions.

optimizerInlineExternalMethods      Option 'optimizerInlineExternalMethods'  Values: { true, false }        Format:
                                    Enable inlining of methods from other                                   'optimizerInlineExternalMethods',
                                    classes.                                                                '<value>'

optimizerInlineInternedStrings      Option 'optimizerInlineInternedStrings'  Values: { true, false }        Format:
                                    Enable inlining of pointers to interned                                 'optimizerInlineInternedStrings',
                                    strings.                                                                '<value>'

optimizerInlineNonLeafMethods       Option 'optimizerInlineNonLeafMethods'   Values: { true, false }        Format:
                                    Enable inlining of methods that are not                                 'optimizerInlineNonLeafMethods',
                                    leaf methods.                                                           '<value>'

optimizerLoadStoreElimination       Option 'optimizerLoadStoreElimination'   Values: { true, false }        Format:
                                    Enable load-store elimination                                           'optimizerLoadStoreElimination',
                                    optimization.                                                           '<value>'

optimizerLoopLICMOptimization       Option 'optimizerLoopLICMOptimization'   Values: { true, false }        Format:
                                    Enable loop LICM optimization.                                          'optimizerLoopLICMOptimization',
                                                                                                            '<value>'

optimizerLoopPagedConversion        Option 'optimizerLoopPagedConversion'    Values: { true, false }        Format:
                                    Enable paged loop conversion.                                           'optimizerLoopPagedConversion',
                                                                                                            '<value>'

optimizerLoopUnrollOptimization     Option 'optimizerLoopUnrollOptimization' Values: { true, false }        Format:
                                    Enable loop Unroll optimization.                                        'optimizerLoopUnrollOptimization',
                                                                                                            '<value>'

optimizerMethodInlining             Option 'optimizerMethodInlining'         Values: { true, false }        Format:
                                    Enable method-inlining.                                                 'optimizerMethodInlining', '<value>'

optimizerOperationCombining         Option 'optimizerOperationCombining'     Values: { true, false }        Format:
                                    Enable combining of intermediate                                        'optimizerOperationCombining', '<value>'
                                    representation operations

optimizerPartialRedundancyEliminati Option                                   Values: { true, false }        Format:
on                                  'optimizerPartialRedundancyElimination'                                 'optimizerPartialRedundancyElimination',
                                    Enable partial redundancy elimination                                   '<value>'
                                    optimization.

optimizerSlowpathsOOL               Option 'optimizerSlowpathsOOL'           Values: { true, false }        Format:
                                    Enable out-of-line generation of                                        'optimizerSlowpathsOOL', '<value>'
                                    slow-paths for implicit checks.

optimizerStrengthReduction          Option 'optimizerStrengthReduction'      Values: { true, false }        Format:
                                    Enable strength-reduction optimizations.                                'optimizerStrengthReduction', '<value>'

optimizerThrowConversion            Option 'optimizerThrowConversion'        Values: { true, false }        Format:
                                    Enable conversion of local exception                                    'optimizerThrowConversion', '<value>'
                                    throws to local jumps.

optimizerTypePropagation            Option 'optimizerTypePropagation'        Values: { true, false }        Format:
                                    Enable type-propagation.                                                'optimizerTypePropagation', '<value>'

optimizerUseAclintCache             Option 'optimizerUseAclintCache'         Values: { true, false }        Format:
                                    Enable use of aclint-cache.                                             'optimizerUseAclintCache', '<value>'

optimizerUseFastcalls               Option 'optimizerUseFastcalls'           Values: { true, false }        Format:
                                    Enable use of fastcalls when available.                                 'optimizerUseFastcalls', '<value>'

optimizerWellKnownMethods           Option 'optimizerWellKnownMethods'       Values: { true, false }        Format:
                                    Enable substitution of well-known method                                'optimizerWellKnownMethods', '<value>'
                                    implementations.

regallocCoalesceSpillLoadsStores    Option                                   Values: { true, false }        Format:
                                    'regallocCoalesceSpillLoadsStores'                                      'regallocCoalesceSpillLoadsStores',
                                    Enable register allocator to                                            '<value>'
                                    aggressively coalesce spill loads and
                                    stores.

regallocGenerateGCMaps              Option 'regallocGenerateGCMaps'          Values: { true, false }        Format:
                                    Enable register allocator to generate GC                                'regallocGenerateGCMaps', '<value>'
                                    maps for precise GC.

regallocPartitionRegisters          Option 'regallocPartitionRegisters'      Values: { true, false }        Format:
                                    Register allocator should partition                                     'regallocPartitionRegisters', '<value>'
                                    registers according to whether or not
                                    live-ranges span callsites.

scheduleInstructions                Option 'scheduleInstructions'            Values: { true, false }        Format:
                                    Enable instruction scheduler.                                           'scheduleInstructions', '<value>'


79 rows selected.

As you can see, some of the options look almost self-explanatory, like optimizerMethodInlining, some of them are cryptic. Well, that’s how it is. The most useful, I think, is exclude option which can be used to disable native compilation on a per-method basis. I haven’t tried it though, so, please use it carefully on your own risk.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s