FILENAME 3/4 - delete the old get_fun_path etc.
[hiphop-php.git] / hphp / doc / tcdump_json_schema.ts
blob88259214aa0978425588afeda48007f41af61d4d
1 // Thin types
2 type ArchNameStr = string;   // uncertain of format
3 type BCInstrStr = string;    // uncertain of format
4 type BinaryStr = string;     // uncertain of format, may be arch-dependent
5 type BlockId = number;       // unsigned int
6 type CallDestStr = string;   // uncertain of format
7 type CodeStr = string;       // uncertain of format
8 type CodeLen = number;       // uint32_t
9 type ConfigFileStr = string; // maybe empty, should I make this null if empty?
10 type CounterName = string;   // uncertain of format
11 type DisasmString = string;  // uncertain of format
12 type EventCount = number;    // uint64_t
13 type ExtraString = string;   // uncertain of format
14 type FileName = string;      // uncertain of format
15 type FuncId = number;        // uint32_t
16 type FuncName = string;      // uncertain of format
17 type FuncString = string;    // uncertain of format
18 type GuardString = string;   // uncertain of format
19 type InstrId = number;       // uint32_t
20 type InstrLen = number       // uint32_t
21 type LineNum = number;       // int
22 type Offset = number;        // int32_t
23 type Opcode = string;        // Some sort of enum
24 type OptIndex = number;      // int
25 type ProfCount = number;     // uint64_t
26 type ProfileString = string; // uncertain of format
27 type RepoSchemaStr = string; // uncertain of format
28 type SHA1 = string;          // SHA1.toString()
29 type SSATmpId = number;      // uint32_t
30 type TCA = string;           // unsigned char*, casted to void* for sformat
31 type TransId = number;       // int32_t
32 type TypeString = string;    // uncertain of format
33 type UnitFuncStr = string;   // maybe fix? see TODO in tc-print.cpp
35 type TCDump = {
36   configFile: ConfigFileStr;
37   repoSchema: RepoSchemaStr;
38   translations: [Translation | null];
41 type Translation = {
42   transRec: TransRec;
43   blocks: [Block];
44   archName: ArchNameStr;
45   perfEvents: EventCounts;
46   regions: {
47     main: TCARegionInfo | null;
48     cold: TCARegionInfo | null;
49     frozen: TCARegionInfo | null;
50   };
51   transId: TransId;
52   ir_annotation: PrintIR_Unit | string;
55 type TransRec = {
56   id: TransId;
57   src: TransRecSrc;
58   kind: TransKind;
59   hasLoop: boolean;
60   aStart: TCA;
61   aLen: CodeLen;
62   coldStart: TCA;
63   coldLen: CodeLen;
64   frozenStart: TCA;
65   frozenLen: CodeLen;
68 type TransRecSrc = {
69   sha1: SHA1;
70   funcId: FuncId;
71   funcName: FuncName;
72   resumeMode: ResumeMode;
73   hasThis: boolean;
74   prologue: boolean;
75   bcStartOffset: Offset;
76   guards: [GuardString];
79 enum ResumeMode {
80   None,
81   Async,
82   GenIter,
85 enum TransKind {
86   TransAnchor,
87   TransInterp,
88   TransLive,
89   TransProfile,
90   TransOptimize,
91   TransLivePrologue,
92   TransProfPrologue,
93   TransOptPrologue,
94   TransInvalid,
97 type Block = {
98   sha1: SHA1;
99   start: Offset;
100   end: Offset;
101   unit: UnitFuncStr | null;
104 type EventType =
105 "cycles" |
106 "branch-misses" |
107 "L1-icache-misses" |
108 "L1-dcache-misses" |
109 "cache-misses" |
110 "LLC-store-misses" |
111 "iTLB-misses" |
112 "dTLB-misses" |
113 string; // Technically there can be user-defined events too
115 type EventCounts = {[event in EventType]: EventCount;}
117 type TCARegionInfo = {
118   tcRegion: TCRegion;
119   ranges: [TCARangeInfo];
122 enum TCRegion {
123   hot,
124   main,
125   profile,
126   cold,
127   frozen
130 type TCARangeInfo = {
131   start: TCA;
132   end: TCA;
133   bc: Offset | null;
134   sha1: SHA1 | null;
135   instrStr: BCInstrStr | null;
136   lineNum: LineNum | null;
137   disasm: [TCADisasmInfo];
138   ir_annotation?: {
139     area: Area;
140     start: TCA;
141     end: TCA;
142     instrId: InstrId;
143     blockId: BlockId;
144   };
147 type TCADisasmInfo = {
148   binary: BinaryStr;
149   callDest: CallDestStr;
150   code: CodeStr;
151   perfEvents: EventCounts;
152   ip: TCA;
153   instrLen: InstrLen;
156 enum Area {
157   Main,
158   Cold,
159   Frozen
162 type PrintIR_Unit = {
163   transContext: PrintIR_TransContext;
164   blocks: {[x in string]: PrintIR_Block;};
165   // This is actually a map from BlockId to Block, but with
166   // the BlockIds interpreted as strings for JSON object compatibility
167   inliningDecision: [PrintIR_InliningDecision];
170 type PrintIR_TransContext = {
171   kind: TransKind;
172   id: TransId;
173   optIndex: OptIndex;
174   srcKey: PrintIR_SrcKey;
175   funcName: FuncName;
176   sourceFile: FileName;
177   startLine: LineNum;
178   endLine: LineNum;
181 type PrintIR_SrcKey = {
182   funcStr: FuncString;
183   unitStr: UnitFuncString;
184   prologue: boolean;
185   offset: Offset;
186   resumeMode: ResumeMode;
187   hasThis: boolean;
190 type ResumeMode = "" | "ra" | "rg";
192 type PrintIR_Block = {
193   id: BlockId;
194   isCatch: boolean;
195   hint: Hint;
196   profCount: ProfCount;
197   next: BlockId | null;
198   instrs: {[x in string]: PrintIR_Instr;};
199   // This is actually a map from InstrId to Instr, but with
200   // the InstrIds interpreted as strings for JSON object compatibility
203 enum Hint {
204   Unused,
205   Unlikely,
206   Neither,
207   Likely,
210 type PrintIR_Instr = {
211   rawMarker: FuncString | null;
212   phiPseudoInstrs: [PrintIR_PhiPseudoInstrs];
213   opcode: Opcode;
214   typeParam: TypeString | null;
215   guard: GuardString | null;
216   extra: ExtraString | null;
217   id: InstrId;
218   taken: BlockId | null;
219   tcRanges: [PrintIR_TCRange];
220   dsts: [PrintIR_SSATmp];
221   offset: Offset;
222   profileData: PrintIR_Profile;
223   srcs: [PrintIR_SSATmp] | null;   // exactly one of srcs and counterName should
224   counterName: CounterName | null; // be defined
227 type PrintIR_PhiPseudoInstrs = {
228   srcs: [[PrintIR_SSATmp, BlockId]];
229   dst: PrintIR_SSATmp;
232 type PrintIR_SSATmp = {
233   id: SSATmpId;
234   type: TypeString;
237 type PrintIR_TCRange = {
238   area: Area;
239   start: TCA;
240   end: TCA;
241   disasm: string;
244 type PrintIR_Profile = {
245   offset: Offset;
246   name: ProfileString;
247   data: {profileType: ProfileType};
248   // the rest of the keys in "data" will depend on the value of "profileType"
251 enum ProfileType {
252   ArrayAccessProfile,
253   ArrayKindProfile,
254   CallTargetProfile,
255   ClsCnsProfile,
256   DecRefProfile,
257   IncRefProfile,
258   MethProfile,
259   ReleaseVVProfile,
260   SwitchProfile,
261   TypeProfile,
264 type PrintIR_InliningDecision = {
265   wasInlined: boolean;
266   offset: Offset;
267   callerName: FuncName | null;
268   calleeName: FuncName | null;
269   reason: string;