Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
project/thirdparty/*/** linguist-vendored
src/hx/cppia/sljit_src/** linguist-vendored
17 changes: 1 addition & 16 deletions include/hx/Object.h
Original file line number Diff line number Diff line change
Expand Up @@ -39,22 +39,7 @@ HXCPP_EXTERN_CLASS_ATTRIBUTES null BadCast();

#ifdef HXCPP_SCRIPTABLE

// CPPIA_CALL = fastcall on x86(32), nothing otherwise
#if (defined(_WIN32) && !defined(_M_X64) && !defined(__x86_64__) && !defined(_ARM_) ) || \
defined(HXCPP_X86) || defined(__i386__) || defined(__i386) || \
(!defined(_WIN32) && !defined(_ARM_) && !defined(__arm__) && !defined(__aarch64__) && !defined(__x86_64__) )

#if defined(__GNUC__) && !defined(__APPLE__) && !defined(__EMSCRIPTEN__)
#define CPPIA_CALL __attribute__ ((fastcall))
#elif defined(_MSC_VER)
#define CPPIA_CALL __fastcall
#endif
#endif

#ifndef CPPIA_CALL
#define CPPIA_CALL
#endif

#define CPPIA_CALL

typedef void (CPPIA_CALL *StackExecute)(struct StackContext *ctx);
struct ScriptFunction
Expand Down
64 changes: 32 additions & 32 deletions src/hx/cppia/ArrayBuiltin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ CppiaExpr *ArrayBuiltinBase::link(CppiaModule &inData)


#ifdef CPPIA_JIT
static ArrayBase * SLJIT_CALL array_expand_size(ArrayBase *inArray, int inSize)
static ArrayBase * SLJIT_FUNC array_expand_size(ArrayBase *inArray, int inSize)
{
inArray->Realloc(inSize+1);
return inArray;
Expand Down Expand Up @@ -170,7 +170,7 @@ struct ArraySetter : public ArrayBuiltinBase

#ifdef CPPIA_JIT

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

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

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

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

#ifdef CPPIA_JIT
static hx::Object *SLJIT_CALL objGetIndex(hx::Object *inArray, int inIndex)
static hx::Object *SLJIT_FUNC objGetIndex(hx::Object *inArray, int inIndex)
{
return Dynamic(inArray->__GetItem(inIndex)).mPtr;
}
Expand Down Expand Up @@ -1027,25 +1027,25 @@ struct ArrayBuiltin : public ArrayBuiltinBase
}

#ifdef CPPIA_JIT
static ArrayBase * SLJIT_CALL array_expand(ArrayBase *inArray)
static ArrayBase * SLJIT_FUNC array_expand(ArrayBase *inArray)
{
inArray->Realloc( inArray->length + 1 );
return inArray;
}
static void SLJIT_CALL runSort( Array_obj<ELEM> *inArray, hx::Object *inFunc)
static void SLJIT_FUNC runSort( Array_obj<ELEM> *inArray, hx::Object *inFunc)
{
TRY_NATIVE
inArray->sort( Dynamic(inFunc) );
CATCH_NATIVE
}
static void SLJIT_CALL runJoin( Array_obj<ELEM> *inArray, String *ioValue)
static void SLJIT_FUNC runJoin( Array_obj<ELEM> *inArray, String *ioValue)
{
TRY_NATIVE
*ioValue = inArray->join( *ioValue );
CATCH_NATIVE
}

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

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

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

}

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

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

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


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


static int SLJIT_CALL runIndex( Array_obj<ELEM> *inArray, typename ExprBaseTypeOf<ELEM>::Base inBase, hx::Object *pos)
static int SLJIT_FUNC runIndex( Array_obj<ELEM> *inArray, typename ExprBaseTypeOf<ELEM>::Base inBase, hx::Object *pos)
{
if (FUNC==afIndexOf)
return inArray->indexOf(inBase,pos);
else
return inArray->lastIndexOf(inBase,pos);
}

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

// TODO - string
static hx::Object * SLJIT_CALL runShift( Array_obj<ELEM> *inArray )
static hx::Object * SLJIT_FUNC runShift( Array_obj<ELEM> *inArray )
{
return Dynamic(inArray->shift()).mPtr;
}

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

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

static void SLJIT_CALL runRemoveRange( Array_obj<ELEM> *inArray, int pos, int len )
static void SLJIT_FUNC runRemoveRange( Array_obj<ELEM> *inArray, int pos, int len )
{
inArray->removeRange(pos, len);
}

static void SLJIT_CALL runReverse( Array_obj<ELEM> *inArray )
static void SLJIT_FUNC runReverse( Array_obj<ELEM> *inArray )
{
inArray->reverse();
}

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


static hx::Object *SLJIT_CALL runGetIteratator( Array_obj<ELEM> *inArray )
static hx::Object *SLJIT_FUNC runGetIteratator( Array_obj<ELEM> *inArray )
{
return inArray->iterator().mPtr;
}

static hx::Object *SLJIT_CALL runGetKeyValueIteratator( Array_obj<ELEM> *inArray )
static hx::Object *SLJIT_FUNC runGetKeyValueIteratator( Array_obj<ELEM> *inArray )
{
return inArray->keyValueIterator().mPtr;
}

static void SLJIT_CALL runSetSizeExact( Array_obj<ELEM> *inArray, int size )
static void SLJIT_FUNC runSetSizeExact( Array_obj<ELEM> *inArray, int size )
{
inArray->__SetSizeExact(size);
}

static void SLJIT_CALL runResize( Array_obj<ELEM> *inArray, int size )
static void SLJIT_FUNC runResize( Array_obj<ELEM> *inArray, int size )
{
inArray->resize(size);
}


static void SLJIT_CALL runToString( Array_obj<ELEM> *inArray, String *outString )
static void SLJIT_FUNC runToString( Array_obj<ELEM> *inArray, String *outString )
{
TRY_NATIVE
*outString = inArray->toString();
CATCH_NATIVE
}

static hx::Object * SLJIT_CALL runCopy( Array_obj<ELEM> *inArray)
static hx::Object * SLJIT_FUNC runCopy( Array_obj<ELEM> *inArray)
{
return inArray->copy().mPtr;
}

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


static hx::Object * SLJIT_CALL runProcess( Array_obj<ELEM> *inArray, hx::Object *inFunction)
static hx::Object * SLJIT_FUNC runProcess( Array_obj<ELEM> *inArray, hx::Object *inFunction)
{
TRY_NATIVE
if (FUNC==afMap)
Expand Down
Loading
Loading