-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathprocessor.mpl
265 lines (222 loc) · 7.08 KB
/
processor.mpl
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
# Copyright (C) 2021 Matway Burkow
#
# This repository and all its contents belong to Matway Burkow (referred here and below as "the owner").
# The content is for demonstration purposes only.
# It is forbidden to use the content or any part of it for any purpose without explicit permission from the owner.
# By contributing to the repository, contributors acknowledge that ownership of their work transfers to the owner.
"Array" use
"HashTable" use
"Owner" use
"String" use
"control" use
"memory" use
"Block" use
"MplFile" use
"Mref" use
"NameManager" use
"Var" use
"astNodeType" use
"schemas" use
StringArray: [String Array];
DEFAULT_STATIC_LOOP_LENGTH_LIMIT: [64];
DEFAULT_RECURSION_DEPTH_LIMIT: [256];
DEFAULT_PRE_RECURSION_DEPTH_LIMIT: [64];
DEFAULT_TRIPLE_32: ["i386-pc-windows-msvc18.0.0"];
DEFAULT_TRIPLE_64: ["x86_64-pc-windows"];
DEFAULT_DATA_LAYOUT_32: ["e-m:x-p:32:32-i64:64-f80:32-n8:16:32-a:0:32-S32"];
DEFAULT_DATA_LAYOUT_64: ["e-m:w-i64:64-f80:128-n8:16:32:64-S128"];
ProcessorOptions: [{
mainPath: String;
fullLine: String;
beginFunc: String;
endFunc: String;
fileNames: StringArray;
fileTexts: StringArray;
includePaths: StringArray;
hidePrefixes: StringArray;
pointerSize: 64nx dynamic;
staticLiterals: TRUE dynamic;
debug: TRUE dynamic;
debugMemory [
debugMemory: FALSE dynamic;
] [] uif
arrayChecks: TRUE dynamic;
partial: FALSE dynamic;
autoRecursion: FALSE dynamic;
verboseIR: FALSE dynamic;
callTrace: FALSE dynamic;
threadModel: 0 dynamic;
dataLayout: String;
triple: String;
staticLoopLengthLimit: DEFAULT_STATIC_LOOP_LENGTH_LIMIT;
recursionDepthLimit: DEFAULT_RECURSION_DEPTH_LIMIT;
preRecursionDepthLimit: DEFAULT_PRE_RECURSION_DEPTH_LIMIT;
linkerOptions: String Array;
}];
ProcessorErrorInfo: [{
message: String;
missedModule: String;
position: CompilerPositionInfo Array;
}];
ProcessorResult: [{
success: TRUE dynamic;
findModuleFail: FALSE dynamic;
passErrorThroughPRE: FALSE dynamic;
program: String;
errorInfo: ProcessorErrorInfo;
globalErrorInfo: ProcessorErrorInfo Array;
}];
IndexInfo: [{
overload: -1 dynamic;
index: -1 dynamic;
}];
RefToVarTable: [
RefToVar RefToVar HashTable
];
NameInfoEntry: [{
file: File Cref;
object: RefToVar; # for NameCaseSelfMember
refToVar: RefToVar;
startPoint: -1 dynamic; # id of node
mplFieldIndex: -1 dynamic; # for NameCaseSelfMember
isLocal: FALSE dynamic;
nameCase: NameCaseInvalid;
}];
MatchingNodePair: [{
eventHash: Nat32;
childIndex: Int32;
}];
MatchingNodeEntry: [{
nodeIndexes: Int32 Array;
parentIndex: -1 dynamic;
parentEvent: ShadowEvent;
childIndices: MatchingNodePair Array;
}];
MatchingNode: [{
compilerPositionInfo: CompilerPositionInfo;
entries: Int32;
tries: Int32;
size: Int32;
count: Int32;
treeMemory: MatchingNodeEntry Array;
}];
makeWayInfo: [{
currentName: new;
current: new;
prev: new;
}];
WayInfo: [
-1 dynamic -1 dynamic StringView makeWayInfo
];
IRArgument: [{
irTypeId: 0;
irNameId: 0;
byRef: TRUE;
}];
NameInfoCoord: [{
block: ["Block.BlockSchema" use BlockSchema] Mref;
file: ["MplFile.FileSchema" use FileSchema] Mref;
}];
Processor: [{
options: ProcessorOptions;
multiParserResult: MultiParserResult Ref;
result: ProcessorResult;
canBuildTree: TRUE dynamic;
positions: CompilerPositionInfo Array;
unfinishedFiles: Int32 Array;
files: File Owner Array;
fileNameIds: String Int32 HashTable;
cmdFileNameIds: String String HashTable;
exportVarIds: Int32 RefToVar HashTable;
blocks: Block Owner Array;
variables: Variable Array Array;
matchingNodes: MatchingNode Owner Array;
recursiveNodesStack: Int32 Array;
nameManager: NameInfoEntry NameManager;
modules: String Int32 HashTable; # -1 no module, or Id of codeNode
beginFuncIndex: -1 dynamic;
endFuncIndex: -1 dynamic;
captureTable: {
simpleNames: NameInfoCoord Array Array Array; #name; overload; vector of blocks
stableNames: Int32 Array Array; #vector of vector of blockId
};
specialNames: {
emptyNameInfo: -1 dynamic;
callNameInfo: -1 dynamic;
preNameInfo: -1 dynamic;
dieNameInfo: -1 dynamic;
initNameInfo: -1 dynamic;
assignNameInfo: -1 dynamic;
selfNameInfo: -1 dynamic;
closureNameInfo: -1 dynamic;
inputsNameInfo: -1 dynamic;
outputsNameInfo: -1 dynamic;
capturesNameInfo: -1 dynamic;
variadicNameInfo: -1 dynamic;
failProcNameInfo: -1 dynamic;
conventionNameInfo: -1 dynamic;
schemaNameNameInfo: -1 dynamic;
};
funcAliasCount: 0 dynamic;
globalVarCount: 0 dynamic;
globalVarId: 0 dynamic;
globalInitializer: -1 dynamic; # index of func for calling all initializers
varForFails: RefToVar;
varForCallTrace: RefToVar;
globalDestructibleVars: RefToVar Array;
exportDepth: 0 dynamic;
stringNames: String RefToVar HashTable; #for string constants
typeNames: String Int32 HashTable; #mplType->irAliasId
schemaBuffer: VariableSchema Array;
schemaTable: VariableSchema Int32 HashTable;
nameBuffer: String Array;
nameTable: StringView Int32 HashTable; #strings->nameTag; strings from nameBuffer
defaultVarNames: Int32 Array;
depthOfRecursion: 0 dynamic;
maxDepthOfRecursion: 0 dynamic;
depthOfPre: 0 dynamic;
condArray: Cond Array;
irArgumentArray: IRArgument Array;
varRefArrayCount: 0;
varRefArrays: RefToVar Array Array;
acquireVarRefArray: [
varRefArrays.size 0 = [
varRefArrayCount 20 = ["Too many varRef arrays requested\00" failProc] when
varRefArrayCount 1 + !varRefArrayCount
RefToVar Array
] [
@varRefArrays.last new
@varRefArrays.popBack
] if
];
releaseVarRefArray: [
@varRefArrays.append
@varRefArrays.last.clear
];
temporaryBuiltinUseData: {
indexes: Int32 {index: Int32; depth: Int32;} HashTable;
addNameData: {refToVar: RefToVar; nameInfo: Int32; } Array;
};
unfinishedWay: WayInfo Array;
prolog: String Array;
debugInfo: {
strings: String Array;
locationIds: Int32 Int32 HashTable;
lastId: 0 dynamic;
unit: -1 dynamic;
unitStringNumber: -1 dynamic;
cuStringNumber: -1 dynamic;
globals: Int32 Array;
};
lastStringId: 0 dynamic;
lastTypeId: 0 dynamic;
unitId: 0 dynamic; # number of compiling unit
namedFunctions: String Int32 HashTable; # name -> node ID
moduleFunctions: Int32 Array;
dtorFunctions: Int32 Array;
possibleUnstables: Int32 Array Array; #name -> array of blocks
varCount: 0 dynamic;
usedFloatBuiltins: FALSE dynamic;
INIT: [];
DIE: [];
}];