ディレクティブの理解
次のトピックでは、ディレクティブの動作と相互作用について確認します。
デフォルト・ディレクティブとは
デフォルト・ディレクティブは、すべての可能なディレクティブ・オプションのデフォルト値が含まれるコンパイラ・ディレクティブです。ディレクティブ・スタックの最下部にあり、コンパイルに送信される各メソッドに一致します。
新規コンパイラ・ディレクティブを設計する際、新規ディレクティブがデフォルト・ディレクティブとどのように異なるかを指定します。デフォルト・ディレクティブは、設計上の判断を導くためのテンプレートになります。
デフォルト・ディレクティブのディレクティブ・オプション値
Directive: (default)
 matching: *.*
 c1 directives:
  inline: -
  Enable:true Exclude:false BreakAtExecute:false BreakAtCompile:false Log:false PrintAssembly:false PrintInlining:false PrintNMethods:false BackgroundCompilation:true ReplayInline:false DumpReplay:false DumpInline:false CompilerDirectivesIgnoreCompileCommands:false DisableIntrinsic: BlockLayoutByFrequency:true PrintOptoAssembly:false PrintIntrinsics:false TraceOptoPipelining:false TraceOptoOutput:false TraceSpilling:false Vectorize:false VectorizeDebug:0 CloneMapDebug:false IGVPrintLevel:0 MaxNodeLimit:80000
 c2 directives:
  inline: -
  Enable:true Exclude:false BreakAtExecute:false BreakAtCompile:false Log:false PrintAssembly:false PrintInlining:false PrintNMethods:false BackgroundCompilation:true ReplayInline:false DumpReplay:false DumpInline:false CompilerDirectivesIgnoreCompileCommands:false DisableIntrinsic: BlockLayoutByFrequency:true PrintOptoAssembly:false PrintIntrinsics:false TraceOptoPipelining:false TraceOptoOutput:false TraceSpilling:false Vectorize:false VectorizeDebug:0 CloneMapDebug:false IGVPrintLevel:0 MaxNodeLimit:80000
新規ディレクティブのディレクティブ・オプション値
新規ディレクティブでは、そのディレクティブがデフォルト・ディレクティブとどのように異なるかを指定する必要があります。ディレクティブ・オプションを指定しない場合、そのオプションはデフォルト・ディレクティブの値を保持します。
[
    {
        match: ["*Concurrent.*"],
        c2: {
            MaxNodeLimit: 1000,
        },
        Exclude:true,
    },
]Directive:
 matching: *Concurrent.*
 c1 directives:
  inline: -
  Enable:true Exclude:true BreakAtExecute:false BreakAtCompile:false Log:false PrintAssembly:false PrintInlining:false PrintNMethods:false BackgroundCompilation:true ReplayInline:false DumpReplay:false DumpInline:false CompilerDirectivesIgnoreCompileCommands:false DisableIntrinsic: BlockLayoutByFrequency:true PrintOptoAssembly:false PrintIntrinsics:false TraceOptoPipelining:false TraceOptoOutput:false TraceSpilling:false Vectorize:false VectorizeDebug:0 CloneMapDebug:false IGVPrintLevel:0 MaxNodeLimit:80000 
 c2 directives:
  inline: -
  Enable:true Exclude:true BreakAtExecute:false BreakAtCompile:false Log:false PrintAssembly:false PrintInlining:false PrintNMethods:false BackgroundCompilation:true ReplayInline:false DumpReplay:false DumpInline:false CompilerDirectivesIgnoreCompileCommands:false DisableIntrinsic: BlockLayoutByFrequency:true PrintOptoAssembly:false PrintIntrinsics:false TraceOptoPipelining:false TraceOptoOutput:false TraceSpilling:false Vectorize:false VectorizeDebug:0 CloneMapDebug:false IGVPrintLevel:0 MaxNodeLimit:1000 
Directive: (default)
 matching: *.*
 c1 directives:
  inline: -
  Enable:true Exclude:false BreakAtExecute:false BreakAtCompile:false Log:false PrintAssembly:false PrintInlining:false PrintNMethods:false BackgroundCompilation:true ReplayInline:false DumpReplay:false DumpInline:false CompilerDirectivesIgnoreCompileCommands:false DisableIntrinsic: BlockLayoutByFrequency:true PrintOptoAssembly:false PrintIntrinsics:false TraceOptoPipelining:false TraceOptoOutput:false TraceSpilling:false Vectorize:false VectorizeDebug:0 CloneMapDebug:false IGVPrintLevel:0 MaxNodeLimit:80000 
 c2 directives:
  inline: -
  Enable:true Exclude:false BreakAtExecute:false BreakAtCompile:false Log:false PrintAssembly:false PrintInlining:false PrintNMethods:false BackgroundCompilation:true ReplayInline:false DumpReplay:false DumpInline:false CompilerDirectivesIgnoreCompileCommands:false DisableIntrinsic: BlockLayoutByFrequency:true PrintOptoAssembly:false PrintIntrinsics:false TraceOptoPipelining:false TraceOptoOutput:false TraceSpilling:false Vectorize:false VectorizeDebug:0 CloneMapDebug:false IGVPrintLevel:0 MaxNodeLimit:80000 コードへのディレクティブの適用
ディレクティブは、メソッド照合プロセスに基づいてコードに適用されます。コンパイルのために送信された各メソッドは、ディレクティブ・スタック内のディレクティブと照合されます。
メソッドとディレクティブ・スタック内のディレクティブとの照合を行うプロセスは、CompilerBrokerによって実行されます。
メソッド照合プロセス
メソッドがコンパイルのために送信されると、そのメソッドの完全修飾名がディレクティブ・スタックの一致基準と比較されます。スタック内の最初の一致ディレクティブがメソッドに適用されます。スタック内の残りのディレクティブは無視されます。一致が見つからない場合は、デフォルト・ディレクティブが適用されます。
このプロセスは、コンパイルにおいてすべてのメソッドに対して繰り返されます。コンパイルでは複数のディレクティブが適用される場合がありますが、各メソッドには1つのディレクティブのみが適用されます。スタック内のすべてのディレクティブは潜在的に適用可能であるため、アクティブであるとみなされます。アクティブなディレクティブと適用されたディレクティブの主な違いは次のとおりです。
- 
                           ディレクティブがディレクティブ・スタックに存在する場合、そのディレクティブはアクティブです。 
- 
                           ディレクティブがコードに影響を及ぼしている場合、そのディレクティブは適用されています。 
例2-1 一致が見つかった場合
public int exampleMethod(int x){
	return x;
}Directive 2が適用されます。Directive 2:
 matching: *.*example*
Directive 1:
 matching: *.*exampleMethod*
Directive 0: (default)
 matching: *.*例2-2 一致が見つからない場合
public int otherMethod(int y){
	return y;
}Directive 0 (デフォルト・ディレクティブ)が適用されます。Directive 2:
 matching: *.*example*
Directive 1:
 matching: *.*exampleMethod*
Directive 0: (default)
 matching: *.*新規ディレクティブの記述に関するガイドライン
- 
                              指定されたメソッドに適用されるディレクティブを検証するフィードバック・メカニズムはありません。かわりに、Java Management Extensions (JMX)などのプロファイラを使用して、適用されたディレクティブの累積的な影響を測定できます。 
- 
                              CompilerBrokerは、不正なコード(対応していないプラットフォームのハードウェアに命令を強制するなど)を作成するディレクティブ・オプションを無視します。警告メッセージが表示されます。 
- 
                              ディレクティブ・オプションには、一般的なコマンドライン・フラグと同じ制限があります。たとえば、インライン・コードに対する命令が処理されるのは、中間表現(IR)が大きくなりすぎない場合にかぎられます。 
コンパイラ・コントロールと下位互換性
コンパイラ・コントロール・ディレクティブとともに、CompileCommandおよびコマンドライン・フラグを使用できます。
- 
                           コンパイラ・コントロール 
- 
                           CompileCommand 
- 
                           コマンドライン・フラグ 
- 
                           デフォルト値 
例2-3 コンパイラ・コントロールとCompileCommandの併用
- 
                              コンパイラ・コントロール: - 
                                    Exclude: true
- 
                                    BreakAtExecute: false
 
- 
                                    
- 
                              CompileCommand: - 
                                    BreakAtExecute: true
- 
                                    BreakAtCompile: true
 
- 
                                    
- 
                              デフォルト値: - 
                                    Exclude: false
- 
                                    BreakAtExecute: false
- 
                                    BreakAtCompile: false
- 
                                    Log: false
 
- 
                                    
- 
                              Exclude: true
- 
                              BreakAtExecute: false
- 
                              BreakAtCompile: true
- 
                              Log: false