Skip to content

Commit 6197500

Browse files
authored
[cppia] Upgrade sljit (#1434)
* Upgrade sljit to latest upstream Based on: zherczeg/sljit@39c508d * Replace SLJIT_CALL with SLJIT_FUNC See: zherczeg/sljit@04c7fcc SLJIT_FUNC is empty, but the sljit tutorials still use it so let's keep it. * Remove fastcall from CPPIA_CALL It was added so that cppia functions use the abi expected by sljit, in: 21a2194 sljit no longer uses fastcall on x86-32. See: zherczeg/sljit@a6c8e5b It is still set to empty, because it is set in haxe generated code and this way it matches SLJIT_FUNC * Update sljit_emit_enter call See: zherczeg/sljit@8271de0 zherczeg/sljit@7f0afb2 zherczeg/sljit@c85dd1d * Replace SLJIT_UNUSED See: zherczeg/sljit@43538b8 * Update sljit_generate_code calls See: zherczeg/sljit@40eff81 * Replace SLJIT_CALLx with sljit_emit_[i]call See: zherczeg/sljit@b779a4e * Replace SLJIT_UNORDERED_F64 macros See: zherczeg/sljit@6b95004 * Replace SLJIT_NOT with SLJIT_XOR See: zherczeg/sljit@8b491d0 * Replace SLJIT_NEG with SLJIT_SUB See: zherczeg/sljit@6807c7a * Reapply sljit patch See: b220c1d * Fix regression after sljit upgrade It looks like now sJitTemp0 can get overwritten during the conversion, making the multiplication produce the wrong value. This caused a regression: results: SOME TESTS FAILURES (success: false) cases.TestCommon testStatus: FAILURE F line: 34, expected "ok" but it is "Failed regression test for #926. x: 9" * Clean up if nesting * Mark sljit_src as vendored source
1 parent eeec6e9 commit 6197500

54 files changed

Lines changed: 49603 additions & 25590 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.gitattributes‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
project/thirdparty/*/** linguist-vendored
2+
src/hx/cppia/sljit_src/** linguist-vendored

‎include/hx/Object.h‎

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -39,22 +39,7 @@ HXCPP_EXTERN_CLASS_ATTRIBUTES null BadCast();
3939

4040
#ifdef HXCPP_SCRIPTABLE
4141

42-
// CPPIA_CALL = fastcall on x86(32), nothing otherwise
43-
#if (defined(_WIN32) && !defined(_M_X64) && !defined(__x86_64__) && !defined(_ARM_) ) || \
44-
defined(HXCPP_X86) || defined(__i386__) || defined(__i386) || \
45-
(!defined(_WIN32) && !defined(_ARM_) && !defined(__arm__) && !defined(__aarch64__) && !defined(__x86_64__) )
46-
47-
#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
48-
#define CPPIA_CALL __attribute__ ((fastcall))
49-
#elif defined(_MSC_VER)
50-
#define CPPIA_CALL __fastcall
51-
#endif
52-
#endif
53-
54-
#ifndef CPPIA_CALL
55-
#define CPPIA_CALL
56-
#endif
57-
42+
#define CPPIA_CALL
5843

5944
typedef void (CPPIA_CALL *StackExecute)(struct StackContext *ctx);
6045
struct ScriptFunction

‎src/hx/cppia/ArrayBuiltin.cpp‎

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -88,7 +88,7 @@ CppiaExpr *ArrayBuiltinBase::link(CppiaModule &inData)
8888

8989

9090
#ifdef CPPIA_JIT
91-
static ArrayBase * SLJIT_CALL array_expand_size(ArrayBase *inArray, int inSize)
91+
static ArrayBase * SLJIT_FUNC array_expand_size(ArrayBase *inArray, int inSize)
9292
{
9393
inArray->Realloc(inSize+1);
9494
return inArray;
@@ -170,7 +170,7 @@ struct ArraySetter : public ArrayBuiltinBase
170170

171171
#ifdef CPPIA_JIT
172172

173-
static void * SLJIT_CALL nativeRunInt(JitMultiArg *args)
173+
static void * SLJIT_FUNC nativeRunInt(JitMultiArg *args)
174174
{
175175
Array_obj<ELEM> *thisVal = reinterpret_cast<Array_obj<ELEM> *>(args[0].obj);
176176
ELEM &elem = thisVal->Item( args[1].ival );
@@ -182,7 +182,7 @@ struct ArraySetter : public ArrayBuiltinBase
182182
return &elem;
183183
}
184184

185-
static void * SLJIT_CALL nativeRunFloat(JitMultiArg *args)
185+
static void * SLJIT_FUNC nativeRunFloat(JitMultiArg *args)
186186
{
187187
Array_obj<ELEM> *thisVal = reinterpret_cast<Array_obj<ELEM> *>(args[0].obj);
188188
ELEM &elem = thisVal->Item( args[1].ival );
@@ -194,7 +194,7 @@ struct ArraySetter : public ArrayBuiltinBase
194194
return &elem;
195195
}
196196

197-
static void * SLJIT_CALL nativeRunObject(JitMultiArg *args)
197+
static void * SLJIT_FUNC nativeRunObject(JitMultiArg *args)
198198
{
199199
Array_obj<ELEM> *thisVal = reinterpret_cast<Array_obj<ELEM> *>(args[0].obj);
200200
ELEM &elem = thisVal->Item( args[1].ival );
@@ -207,7 +207,7 @@ struct ArraySetter : public ArrayBuiltinBase
207207
return &elem;
208208
}
209209

210-
static void * SLJIT_CALL nativeRunString(JitMultiArg *args)
210+
static void * SLJIT_FUNC nativeRunString(JitMultiArg *args)
211211
{
212212
Array_obj<ELEM> *thisVal = reinterpret_cast<Array_obj<ELEM> *>(args[0].obj);
213213
ELEM &elem = thisVal->Item( args[1].ival );
@@ -383,7 +383,7 @@ struct ArraySetter : public ArrayBuiltinBase
383383
};
384384

385385
#ifdef CPPIA_JIT
386-
static hx::Object *SLJIT_CALL objGetIndex(hx::Object *inArray, int inIndex)
386+
static hx::Object *SLJIT_FUNC objGetIndex(hx::Object *inArray, int inIndex)
387387
{
388388
return Dynamic(inArray->__GetItem(inIndex)).mPtr;
389389
}
@@ -1027,25 +1027,25 @@ struct ArrayBuiltin : public ArrayBuiltinBase
10271027
}
10281028

10291029
#ifdef CPPIA_JIT
1030-
static ArrayBase * SLJIT_CALL array_expand(ArrayBase *inArray)
1030+
static ArrayBase * SLJIT_FUNC array_expand(ArrayBase *inArray)
10311031
{
10321032
inArray->Realloc( inArray->length + 1 );
10331033
return inArray;
10341034
}
1035-
static void SLJIT_CALL runSort( Array_obj<ELEM> *inArray, hx::Object *inFunc)
1035+
static void SLJIT_FUNC runSort( Array_obj<ELEM> *inArray, hx::Object *inFunc)
10361036
{
10371037
TRY_NATIVE
10381038
inArray->sort( Dynamic(inFunc) );
10391039
CATCH_NATIVE
10401040
}
1041-
static void SLJIT_CALL runJoin( Array_obj<ELEM> *inArray, String *ioValue)
1041+
static void SLJIT_FUNC runJoin( Array_obj<ELEM> *inArray, String *ioValue)
10421042
{
10431043
TRY_NATIVE
10441044
*ioValue = inArray->join( *ioValue );
10451045
CATCH_NATIVE
10461046
}
10471047

1048-
static void SLJIT_CALL runElem( Array_obj<ELEM> *inArray, int inIndex)
1048+
static void SLJIT_FUNC runElem( Array_obj<ELEM> *inArray, int inIndex)
10491049
{
10501050
ELEM &t = Array<ELEM>(inArray)[inIndex];
10511051
CREMENT::run(t);
@@ -1055,7 +1055,7 @@ struct ArrayBuiltin : public ArrayBuiltinBase
10551055
#endif
10561056
}
10571057

1058-
static int SLJIT_CALL runIntCrement( Array_obj<ELEM> *inArray, int inIndex)
1058+
static int SLJIT_FUNC runIntCrement( Array_obj<ELEM> *inArray, int inIndex)
10591059
{
10601060
ELEM &t = Array<ELEM>(inArray)[inIndex];
10611061
int result = ValToInt( CREMENT::run(t) );
@@ -1066,7 +1066,7 @@ struct ArrayBuiltin : public ArrayBuiltinBase
10661066
return result;
10671067
}
10681068

1069-
static void SLJIT_CALL runFloatCrement( Array_obj<ELEM> *inArray, int inIndex, double *d)
1069+
static void SLJIT_FUNC runFloatCrement( Array_obj<ELEM> *inArray, int inIndex, double *d)
10701070
{
10711071
ELEM &t = Array<ELEM>(inArray)[inIndex];
10721072
*d = ValToFloat( CREMENT::run(t) );
@@ -1077,7 +1077,7 @@ struct ArrayBuiltin : public ArrayBuiltinBase
10771077

10781078
}
10791079

1080-
static hx::Object * SLJIT_CALL runObjCrement( Array_obj<ELEM> *inArray, int inIndex)
1080+
static hx::Object * SLJIT_FUNC runObjCrement( Array_obj<ELEM> *inArray, int inIndex)
10811081
{
10821082
ELEM &t = Array<ELEM>(inArray)[inIndex];
10831083
Dynamic result( CREMENT::run(t) );
@@ -1088,102 +1088,102 @@ struct ArrayBuiltin : public ArrayBuiltinBase
10881088
return result.mPtr;
10891089
}
10901090

1091-
static int SLJIT_CALL runContains( Array_obj<ELEM> *inArray, typename ExprBaseTypeOf<ELEM>::Base inBase)
1091+
static int SLJIT_FUNC runContains( Array_obj<ELEM> *inArray, typename ExprBaseTypeOf<ELEM>::Base inBase)
10921092
{
10931093
return inArray->contains(inBase);
10941094
}
10951095

1096-
static int SLJIT_CALL runRemove( Array_obj<ELEM> *inArray, typename ExprBaseTypeOf<ELEM>::Base inBase)
1096+
static int SLJIT_FUNC runRemove( Array_obj<ELEM> *inArray, typename ExprBaseTypeOf<ELEM>::Base inBase)
10971097
{
10981098
return inArray->remove(inBase);
10991099
}
11001100

11011101

1102-
static void SLJIT_CALL runUnshift( Array_obj<ELEM> *inArray, typename ExprBaseTypeOf<ELEM>::Base inBase)
1102+
static void SLJIT_FUNC runUnshift( Array_obj<ELEM> *inArray, typename ExprBaseTypeOf<ELEM>::Base inBase)
11031103
{
11041104
inArray->unshift(inBase);
11051105
}
11061106

11071107

1108-
static int SLJIT_CALL runIndex( Array_obj<ELEM> *inArray, typename ExprBaseTypeOf<ELEM>::Base inBase, hx::Object *pos)
1108+
static int SLJIT_FUNC runIndex( Array_obj<ELEM> *inArray, typename ExprBaseTypeOf<ELEM>::Base inBase, hx::Object *pos)
11091109
{
11101110
if (FUNC==afIndexOf)
11111111
return inArray->indexOf(inBase,pos);
11121112
else
11131113
return inArray->lastIndexOf(inBase,pos);
11141114
}
11151115

1116-
static void SLJIT_CALL runInsert( Array_obj<ELEM> *inArray, int pos, typename ExprBaseTypeOf<ELEM>::Base inBase)
1116+
static void SLJIT_FUNC runInsert( Array_obj<ELEM> *inArray, int pos, typename ExprBaseTypeOf<ELEM>::Base inBase)
11171117
{
11181118
inArray->insert(pos, inBase);
11191119
}
11201120

11211121
// TODO - string
1122-
static hx::Object * SLJIT_CALL runShift( Array_obj<ELEM> *inArray )
1122+
static hx::Object * SLJIT_FUNC runShift( Array_obj<ELEM> *inArray )
11231123
{
11241124
return Dynamic(inArray->shift()).mPtr;
11251125
}
11261126

1127-
static hx::Object * SLJIT_CALL runSlice( Array_obj<ELEM> *inArray, int pos, hx::Object *end )
1127+
static hx::Object * SLJIT_FUNC runSlice( Array_obj<ELEM> *inArray, int pos, hx::Object *end )
11281128
{
11291129
return inArray->slice(pos, end).mPtr;
11301130
}
11311131

1132-
static hx::Object * SLJIT_CALL runSplice( Array_obj<ELEM> *inArray, int pos, int len )
1132+
static hx::Object * SLJIT_FUNC runSplice( Array_obj<ELEM> *inArray, int pos, int len )
11331133
{
11341134
return inArray->splice(pos, len).mPtr;
11351135
}
11361136

1137-
static void SLJIT_CALL runRemoveRange( Array_obj<ELEM> *inArray, int pos, int len )
1137+
static void SLJIT_FUNC runRemoveRange( Array_obj<ELEM> *inArray, int pos, int len )
11381138
{
11391139
inArray->removeRange(pos, len);
11401140
}
11411141

1142-
static void SLJIT_CALL runReverse( Array_obj<ELEM> *inArray )
1142+
static void SLJIT_FUNC runReverse( Array_obj<ELEM> *inArray )
11431143
{
11441144
inArray->reverse();
11451145
}
11461146

1147-
static hx::Object *SLJIT_CALL runConcat( Array_obj<ELEM> *inArray, Array_obj<ELEM> *inOther )
1147+
static hx::Object *SLJIT_FUNC runConcat( Array_obj<ELEM> *inArray, Array_obj<ELEM> *inOther )
11481148
{
11491149
return inArray->concat(inOther).mPtr;
11501150
}
11511151

11521152

1153-
static hx::Object *SLJIT_CALL runGetIteratator( Array_obj<ELEM> *inArray )
1153+
static hx::Object *SLJIT_FUNC runGetIteratator( Array_obj<ELEM> *inArray )
11541154
{
11551155
return inArray->iterator().mPtr;
11561156
}
11571157

1158-
static hx::Object *SLJIT_CALL runGetKeyValueIteratator( Array_obj<ELEM> *inArray )
1158+
static hx::Object *SLJIT_FUNC runGetKeyValueIteratator( Array_obj<ELEM> *inArray )
11591159
{
11601160
return inArray->keyValueIterator().mPtr;
11611161
}
11621162

1163-
static void SLJIT_CALL runSetSizeExact( Array_obj<ELEM> *inArray, int size )
1163+
static void SLJIT_FUNC runSetSizeExact( Array_obj<ELEM> *inArray, int size )
11641164
{
11651165
inArray->__SetSizeExact(size);
11661166
}
11671167

1168-
static void SLJIT_CALL runResize( Array_obj<ELEM> *inArray, int size )
1168+
static void SLJIT_FUNC runResize( Array_obj<ELEM> *inArray, int size )
11691169
{
11701170
inArray->resize(size);
11711171
}
11721172

11731173

1174-
static void SLJIT_CALL runToString( Array_obj<ELEM> *inArray, String *outString )
1174+
static void SLJIT_FUNC runToString( Array_obj<ELEM> *inArray, String *outString )
11751175
{
11761176
TRY_NATIVE
11771177
*outString = inArray->toString();
11781178
CATCH_NATIVE
11791179
}
11801180

1181-
static hx::Object * SLJIT_CALL runCopy( Array_obj<ELEM> *inArray)
1181+
static hx::Object * SLJIT_FUNC runCopy( Array_obj<ELEM> *inArray)
11821182
{
11831183
return inArray->copy().mPtr;
11841184
}
11851185

1186-
static void SLJIT_CALL runBlit( JitMultiArg *inArgs)
1186+
static void SLJIT_FUNC runBlit( JitMultiArg *inArgs)
11871187
{
11881188
// this, inDestElement, inSourceArray, inSourceElement, inElementCount
11891189
Array_obj<ELEM> *dest = (Array_obj<ELEM> *)inArgs[0].obj;
@@ -1192,7 +1192,7 @@ struct ArrayBuiltin : public ArrayBuiltinBase
11921192
}
11931193

11941194

1195-
static hx::Object * SLJIT_CALL runProcess( Array_obj<ELEM> *inArray, hx::Object *inFunction)
1195+
static hx::Object * SLJIT_FUNC runProcess( Array_obj<ELEM> *inArray, hx::Object *inFunction)
11961196
{
11971197
TRY_NATIVE
11981198
if (FUNC==afMap)

0 commit comments

Comments
 (0)