Begin organizing b3 tests
[WebKit-https.git] / Source / JavaScriptCore / b3 / testb3_1.cpp
1 /*
2  * Copyright (C) 2015-2019 Apple Inc. All rights reserved.
3  *
4  * Redistribution and use in source and binary forms, with or without
5  * modification, are permitted provided that the following conditions
6  * are met:
7  * 1. Redistributions of source code must retain the above copyright
8  *    notice, this list of conditions and the following disclaimer.
9  * 2. Redistributions in binary form must reproduce the above copyright
10  *    notice, this list of conditions and the following disclaimer in the
11  *    documentation and/or other materials provided with the distribution.
12  *
13  * THIS SOFTWARE IS PROVIDED BY APPLE INC. ``AS IS'' AND ANY
14  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
15  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
16  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL APPLE INC. OR
17  * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
18  * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
19  * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
20  * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
21  * OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
22  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
23  * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
24  */
25
26 #include "config.h"
27 #include "testb3.h"
28
29 #if ENABLE(B3_JIT)
30
31 Lock crashLock;
32
33 bool shouldRun(const char* filter, const char* testName)
34 {
35     // FIXME: These tests fail <https://bugs.webkit.org/show_bug.cgi?id=199330>.
36     if (!filter && isARM64()) {
37         for (auto& failingTest : {
38             "testReportUsedRegistersLateUseFollowedByEarlyDefDoesNotMarkUseAsDead",
39             "testNegFloatWithUselessDoubleConversion",
40             "testPinRegisters",
41         }) {
42             if (WTF::findIgnoringASCIICaseWithoutLength(testName, failingTest) != WTF::notFound) {
43                 dataLogLn("*** Warning: Skipping known-bad test: ", testName);
44                 return false;
45             }
46         }
47     }
48     if (!filter && isX86()) {
49         for (auto& failingTest : {
50             "testReportUsedRegistersLateUseFollowedByEarlyDefDoesNotMarkUseAsDead",
51         }) {
52             if (WTF::findIgnoringASCIICaseWithoutLength(testName, failingTest) != WTF::notFound) {
53                 dataLogLn("*** Warning: Skipping known-bad test: ", testName);
54                 return false;
55             }
56         }
57     }
58     return !filter || WTF::findIgnoringASCIICaseWithoutLength(testName, filter) != WTF::notFound;
59 }
60
61 template<typename T>
62 void testRotR(T valueInt, int32_t shift)
63 {
64     Procedure proc;
65     BasicBlock* root = proc.addBlock();
66     
67     Value* value = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
68     if (sizeof(T) == 4)
69         value = root->appendNew<Value>(proc, Trunc, Origin(), value);
70     
71     Value* ammount = root->appendNew<Value>(proc, Trunc, Origin(),
72         root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1));
73     root->appendNewControlValue(proc, Return, Origin(),
74         root->appendNew<Value>(proc, RotR, Origin(), value, ammount));
75     
76     CHECK_EQ(compileAndRun<T>(proc, valueInt, shift), rotateRight(valueInt, shift));
77 }
78
79 template<typename T>
80 void testRotL(T valueInt, int32_t shift)
81 {
82     Procedure proc;
83     BasicBlock* root = proc.addBlock();
84     
85     Value* value = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
86     if (sizeof(T) == 4)
87         value = root->appendNew<Value>(proc, Trunc, Origin(), value);
88     
89     Value* ammount = root->appendNew<Value>(proc, Trunc, Origin(),
90         root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR1));
91     root->appendNewControlValue(proc, Return, Origin(),
92         root->appendNew<Value>(proc, RotL, Origin(), value, ammount));
93     
94     CHECK_EQ(compileAndRun<T>(proc, valueInt, shift), rotateLeft(valueInt, shift));
95 }
96
97
98 template<typename T>
99 void testRotRWithImmShift(T valueInt, int32_t shift)
100 {
101     Procedure proc;
102     BasicBlock* root = proc.addBlock();
103     
104     Value* value = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
105     if (sizeof(T) == 4)
106         value = root->appendNew<Value>(proc, Trunc, Origin(), value);
107     
108     Value* ammount = root->appendIntConstant(proc, Origin(), Int32, shift);
109     root->appendNewControlValue(proc, Return, Origin(),
110         root->appendNew<Value>(proc, RotR, Origin(), value, ammount));
111     
112     CHECK_EQ(compileAndRun<T>(proc, valueInt, shift), rotateRight(valueInt, shift));
113 }
114
115 template<typename T>
116 void testRotLWithImmShift(T valueInt, int32_t shift)
117 {
118     Procedure proc;
119     BasicBlock* root = proc.addBlock();
120     
121     Value* value = root->appendNew<ArgumentRegValue>(proc, Origin(), GPRInfo::argumentGPR0);
122     if (sizeof(T) == 4)
123         value = root->appendNew<Value>(proc, Trunc, Origin(), value);
124     
125     Value* ammount = root->appendIntConstant(proc, Origin(), Int32, shift);
126     root->appendNewControlValue(proc, Return, Origin(),
127         root->appendNew<Value>(proc, RotL, Origin(), value, ammount));
128     
129     CHECK_EQ(compileAndRun<T>(proc, valueInt, shift), rotateLeft(valueInt, shift));
130 }
131
132 template<typename T>
133 void testComputeDivisionMagic(T value, T magicMultiplier, unsigned shift)
134 {
135     DivisionMagic<T> magic = computeDivisionMagic(value);
136     CHECK(magic.magicMultiplier == magicMultiplier);
137     CHECK(magic.shift == shift);
138 }
139
140 void run(const char* filter)
141 {
142     Deque<RefPtr<SharedTask<void()>>> tasks;
143
144     RUN_NOW(testTerminalPatchpointThatNeedsToBeSpilled2());
145     RUN(test42());
146     RUN(testLoad42());
147     RUN(testLoadAcq42());
148     RUN(testLoadOffsetImm9Max());
149     RUN(testLoadOffsetImm9MaxPlusOne());
150     RUN(testLoadOffsetImm9MaxPlusTwo());
151     RUN(testLoadOffsetImm9Min());
152     RUN(testLoadOffsetImm9MinMinusOne());
153     RUN(testLoadOffsetScaledUnsignedImm12Max());
154     RUN(testLoadOffsetScaledUnsignedOverImm12Max());
155     RUN(testArg(43));
156     RUN(testReturnConst64(5));
157     RUN(testReturnConst64(-42));
158     RUN(testReturnVoid());
159
160     RUN_UNARY(testAddTreeArg32, int32Operands());
161     RUN_UNARY(testMulTreeArg32, int32Operands());
162
163     addArgTests(filter, tasks);
164
165     RUN_UNARY(testNegDouble, floatingPointOperands<double>());
166     RUN_UNARY(testNegFloat, floatingPointOperands<float>());
167     RUN_UNARY(testNegFloatWithUselessDoubleConversion, floatingPointOperands<float>());
168
169     addBitTests(filter, tasks);
170
171     RUN(testShlArgs(1, 0));
172     RUN(testShlArgs(1, 1));
173     RUN(testShlArgs(1, 62));
174     RUN(testShlArgs(0xffffffffffffffff, 0));
175     RUN(testShlArgs(0xffffffffffffffff, 1));
176     RUN(testShlArgs(0xffffffffffffffff, 63));
177     RUN(testShlImms(1, 0));
178     RUN(testShlImms(1, 1));
179     RUN(testShlImms(1, 62));
180     RUN(testShlImms(1, 65));
181     RUN(testShlImms(0xffffffffffffffff, 0));
182     RUN(testShlImms(0xffffffffffffffff, 1));
183     RUN(testShlImms(0xffffffffffffffff, 63));
184     RUN(testShlArgImm(1, 0));
185     RUN(testShlArgImm(1, 1));
186     RUN(testShlArgImm(1, 62));
187     RUN(testShlArgImm(1, 65));
188     RUN(testShlArgImm(0xffffffffffffffff, 0));
189     RUN(testShlArgImm(0xffffffffffffffff, 1));
190     RUN(testShlArgImm(0xffffffffffffffff, 63));
191     RUN(testShlSShrArgImm(1, 0));
192     RUN(testShlSShrArgImm(1, 1));
193     RUN(testShlSShrArgImm(1, 62));
194     RUN(testShlSShrArgImm(1, 65));
195     RUN(testShlSShrArgImm(0xffffffffffffffff, 0));
196     RUN(testShlSShrArgImm(0xffffffffffffffff, 1));
197     RUN(testShlSShrArgImm(0xffffffffffffffff, 63));
198     RUN(testShlArg32(2));
199     RUN(testShlArgs32(1, 0));
200     RUN(testShlArgs32(1, 1));
201     RUN(testShlArgs32(1, 62));
202     RUN(testShlImms32(1, 33));
203     RUN(testShlArgs32(0xffffffff, 0));
204     RUN(testShlArgs32(0xffffffff, 1));
205     RUN(testShlArgs32(0xffffffff, 63));
206     RUN(testShlImms32(1, 0));
207     RUN(testShlImms32(1, 1));
208     RUN(testShlImms32(1, 62));
209     RUN(testShlImms32(1, 33));
210     RUN(testShlImms32(0xffffffff, 0));
211     RUN(testShlImms32(0xffffffff, 1));
212     RUN(testShlImms32(0xffffffff, 63));
213     RUN(testShlArgImm32(1, 0));
214     RUN(testShlArgImm32(1, 1));
215     RUN(testShlArgImm32(1, 62));
216     RUN(testShlArgImm32(1, 33));
217     RUN(testShlArgImm32(0xffffffff, 0));
218     RUN(testShlArgImm32(0xffffffff, 1));
219     RUN(testShlArgImm32(0xffffffff, 63));
220     RUN(testShlZShrArgImm32(1, 0));
221     RUN(testShlZShrArgImm32(1, 1));
222     RUN(testShlZShrArgImm32(1, 62));
223     RUN(testShlZShrArgImm32(1, 33));
224     RUN(testShlZShrArgImm32(0xffffffff, 0));
225     RUN(testShlZShrArgImm32(0xffffffff, 1));
226     RUN(testShlZShrArgImm32(0xffffffff, 63));
227
228     addShrTests(filter, tasks);
229
230     RUN_UNARY(testClzArg64, int64Operands());
231     RUN_UNARY(testClzMem64, int64Operands());
232     RUN_UNARY(testClzArg32, int32Operands());
233     RUN_UNARY(testClzMem32, int64Operands());
234
235     RUN_UNARY(testAbsArg, floatingPointOperands<double>());
236     RUN_UNARY(testAbsImm, floatingPointOperands<double>());
237     RUN_UNARY(testAbsMem, floatingPointOperands<double>());
238     RUN_UNARY(testAbsAbsArg, floatingPointOperands<double>());
239     RUN_UNARY(testAbsNegArg, floatingPointOperands<double>());
240     RUN_UNARY(testAbsBitwiseCastArg, floatingPointOperands<double>());
241     RUN_UNARY(testBitwiseCastAbsBitwiseCastArg, floatingPointOperands<double>());
242     RUN_UNARY(testAbsArg, floatingPointOperands<float>());
243     RUN_UNARY(testAbsImm, floatingPointOperands<float>());
244     RUN_UNARY(testAbsMem, floatingPointOperands<float>());
245     RUN_UNARY(testAbsAbsArg, floatingPointOperands<float>());
246     RUN_UNARY(testAbsNegArg, floatingPointOperands<float>());
247     RUN_UNARY(testAbsBitwiseCastArg, floatingPointOperands<float>());
248     RUN_UNARY(testBitwiseCastAbsBitwiseCastArg, floatingPointOperands<float>());
249     RUN_UNARY(testAbsArgWithUselessDoubleConversion, floatingPointOperands<float>());
250     RUN_UNARY(testAbsArgWithEffectfulDoubleConversion, floatingPointOperands<float>());
251
252     RUN_UNARY(testCeilArg, floatingPointOperands<double>());
253     RUN_UNARY(testCeilImm, floatingPointOperands<double>());
254     RUN_UNARY(testCeilMem, floatingPointOperands<double>());
255     RUN_UNARY(testCeilCeilArg, floatingPointOperands<double>());
256     RUN_UNARY(testFloorCeilArg, floatingPointOperands<double>());
257     RUN_UNARY(testCeilIToD64, int64Operands());
258     RUN_UNARY(testCeilIToD32, int32Operands());
259     RUN_UNARY(testCeilArg, floatingPointOperands<float>());
260     RUN_UNARY(testCeilImm, floatingPointOperands<float>());
261     RUN_UNARY(testCeilMem, floatingPointOperands<float>());
262     RUN_UNARY(testCeilCeilArg, floatingPointOperands<float>());
263     RUN_UNARY(testFloorCeilArg, floatingPointOperands<float>());
264     RUN_UNARY(testCeilArgWithUselessDoubleConversion, floatingPointOperands<float>());
265     RUN_UNARY(testCeilArgWithEffectfulDoubleConversion, floatingPointOperands<float>());
266
267     RUN_UNARY(testFloorArg, floatingPointOperands<double>());
268     RUN_UNARY(testFloorImm, floatingPointOperands<double>());
269     RUN_UNARY(testFloorMem, floatingPointOperands<double>());
270     RUN_UNARY(testFloorFloorArg, floatingPointOperands<double>());
271     RUN_UNARY(testCeilFloorArg, floatingPointOperands<double>());
272     RUN_UNARY(testFloorIToD64, int64Operands());
273     RUN_UNARY(testFloorIToD32, int32Operands());
274     RUN_UNARY(testFloorArg, floatingPointOperands<float>());
275     RUN_UNARY(testFloorImm, floatingPointOperands<float>());
276     RUN_UNARY(testFloorMem, floatingPointOperands<float>());
277     RUN_UNARY(testFloorFloorArg, floatingPointOperands<float>());
278     RUN_UNARY(testCeilFloorArg, floatingPointOperands<float>());
279     RUN_UNARY(testFloorArgWithUselessDoubleConversion, floatingPointOperands<float>());
280     RUN_UNARY(testFloorArgWithEffectfulDoubleConversion, floatingPointOperands<float>());
281
282     RUN_UNARY(testSqrtArg, floatingPointOperands<double>());
283     RUN_UNARY(testSqrtImm, floatingPointOperands<double>());
284     RUN_UNARY(testSqrtMem, floatingPointOperands<double>());
285     RUN_UNARY(testSqrtArg, floatingPointOperands<float>());
286     RUN_UNARY(testSqrtImm, floatingPointOperands<float>());
287     RUN_UNARY(testSqrtMem, floatingPointOperands<float>());
288     RUN_UNARY(testSqrtArgWithUselessDoubleConversion, floatingPointOperands<float>());
289     RUN_UNARY(testSqrtArgWithEffectfulDoubleConversion, floatingPointOperands<float>());
290
291     RUN_BINARY(testCompareTwoFloatToDouble, floatingPointOperands<float>(), floatingPointOperands<float>());
292     RUN_BINARY(testCompareOneFloatToDouble, floatingPointOperands<float>(), floatingPointOperands<double>());
293     RUN_BINARY(testCompareFloatToDoubleThroughPhi, floatingPointOperands<float>(), floatingPointOperands<float>());
294     RUN_UNARY(testDoubleToFloatThroughPhi, floatingPointOperands<float>());
295     RUN(testReduceFloatToDoubleValidates());
296     RUN_UNARY(testDoubleProducerPhiToFloatConversion, floatingPointOperands<float>());
297     RUN_UNARY(testDoubleProducerPhiToFloatConversionWithDoubleConsumer, floatingPointOperands<float>());
298     RUN_BINARY(testDoubleProducerPhiWithNonFloatConst, floatingPointOperands<float>(), floatingPointOperands<double>());
299
300     RUN_UNARY(testDoubleArgToInt64BitwiseCast, floatingPointOperands<double>());
301     RUN_UNARY(testDoubleImmToInt64BitwiseCast, floatingPointOperands<double>());
302     RUN_UNARY(testTwoBitwiseCastOnDouble, floatingPointOperands<double>());
303     RUN_UNARY(testBitwiseCastOnDoubleInMemory, floatingPointOperands<double>());
304     RUN_UNARY(testBitwiseCastOnDoubleInMemoryIndexed, floatingPointOperands<double>());
305     RUN_UNARY(testInt64BArgToDoubleBitwiseCast, int64Operands());
306     RUN_UNARY(testInt64BImmToDoubleBitwiseCast, int64Operands());
307     RUN_UNARY(testTwoBitwiseCastOnInt64, int64Operands());
308     RUN_UNARY(testBitwiseCastOnInt64InMemory, int64Operands());
309     RUN_UNARY(testBitwiseCastOnInt64InMemoryIndexed, int64Operands());
310     RUN_UNARY(testFloatImmToInt32BitwiseCast, floatingPointOperands<float>());
311     RUN_UNARY(testBitwiseCastOnFloatInMemory, floatingPointOperands<float>());
312     RUN_UNARY(testInt32BArgToFloatBitwiseCast, int32Operands());
313     RUN_UNARY(testInt32BImmToFloatBitwiseCast, int32Operands());
314     RUN_UNARY(testTwoBitwiseCastOnInt32, int32Operands());
315     RUN_UNARY(testBitwiseCastOnInt32InMemory, int32Operands());
316
317     RUN_UNARY(testConvertDoubleToFloatArg, floatingPointOperands<double>());
318     RUN_UNARY(testConvertDoubleToFloatImm, floatingPointOperands<double>());
319     RUN_UNARY(testConvertDoubleToFloatMem, floatingPointOperands<double>());
320     RUN_UNARY(testConvertFloatToDoubleArg, floatingPointOperands<float>());
321     RUN_UNARY(testConvertFloatToDoubleImm, floatingPointOperands<float>());
322     RUN_UNARY(testConvertFloatToDoubleMem, floatingPointOperands<float>());
323     RUN_UNARY(testConvertDoubleToFloatToDoubleToFloat, floatingPointOperands<double>());
324     RUN_UNARY(testStoreFloat, floatingPointOperands<double>());
325     RUN_UNARY(testStoreDoubleConstantAsFloat, floatingPointOperands<double>());
326     RUN_UNARY(testLoadFloatConvertDoubleConvertFloatStoreFloat, floatingPointOperands<float>());
327     RUN_UNARY(testFroundArg, floatingPointOperands<double>());
328     RUN_UNARY(testFroundMem, floatingPointOperands<double>());
329
330     RUN(testIToD64Arg());
331     RUN(testIToF64Arg());
332     RUN(testIToD32Arg());
333     RUN(testIToF32Arg());
334     RUN(testIToD64Mem());
335     RUN(testIToF64Mem());
336     RUN(testIToD32Mem());
337     RUN(testIToF32Mem());
338     RUN_UNARY(testIToD64Imm, int64Operands());
339     RUN_UNARY(testIToF64Imm, int64Operands());
340     RUN_UNARY(testIToD32Imm, int32Operands());
341     RUN_UNARY(testIToF32Imm, int32Operands());
342     RUN(testIToDReducedToIToF64Arg());
343     RUN(testIToDReducedToIToF32Arg());
344
345     RUN(testStore32(44));
346     RUN(testStoreConstant(49));
347     RUN(testStoreConstantPtr(49));
348     RUN(testStore8Arg());
349     RUN(testStore8Imm());
350     RUN(testStorePartial8BitRegisterOnX86());
351     RUN(testStore16Arg());
352     RUN(testStore16Imm());
353     RUN(testTrunc((static_cast<int64_t>(1) << 40) + 42));
354     RUN(testAdd1(45));
355     RUN(testAdd1Ptr(51));
356     RUN(testAdd1Ptr(static_cast<intptr_t>(0xbaadbeef)));
357     RUN(testNeg32(52));
358     RUN(testNegPtr(53));
359     RUN(testStoreAddLoad32(46));
360     RUN(testStoreRelAddLoadAcq32(46));
361     RUN(testStoreAddLoadImm32(46));
362     RUN(testStoreAddLoad64(4600));
363     RUN(testStoreRelAddLoadAcq64(4600));
364     RUN(testStoreAddLoadImm64(4600));
365     RUN(testStoreAddLoad8(4, Load8Z));
366     RUN(testStoreRelAddLoadAcq8(4, Load8Z));
367     RUN(testStoreRelAddFenceLoadAcq8(4, Load8Z));
368     RUN(testStoreAddLoadImm8(4, Load8Z));
369     RUN(testStoreAddLoad8(4, Load8S));
370     RUN(testStoreRelAddLoadAcq8(4, Load8S));
371     RUN(testStoreAddLoadImm8(4, Load8S));
372     RUN(testStoreAddLoad16(6, Load16Z));
373     RUN(testStoreRelAddLoadAcq16(6, Load16Z));
374     RUN(testStoreAddLoadImm16(6, Load16Z));
375     RUN(testStoreAddLoad16(6, Load16S));
376     RUN(testStoreRelAddLoadAcq16(6, Load16S));
377     RUN(testStoreAddLoadImm16(6, Load16S));
378     RUN(testStoreAddLoad32Index(46));
379     RUN(testStoreAddLoadImm32Index(46));
380     RUN(testStoreAddLoad64Index(4600));
381     RUN(testStoreAddLoadImm64Index(4600));
382     RUN(testStoreAddLoad8Index(4, Load8Z));
383     RUN(testStoreAddLoadImm8Index(4, Load8Z));
384     RUN(testStoreAddLoad8Index(4, Load8S));
385     RUN(testStoreAddLoadImm8Index(4, Load8S));
386     RUN(testStoreAddLoad16Index(6, Load16Z));
387     RUN(testStoreAddLoadImm16Index(6, Load16Z));
388     RUN(testStoreAddLoad16Index(6, Load16S));
389     RUN(testStoreAddLoadImm16Index(6, Load16S));
390     RUN(testStoreSubLoad(46));
391     RUN(testStoreAddLoadInterference(52));
392     RUN(testStoreAddAndLoad(47, 0xffff));
393     RUN(testStoreAddAndLoad(470000, 0xffff));
394     RUN(testStoreNegLoad32(54));
395     RUN(testStoreNegLoadPtr(55));
396     RUN(testAdd1Uncommuted(48));
397     RUN(testLoadOffset());
398     RUN(testLoadOffsetNotConstant());
399     RUN(testLoadOffsetUsingAdd());
400     RUN(testLoadOffsetUsingAddInterference());
401     RUN(testLoadOffsetUsingAddNotConstant());
402     RUN(testLoadAddrShift(0));
403     RUN(testLoadAddrShift(1));
404     RUN(testLoadAddrShift(2));
405     RUN(testLoadAddrShift(3));
406     RUN(testFramePointer());
407     RUN(testOverrideFramePointer());
408     RUN(testStackSlot());
409     RUN(testLoadFromFramePointer());
410     RUN(testStoreLoadStackSlot(50));
411     
412     RUN(testBranch());
413     RUN(testBranchPtr());
414     RUN(testDiamond());
415     RUN(testBranchNotEqual());
416     RUN(testBranchNotEqualCommute());
417     RUN(testBranchNotEqualNotEqual());
418     RUN(testBranchEqual());
419     RUN(testBranchEqualEqual());
420     RUN(testBranchEqualCommute());
421     RUN(testBranchEqualEqual1());
422     RUN_BINARY(testBranchEqualOrUnorderedArgs, floatingPointOperands<double>(), floatingPointOperands<double>());
423     RUN_BINARY(testBranchEqualOrUnorderedArgs, floatingPointOperands<float>(), floatingPointOperands<float>());
424     RUN_BINARY(testBranchNotEqualAndOrderedArgs, floatingPointOperands<double>(), floatingPointOperands<double>());
425     RUN_BINARY(testBranchNotEqualAndOrderedArgs, floatingPointOperands<float>(), floatingPointOperands<float>());
426     RUN_BINARY(testBranchEqualOrUnorderedDoubleArgImm, floatingPointOperands<double>(), floatingPointOperands<double>());
427     RUN_BINARY(testBranchEqualOrUnorderedFloatArgImm, floatingPointOperands<float>(), floatingPointOperands<float>());
428     RUN_BINARY(testBranchEqualOrUnorderedDoubleImms, floatingPointOperands<double>(), floatingPointOperands<double>());
429     RUN_BINARY(testBranchEqualOrUnorderedFloatImms, floatingPointOperands<float>(), floatingPointOperands<float>());
430     RUN_BINARY(testBranchEqualOrUnorderedFloatWithUselessDoubleConversion, floatingPointOperands<float>(), floatingPointOperands<float>());
431     RUN_BINARY(testBranchNotEqualAndOrderedArgs, floatingPointOperands<double>(), floatingPointOperands<double>());
432     RUN_BINARY(testBranchNotEqualAndOrderedArgs, floatingPointOperands<float>(), floatingPointOperands<float>());
433     RUN(testBranchFold(42));
434     RUN(testBranchFold(0));
435     RUN(testDiamondFold(42));
436     RUN(testDiamondFold(0));
437     RUN(testBranchNotEqualFoldPtr(42));
438     RUN(testBranchNotEqualFoldPtr(0));
439     RUN(testBranchEqualFoldPtr(42));
440     RUN(testBranchEqualFoldPtr(0));
441     RUN(testBranchLoadPtr());
442     RUN(testBranchLoad32());
443     RUN(testBranchLoad8S());
444     RUN(testBranchLoad8Z());
445     RUN(testBranchLoad16S());
446     RUN(testBranchLoad16Z());
447     RUN(testBranch8WithLoad8ZIndex());
448
449     RUN(testComplex(64, 128));
450     RUN(testComplex(4, 128));
451     RUN(testComplex(4, 256));
452     RUN(testComplex(4, 384));
453
454     RUN_BINARY(testBranchBitTest32TmpImm, int32Operands(), int32Operands());
455     RUN_BINARY(testBranchBitTest32AddrImm, int32Operands(), int32Operands());
456     RUN_BINARY(testBranchBitTest32TmpTmp, int32Operands(), int32Operands());
457     RUN_BINARY(testBranchBitTest64TmpTmp, int64Operands(), int64Operands());
458     RUN_BINARY(testBranchBitTest64AddrTmp, int64Operands(), int64Operands());
459     RUN_BINARY(testBranchBitTestNegation, int64Operands(), int64Operands());
460     RUN_BINARY(testBranchBitTestNegation2, int64Operands(), int64Operands());
461
462     RUN(testSimplePatchpoint());
463     RUN(testSimplePatchpointWithoutOuputClobbersGPArgs());
464     RUN(testSimplePatchpointWithOuputClobbersGPArgs());
465     RUN(testSimplePatchpointWithoutOuputClobbersFPArgs());
466     RUN(testSimplePatchpointWithOuputClobbersFPArgs());
467     RUN(testPatchpointWithEarlyClobber());
468     RUN(testPatchpointCallArg());
469     RUN(testPatchpointFixedRegister());
470     RUN(testPatchpointAny(ValueRep::WarmAny));
471     RUN(testPatchpointAny(ValueRep::ColdAny));
472     RUN(testPatchpointGPScratch());
473     RUN(testPatchpointFPScratch());
474     RUN(testPatchpointLotsOfLateAnys());
475     RUN(testPatchpointAnyImm(ValueRep::WarmAny));
476     RUN(testPatchpointAnyImm(ValueRep::ColdAny));
477     RUN(testPatchpointAnyImm(ValueRep::LateColdAny));
478     RUN(testPatchpointManyImms());
479     RUN(testPatchpointWithRegisterResult());
480     RUN(testPatchpointWithStackArgumentResult());
481     RUN(testPatchpointWithAnyResult());
482     RUN(testSimpleCheck());
483     RUN(testCheckFalse());
484     RUN(testCheckTrue());
485     RUN(testCheckLessThan());
486     RUN(testCheckMegaCombo());
487     RUN(testCheckTrickyMegaCombo());
488     RUN(testCheckTwoMegaCombos());
489     RUN(testCheckTwoNonRedundantMegaCombos());
490     RUN(testCheckAddImm());
491     RUN(testCheckAddImmCommute());
492     RUN(testCheckAddImmSomeRegister());
493     RUN(testCheckAdd());
494     RUN(testCheckAdd64());
495     RUN(testCheckAddFold(100, 200));
496     RUN(testCheckAddFoldFail(2147483647, 100));
497     RUN(testCheckAddArgumentAliasing64());
498     RUN(testCheckAddArgumentAliasing32());
499     RUN(testCheckAddSelfOverflow64());
500     RUN(testCheckAddSelfOverflow32());
501     RUN(testCheckSubImm());
502     RUN(testCheckSubBadImm());
503     RUN(testCheckSub());
504     RUN(testCheckSub64());
505     RUN(testCheckSubFold(100, 200));
506     RUN(testCheckSubFoldFail(-2147483647, 100));
507     RUN(testCheckNeg());
508     RUN(testCheckNeg64());
509     RUN(testCheckMul());
510     RUN(testCheckMulMemory());
511     RUN(testCheckMul2());
512     RUN(testCheckMul64());
513     RUN(testCheckMulFold(100, 200));
514     RUN(testCheckMulFoldFail(2147483647, 100));
515     RUN(testCheckMulArgumentAliasing64());
516     RUN(testCheckMulArgumentAliasing32());
517
518     RUN_BINARY([](int32_t a, int32_t b) { testCompare(Equal, a, b); }, int64Operands(), int64Operands());
519     RUN_BINARY([](int32_t a, int32_t b) { testCompare(NotEqual, a, b); }, int64Operands(), int64Operands());
520     RUN_BINARY([](int32_t a, int32_t b) { testCompare(LessThan, a, b); }, int64Operands(), int64Operands());
521     RUN_BINARY([](int32_t a, int32_t b) { testCompare(GreaterThan, a, b); }, int64Operands(), int64Operands());
522     RUN_BINARY([](int32_t a, int32_t b) { testCompare(LessEqual, a, b); }, int64Operands(), int64Operands());
523     RUN_BINARY([](int32_t a, int32_t b) { testCompare(GreaterEqual, a, b); }, int64Operands(), int64Operands());
524     RUN_BINARY([](int32_t a, int32_t b) { testCompare(Below, a, b); }, int64Operands(), int64Operands());
525     RUN_BINARY([](int32_t a, int32_t b) { testCompare(Above, a, b); }, int64Operands(), int64Operands());
526     RUN_BINARY([](int32_t a, int32_t b) { testCompare(BelowEqual, a, b); }, int64Operands(), int64Operands());
527     RUN_BINARY([](int32_t a, int32_t b) { testCompare(AboveEqual, a, b); }, int64Operands(), int64Operands());
528     RUN_BINARY([](int32_t a, int32_t b) { testCompare(BitAnd, a, b); }, int64Operands(), int64Operands());
529
530     RUN(testEqualDouble(42, 42, true));
531     RUN(testEqualDouble(0, -0, true));
532     RUN(testEqualDouble(42, 43, false));
533     RUN(testEqualDouble(PNaN, 42, false));
534     RUN(testEqualDouble(42, PNaN, false));
535     RUN(testEqualDouble(PNaN, PNaN, false));
536
537     addLoadTests(filter, tasks);
538
539     RUN(testSpillGP());
540     RUN(testSpillFP());
541
542     RUN(testInt32ToDoublePartialRegisterStall());
543     RUN(testInt32ToDoublePartialRegisterWithoutStall());
544
545     addCallTests(filter, tasks);
546
547     RUN(testLinearScanWithCalleeOnStack());
548
549     RUN(testChillDiv(4, 2, 2));
550     RUN(testChillDiv(1, 0, 0));
551     RUN(testChillDiv(0, 0, 0));
552     RUN(testChillDiv(1, -1, -1));
553     RUN(testChillDiv(-2147483647 - 1, 0, 0));
554     RUN(testChillDiv(-2147483647 - 1, 1, -2147483647 - 1));
555     RUN(testChillDiv(-2147483647 - 1, -1, -2147483647 - 1));
556     RUN(testChillDiv(-2147483647 - 1, 2, -1073741824));
557     RUN(testChillDiv64(4, 2, 2));
558     RUN(testChillDiv64(1, 0, 0));
559     RUN(testChillDiv64(0, 0, 0));
560     RUN(testChillDiv64(1, -1, -1));
561     RUN(testChillDiv64(-9223372036854775807ll - 1, 0, 0));
562     RUN(testChillDiv64(-9223372036854775807ll - 1, 1, -9223372036854775807ll - 1));
563     RUN(testChillDiv64(-9223372036854775807ll - 1, -1, -9223372036854775807ll - 1));
564     RUN(testChillDiv64(-9223372036854775807ll - 1, 2, -4611686018427387904));
565     RUN(testChillDivTwice(4, 2, 6, 2, 5));
566     RUN(testChillDivTwice(4, 0, 6, 2, 3));
567     RUN(testChillDivTwice(4, 2, 6, 0, 2));
568
569     RUN_UNARY(testModArg, int64Operands());
570     RUN_BINARY(testModArgs, int64Operands(), int64Operands());
571     RUN_BINARY(testModImms, int64Operands(), int64Operands());
572     RUN_UNARY(testModArg32, int32Operands());
573     RUN_BINARY(testModArgs32, int32Operands(), int32Operands());
574     RUN_BINARY(testModImms32, int32Operands(), int32Operands());
575     RUN_UNARY(testChillModArg, int64Operands());
576     RUN_BINARY(testChillModArgs, int64Operands(), int64Operands());
577     RUN_BINARY(testChillModImms, int64Operands(), int64Operands());
578     RUN_UNARY(testChillModArg32, int32Operands());
579     RUN_BINARY(testChillModArgs32, int32Operands(), int32Operands());
580     RUN_BINARY(testChillModImms32, int32Operands(), int32Operands());
581
582     RUN(testSwitch(0, 1));
583     RUN(testSwitch(1, 1));
584     RUN(testSwitch(2, 1));
585     RUN(testSwitch(2, 2));
586     RUN(testSwitch(10, 1));
587     RUN(testSwitch(10, 2));
588     RUN(testSwitch(100, 1));
589     RUN(testSwitch(100, 100));
590
591     RUN(testSwitchSameCaseAsDefault());
592
593     RUN(testSwitchChillDiv(0, 1));
594     RUN(testSwitchChillDiv(1, 1));
595     RUN(testSwitchChillDiv(2, 1));
596     RUN(testSwitchChillDiv(2, 2));
597     RUN(testSwitchChillDiv(10, 1));
598     RUN(testSwitchChillDiv(10, 2));
599     RUN(testSwitchChillDiv(100, 1));
600     RUN(testSwitchChillDiv(100, 100));
601
602     RUN(testSwitchTargettingSameBlock());
603     RUN(testSwitchTargettingSameBlockFoldPathConstant());
604
605     RUN(testTrunc(0));
606     RUN(testTrunc(1));
607     RUN(testTrunc(-1));
608     RUN(testTrunc(1000000000000ll));
609     RUN(testTrunc(-1000000000000ll));
610     RUN(testTruncFold(0));
611     RUN(testTruncFold(1));
612     RUN(testTruncFold(-1));
613     RUN(testTruncFold(1000000000000ll));
614     RUN(testTruncFold(-1000000000000ll));
615     
616     RUN(testZExt32(0));
617     RUN(testZExt32(1));
618     RUN(testZExt32(-1));
619     RUN(testZExt32(1000000000ll));
620     RUN(testZExt32(-1000000000ll));
621     RUN(testZExt32Fold(0));
622     RUN(testZExt32Fold(1));
623     RUN(testZExt32Fold(-1));
624     RUN(testZExt32Fold(1000000000ll));
625     RUN(testZExt32Fold(-1000000000ll));
626
627     RUN(testSExt32(0));
628     RUN(testSExt32(1));
629     RUN(testSExt32(-1));
630     RUN(testSExt32(1000000000ll));
631     RUN(testSExt32(-1000000000ll));
632     RUN(testSExt32Fold(0));
633     RUN(testSExt32Fold(1));
634     RUN(testSExt32Fold(-1));
635     RUN(testSExt32Fold(1000000000ll));
636     RUN(testSExt32Fold(-1000000000ll));
637
638     RUN(testTruncZExt32(0));
639     RUN(testTruncZExt32(1));
640     RUN(testTruncZExt32(-1));
641     RUN(testTruncZExt32(1000000000ll));
642     RUN(testTruncZExt32(-1000000000ll));
643     RUN(testTruncSExt32(0));
644     RUN(testTruncSExt32(1));
645     RUN(testTruncSExt32(-1));
646     RUN(testTruncSExt32(1000000000ll));
647     RUN(testTruncSExt32(-1000000000ll));
648
649     addSExtTests(filter, tasks);
650
651     RUN(testBasicSelect());
652     RUN(testSelectTest());
653     RUN(testSelectCompareDouble());
654     RUN_BINARY(testSelectCompareFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
655     RUN_BINARY(testSelectCompareFloatToDouble, floatingPointOperands<float>(), floatingPointOperands<float>());
656     RUN(testSelectDouble());
657     RUN(testSelectDoubleTest());
658     RUN(testSelectDoubleCompareDouble());
659     RUN_BINARY(testSelectDoubleCompareFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
660     RUN_BINARY(testSelectFloatCompareFloat, floatingPointOperands<float>(), floatingPointOperands<float>());
661     RUN(testSelectDoubleCompareDoubleWithAliasing());
662     RUN(testSelectFloatCompareFloatWithAliasing());
663     RUN(testSelectFold(42));
664     RUN(testSelectFold(43));
665     RUN(testSelectInvert());
666     RUN(testCheckSelect());
667     RUN(testCheckSelectCheckSelect());
668     RUN(testCheckSelectAndCSE());
669     RUN_BINARY(testPowDoubleByIntegerLoop, floatingPointOperands<double>(), int64Operands());
670
671     RUN(testTruncOrHigh());
672     RUN(testTruncOrLow());
673     RUN(testBitAndOrHigh());
674     RUN(testBitAndOrLow());
675
676     RUN(testBranch64Equal(0, 0));
677     RUN(testBranch64Equal(1, 1));
678     RUN(testBranch64Equal(-1, -1));
679     RUN(testBranch64Equal(1, -1));
680     RUN(testBranch64Equal(-1, 1));
681     RUN(testBranch64EqualImm(0, 0));
682     RUN(testBranch64EqualImm(1, 1));
683     RUN(testBranch64EqualImm(-1, -1));
684     RUN(testBranch64EqualImm(1, -1));
685     RUN(testBranch64EqualImm(-1, 1));
686     RUN(testBranch64EqualMem(0, 0));
687     RUN(testBranch64EqualMem(1, 1));
688     RUN(testBranch64EqualMem(-1, -1));
689     RUN(testBranch64EqualMem(1, -1));
690     RUN(testBranch64EqualMem(-1, 1));
691     RUN(testBranch64EqualMemImm(0, 0));
692     RUN(testBranch64EqualMemImm(1, 1));
693     RUN(testBranch64EqualMemImm(-1, -1));
694     RUN(testBranch64EqualMemImm(1, -1));
695     RUN(testBranch64EqualMemImm(-1, 1));
696
697     RUN(testStore8Load8Z(0));
698     RUN(testStore8Load8Z(123));
699     RUN(testStore8Load8Z(12345));
700     RUN(testStore8Load8Z(-123));
701
702     RUN(testStore16Load16Z(0));
703     RUN(testStore16Load16Z(123));
704     RUN(testStore16Load16Z(12345));
705     RUN(testStore16Load16Z(12345678));
706     RUN(testStore16Load16Z(-123));
707
708     addSShrShTests(filter, tasks);
709
710     RUN(testCheckMul64SShr());
711
712     RUN_BINARY(testRotR, int32Operands(), int32Operands());
713     RUN_BINARY(testRotR, int64Operands(), int32Operands());
714     RUN_BINARY(testRotL, int32Operands(), int32Operands());
715     RUN_BINARY(testRotL, int64Operands(), int32Operands());
716
717     RUN_BINARY(testRotRWithImmShift, int32Operands(), int32Operands());
718     RUN_BINARY(testRotRWithImmShift, int64Operands(), int32Operands());
719     RUN_BINARY(testRotLWithImmShift, int32Operands(), int32Operands());
720     RUN_BINARY(testRotLWithImmShift, int64Operands(), int32Operands());
721
722     RUN(testComputeDivisionMagic<int32_t>(2, -2147483647, 0));
723     RUN(testTrivialInfiniteLoop());
724     RUN(testFoldPathEqual());
725     
726     RUN(testRShiftSelf32());
727     RUN(testURShiftSelf32());
728     RUN(testLShiftSelf32());
729     RUN(testRShiftSelf64());
730     RUN(testURShiftSelf64());
731     RUN(testLShiftSelf64());
732
733     RUN(testPatchpointDoubleRegs());
734     RUN(testSpillDefSmallerThanUse());
735     RUN(testSpillUseLargerThanDef());
736     RUN(testLateRegister());
737     RUN(testInterpreter());
738     RUN(testReduceStrengthCheckBottomUseInAnotherBlock());
739     RUN(testResetReachabilityDanglingReference());
740     
741     RUN(testEntrySwitchSimple());
742     RUN(testEntrySwitchNoEntrySwitch());
743     RUN(testEntrySwitchWithCommonPaths());
744     RUN(testEntrySwitchWithCommonPathsAndNonTrivialEntrypoint());
745     RUN(testEntrySwitchLoop());
746
747     RUN(testSomeEarlyRegister());
748     RUN(testPatchpointTerminalReturnValue(true));
749     RUN(testPatchpointTerminalReturnValue(false));
750     RUN(testTerminalPatchpointThatNeedsToBeSpilled());
751
752     RUN(testMemoryFence());
753     RUN(testStoreFence());
754     RUN(testLoadFence());
755     RUN(testTrappingLoad());
756     RUN(testTrappingStore());
757     RUN(testTrappingLoadAddStore());
758     RUN(testTrappingLoadDCE());
759     RUN(testTrappingStoreElimination());
760     RUN(testMoveConstants());
761     RUN(testPCOriginMapDoesntInsertNops());
762     RUN(testPinRegisters());
763     RUN(testReduceStrengthReassociation(true));
764     RUN(testReduceStrengthReassociation(false));
765     RUN(testAddShl32());
766     RUN(testAddShl64());
767     RUN(testAddShl65());
768     RUN(testLoadBaseIndexShift2());
769     RUN(testLoadBaseIndexShift32());
770     RUN(testOptimizeMaterialization());
771     RUN(testLICMPure());
772     RUN(testLICMPureSideExits());
773     RUN(testLICMPureWritesPinned());
774     RUN(testLICMPureWrites());
775     RUN(testLICMReadsLocalState());
776     RUN(testLICMReadsPinned());
777     RUN(testLICMReads());
778     RUN(testLICMPureNotBackwardsDominant());
779     RUN(testLICMPureFoiledByChild());
780     RUN(testLICMPureNotBackwardsDominantFoiledByChild());
781     RUN(testLICMExitsSideways());
782     RUN(testLICMWritesLocalState());
783     RUN(testLICMWrites());
784     RUN(testLICMWritesPinned());
785     RUN(testLICMFence());
786     RUN(testLICMControlDependent());
787     RUN(testLICMControlDependentNotBackwardsDominant());
788     RUN(testLICMControlDependentSideExits());
789     RUN(testLICMReadsPinnedWritesPinned());
790     RUN(testLICMReadsWritesDifferentHeaps());
791     RUN(testLICMReadsWritesOverlappingHeaps());
792     RUN(testLICMDefaultCall());
793
794     addAtomicTests(filter, tasks);
795     RUN(testDepend32());
796     RUN(testDepend64());
797
798     RUN(testWasmBoundsCheck(0));
799     RUN(testWasmBoundsCheck(100));
800     RUN(testWasmBoundsCheck(10000));
801     RUN(testWasmBoundsCheck(std::numeric_limits<unsigned>::max() - 5));
802
803     RUN(testWasmAddress());
804     
805     RUN(testFastTLSLoad());
806     RUN(testFastTLSStore());
807
808     RUN(testDoubleLiteralComparison(bitwise_cast<double>(0x8000000000000001ull), bitwise_cast<double>(0x0000000000000000ull)));
809     RUN(testDoubleLiteralComparison(bitwise_cast<double>(0x0000000000000000ull), bitwise_cast<double>(0x8000000000000001ull)));
810     RUN(testDoubleLiteralComparison(125.3144446948241, 125.3144446948242));
811     RUN(testDoubleLiteralComparison(125.3144446948242, 125.3144446948241));
812
813     RUN(testFloatEqualOrUnorderedFolding());
814     RUN(testFloatEqualOrUnorderedFoldingNaN());
815     RUN(testFloatEqualOrUnorderedDontFold());
816     
817     RUN(testShuffleDoesntTrashCalleeSaves());
818     RUN(testDemotePatchpointTerminal());
819
820     RUN(testLoopWithMultipleHeaderEdges());
821
822     RUN(testInfiniteLoopDoesntCauseBadHoisting());
823
824     if (isX86()) {
825         RUN(testBranchBitAndImmFusion(Identity, Int64, 1, Air::BranchTest32, Air::Arg::Tmp));
826         RUN(testBranchBitAndImmFusion(Identity, Int64, 0xff, Air::BranchTest32, Air::Arg::Tmp));
827         RUN(testBranchBitAndImmFusion(Trunc, Int32, 1, Air::BranchTest32, Air::Arg::Tmp));
828         RUN(testBranchBitAndImmFusion(Trunc, Int32, 0xff, Air::BranchTest32, Air::Arg::Tmp));
829         RUN(testBranchBitAndImmFusion(Load8S, Int32, 1, Air::BranchTest8, Air::Arg::Addr));
830         RUN(testBranchBitAndImmFusion(Load8Z, Int32, 1, Air::BranchTest8, Air::Arg::Addr));
831         RUN(testBranchBitAndImmFusion(Load, Int32, 1, Air::BranchTest32, Air::Arg::Addr));
832         RUN(testBranchBitAndImmFusion(Load, Int64, 1, Air::BranchTest32, Air::Arg::Addr));
833         RUN(testX86LeaAddAddShlLeft());
834         RUN(testX86LeaAddAddShlRight());
835         RUN(testX86LeaAddAdd());
836         RUN(testX86LeaAddShlRight());
837         RUN(testX86LeaAddShlLeftScale1());
838         RUN(testX86LeaAddShlLeftScale2());
839         RUN(testX86LeaAddShlLeftScale4());
840         RUN(testX86LeaAddShlLeftScale8());
841     }
842
843     if (isARM64()) {
844         RUN(testTernarySubInstructionSelection(Identity, Int64, Air::Sub64));
845         RUN(testTernarySubInstructionSelection(Trunc, Int32, Air::Sub32));
846     }
847
848     RUN(testReportUsedRegistersLateUseFollowedByEarlyDefDoesNotMarkUseAsDead());
849
850     if (tasks.isEmpty())
851         usage();
852
853     Lock lock;
854
855     Vector<Ref<Thread>> threads;
856     for (unsigned i = filter ? 1 : WTF::numberOfProcessorCores(); i--;) {
857         threads.append(
858             Thread::create(
859                 "testb3 thread",
860                 [&] () {
861                     for (;;) {
862                         RefPtr<SharedTask<void()>> task;
863                         {
864                             LockHolder locker(lock);
865                             if (tasks.isEmpty())
866                                 return;
867                             task = tasks.takeFirst();
868                         }
869
870                         task->run();
871                     }
872                 }));
873     }
874
875     for (auto& thread : threads)
876         thread->waitForCompletion();
877     crashLock.lock();
878     crashLock.unlock();
879 }
880
881 #else // ENABLE(B3_JIT)
882
883 static void run(const char*)
884 {
885     dataLog("B3 JIT is not enabled.\n");
886 }
887
888 #endif // ENABLE(B3_JIT)
889
890 int main(int argc, char** argv)
891 {
892     const char* filter = nullptr;
893     switch (argc) {
894     case 1:
895         break;
896     case 2:
897         filter = argv[1];
898         break;
899     default:
900         usage();
901         break;
902     }
903
904     JSC::initializeThreading();
905     
906     for (unsigned i = 0; i <= 2; ++i) {
907         JSC::Options::defaultB3OptLevel() = i;
908         run(filter);
909     }
910
911     return 0;
912 }
913
914 #if OS(WINDOWS)
915 extern "C" __declspec(dllexport) int WINAPI dllLauncherEntryPoint(int argc, const char* argv[])
916 {
917     return main(argc, const_cast<char**>(argv));
918 }
919 #endif