From fac45ecba6a184f6b131d260fb45cced087dbb01 Mon Sep 17 00:00:00 2001 From: Malte Stellmacher Date: Fri, 9 Feb 2024 15:12:11 +0100 Subject: [PATCH] Implement positive64BitIntegerFor --- .../src/InterpreterProxy.c | 2 ++ .../trufflesqueak/nodes/plugins/ffi/InterpreterProxy.java | 5 +++++ 2 files changed, 7 insertions(+) diff --git a/src/de.hpi.swa.trufflesqueak.ffi.native/src/InterpreterProxy.c b/src/de.hpi.swa.trufflesqueak.ffi.native/src/InterpreterProxy.c index 0f71bf6d2..54a4474a1 100644 --- a/src/de.hpi.swa.trufflesqueak.ffi.native/src/InterpreterProxy.c +++ b/src/de.hpi.swa.trufflesqueak.ffi.native/src/InterpreterProxy.c @@ -70,6 +70,7 @@ VirtualMachine* createInterpreterProxy( sqInt (*popthenPush)(sqInt nItems, sqInt oop), sqInt (*positive32BitIntegerFor)(unsigned int integerValue), usqInt (*positive32BitValueOf)(sqInt oop), + sqInt (*positive64BitIntegerFor)(usqLong integerValue), usqLong (*positive64BitValueOf)(sqInt oop), sqInt (*primitiveFail)(void), sqInt (*primitiveFailFor)(sqInt reasonCode), @@ -147,6 +148,7 @@ VirtualMachine* createInterpreterProxy( interpreterProxy->popthenPush = popthenPush; interpreterProxy->positive32BitIntegerFor = positive32BitIntegerFor; interpreterProxy->positive32BitValueOf = positive32BitValueOf; + interpreterProxy->positive64BitIntegerFor = positive64BitIntegerFor; interpreterProxy->positive64BitValueOf = positive64BitValueOf; interpreterProxy->primitiveFail = primitiveFail; interpreterProxy->primitiveFailFor = primitiveFailFor; diff --git a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/plugins/ffi/InterpreterProxy.java b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/plugins/ffi/InterpreterProxy.java index b93623395..eeeac92af 100644 --- a/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/plugins/ffi/InterpreterProxy.java +++ b/src/de.hpi.swa.trufflesqueak/src/de/hpi/swa/trufflesqueak/nodes/plugins/ffi/InterpreterProxy.java @@ -148,6 +148,7 @@ private TruffleExecutable[] getExecutables() { TruffleExecutable.wrap("(SINT64,SINT64):SINT64", this::popthenPush), TruffleExecutable.wrap("(UINT64):SINT64", this::positive32BitIntegerFor), TruffleExecutable.wrap("(SINT64):UINT64", this::positive32BitValueOf), + TruffleExecutable.wrap("(SINT64):UINT64", this::positive64BitIntegerFor), TruffleExecutable.wrap("(SINT64):UINT64", this::positive64BitValueOf), TruffleExecutable.wrap("():SINT64", this::primitiveFail), TruffleExecutable.wrap("(SINT64):SINT64", this::primitiveFailFor), @@ -651,6 +652,10 @@ private long positive32BitValueOf(final long oop) { return integerValueOf(oop) & Integer.MAX_VALUE; } + private long positive64BitIntegerFor(final long integerValue) { + return integerObjectOf(Math.abs(integerValue)); + } + private long positive64BitValueOf(final long oop) { return Math.abs(integerValueOf(oop)); }