Skip to content
Closed
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
6 changes: 3 additions & 3 deletions src/hx/cppia/CppiaCompiler.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -898,7 +898,7 @@ class CppiaJitCompiler : public CppiaCompiler
{
if (inSrc.uses(SLJIT_R1))
{
move(sJitArg0, inSrc);
move(sJitArg0.as(jtInt), inSrc.as(jtInt));
add( sJitTemp1, inTarget.getReg(), inTarget.offset );
callNative( (void *)intToStr, sJitArg0.as(jtInt), sJitTemp1.as(jtPointer));
}
Expand All @@ -917,7 +917,7 @@ class CppiaJitCompiler : public CppiaCompiler
case etObject:
if (inSrc.uses(SLJIT_R1))
{
move(sJitArg0, inSrc);
move(sJitArg0.as(jtPointer), inSrc.as(jtPointer));
add( sJitTemp1, inTarget.getReg(), inTarget.offset );
callNative( (void *)objToStr, sJitArg0.as(jtPointer), sJitTemp1.as(jtPointer) );
}
Expand All @@ -944,7 +944,7 @@ class CppiaJitCompiler : public CppiaCompiler
case etObject:
if (inSrc==sJitTemp1)
{
move(sJitArg0, inSrc);
move(sJitArg0.as(jtPointer), inSrc.as(jtPointer));
makeAddress(sJitTemp1,inTarget);
callNative( (void *)objToFloat, sJitArg0.as(jtPointer), sJitTemp1.as(jtPointer));
}
Expand Down
10 changes: 10 additions & 0 deletions test/cppia/Client.hx
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,16 @@ class ClientFoo implements IFoo {
}
}

class ClientUntypedMove {

public static function subtractIndexed():String {
var a:Int = 2;
var ints:Array<Int> = [7,8,9];

return "" + (ints[a - 1] - ints[0]);
}
}

class Client
{
public static var clientBool0 = true;
Expand Down
10 changes: 10 additions & 0 deletions test/cppia/cases/TestCommon.hx
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,16 @@ class TestCommon extends Test {
Assert.equals(2, Common.callbackSet, 'Bad cppia closure');
}

@:depends(testStatus)
function testUntypedRegisterMove() {
final cls = Type.resolveClass('ClientUntypedMove');

if (Assert.notNull(cls, 'Unable to resolve ClientUntypedMove')) {
Assert.equals('1', Std.string(Reflect.callMethod(null, Reflect.field(cls, 'subtractIndexed'), [])),
'Subtracting two array elements into a string did not answer');
}
}

@:depends(testStatus)
function testInterfaceCalling() {
final obj : IFoo = Type.createInstance(Type.resolveClass('ClientFoo'), []);
Expand Down