Skip to content
Snippets Groups Projects
Commit 8a29ae37 authored by Mick Jordan's avatar Mick Jordan Committed by Lukas Stadler
Browse files

TruffleNFI fixes for pkg init

parent 31fa1530
No related branches found
No related tags found
No related merge requests found
......@@ -32,8 +32,8 @@ public interface PkgInitUpCalls {
setDotSymbolValues("(object, string, pointer, sint32): object"),
useDynamicSymbols("(object, sint32): sint32"),
forceSymbols("(object, sint32): sint32"),
registerCCallable("(string, string, object): sint32"),
getCCallable("(string, string, object): void");
registerCCallable("(string, string, uint64): sint32"),
getCCallable("(string, string): uint64");
public final String signature;
......
......@@ -261,7 +261,7 @@ public class TruffleNFI_Call implements CallRFFI {
try {
TruffleObject callFunction = (TruffleObject) ForeignAccess.sendInvoke(bindNode,
nativeCallInfo.address.asTruffleObject(), "bind", "(object): object");
result = ForeignAccess.sendExecute(executeNode, callFunction, JavaInterop.asTruffleObject(args[0]));
result = ForeignAccess.sendExecute(executeNode, callFunction, args[0]);
return result;
} catch (InteropException ex) {
throw RInternalError.shouldNotReachHere(ex);
......@@ -280,7 +280,7 @@ public class TruffleNFI_Call implements CallRFFI {
try {
TruffleObject callFunction = (TruffleObject) ForeignAccess.sendInvoke(bindNode,
nativeCallInfo.address.asTruffleObject(), "bind", "(object, object): object");
result = ForeignAccess.sendExecute(executeNode, callFunction, JavaInterop.asTruffleObject(args[0]), JavaInterop.asTruffleObject(args[1]));
result = ForeignAccess.sendExecute(executeNode, callFunction, args[0], args[1]);
return result;
} catch (InteropException ex) {
throw RInternalError.shouldNotReachHere(ex);
......@@ -299,7 +299,7 @@ public class TruffleNFI_Call implements CallRFFI {
try {
TruffleObject callFunction = (TruffleObject) ForeignAccess.sendInvoke(bindNode,
nativeCallInfo.address.asTruffleObject(), "bind", "(object, object, object): object");
result = ForeignAccess.sendExecute(executeNode, callFunction, JavaInterop.asTruffleObject(args[0]), JavaInterop.asTruffleObject(args[1]), JavaInterop.asTruffleObject(args[2]));
result = ForeignAccess.sendExecute(executeNode, callFunction, args[0], args[1], args[2]);
return result;
} catch (InteropException ex) {
throw RInternalError.shouldNotReachHere(ex);
......@@ -318,8 +318,8 @@ public class TruffleNFI_Call implements CallRFFI {
try {
TruffleObject callFunction = (TruffleObject) ForeignAccess.sendInvoke(bindNode,
nativeCallInfo.address.asTruffleObject(), "bind", "(object, object, object, object): object");
result = ForeignAccess.sendExecute(executeNode, callFunction, JavaInterop.asTruffleObject(args[0]), JavaInterop.asTruffleObject(args[1]), JavaInterop.asTruffleObject(args[2]),
JavaInterop.asTruffleObject(args[3]));
result = ForeignAccess.sendExecute(executeNode, callFunction, args[0], args[1], args[2],
args[3]);
return result;
} catch (InteropException ex) {
throw RInternalError.shouldNotReachHere(ex);
......@@ -338,8 +338,8 @@ public class TruffleNFI_Call implements CallRFFI {
try {
TruffleObject callFunction = (TruffleObject) ForeignAccess.sendInvoke(bindNode,
nativeCallInfo.address.asTruffleObject(), "bind", "(object, object, object, object, object): object");
result = ForeignAccess.sendExecute(executeNode, callFunction, JavaInterop.asTruffleObject(args[0]), JavaInterop.asTruffleObject(args[1]),
JavaInterop.asTruffleObject(args[2]), JavaInterop.asTruffleObject(args[3]), JavaInterop.asTruffleObject(args[4]));
result = ForeignAccess.sendExecute(executeNode, callFunction, args[0], args[1],
args[2], args[3], args[4]);
return result;
} catch (InteropException ex) {
throw RInternalError.shouldNotReachHere(ex);
......@@ -358,8 +358,8 @@ public class TruffleNFI_Call implements CallRFFI {
try {
TruffleObject callFunction = (TruffleObject) ForeignAccess.sendInvoke(bindNode,
nativeCallInfo.address.asTruffleObject(), "bind", "(object, object, object, object, object, object): object");
result = ForeignAccess.sendExecute(executeNode, callFunction, JavaInterop.asTruffleObject(args[0]), JavaInterop.asTruffleObject(args[1]),
JavaInterop.asTruffleObject(args[2]), JavaInterop.asTruffleObject(args[3]), JavaInterop.asTruffleObject(args[4]), JavaInterop.asTruffleObject(args[5]));
result = ForeignAccess.sendExecute(executeNode, callFunction, args[0], args[1],
args[2], args[3], args[4], args[5]);
return result;
} catch (InteropException ex) {
throw RInternalError.shouldNotReachHere(ex);
......@@ -378,9 +378,9 @@ public class TruffleNFI_Call implements CallRFFI {
try {
TruffleObject callFunction = (TruffleObject) ForeignAccess.sendInvoke(bindNode,
nativeCallInfo.address.asTruffleObject(), "bind", "(object, object, object, object, object, object, object): object");
result = ForeignAccess.sendExecute(executeNode, callFunction, JavaInterop.asTruffleObject(args[0]), JavaInterop.asTruffleObject(args[1]),
JavaInterop.asTruffleObject(args[2]), JavaInterop.asTruffleObject(args[3]), JavaInterop.asTruffleObject(args[4]), JavaInterop.asTruffleObject(args[5]),
JavaInterop.asTruffleObject(args[6]));
result = ForeignAccess.sendExecute(executeNode, callFunction, args[0], args[1],
args[2], args[3], args[4], args[5],
args[6]);
return result;
} catch (InteropException ex) {
throw RInternalError.shouldNotReachHere(ex);
......@@ -399,9 +399,9 @@ public class TruffleNFI_Call implements CallRFFI {
try {
TruffleObject callFunction = (TruffleObject) ForeignAccess.sendInvoke(bindNode,
nativeCallInfo.address.asTruffleObject(), "bind", "(object, object, object, object, object, object, object, object): object");
result = ForeignAccess.sendExecute(executeNode, callFunction, JavaInterop.asTruffleObject(args[0]), JavaInterop.asTruffleObject(args[1]),
JavaInterop.asTruffleObject(args[2]), JavaInterop.asTruffleObject(args[3]), JavaInterop.asTruffleObject(args[4]), JavaInterop.asTruffleObject(args[5]),
JavaInterop.asTruffleObject(args[6]), JavaInterop.asTruffleObject(args[7]));
result = ForeignAccess.sendExecute(executeNode, callFunction, args[0], args[1],
args[2], args[3], args[4], args[5],
args[6], args[7]);
return result;
} catch (InteropException ex) {
throw RInternalError.shouldNotReachHere(ex);
......
......@@ -65,7 +65,7 @@ R_registerRoutines(DllInfo *info, const R_CMethodDef * const croutines,
}
if (fortranRoutines) {
for(num = 0; fortranRoutines[num].name != NULL; num++) {;}
//printf("R_registerRoutines %p,%p,%d,%d,%p\n", call_registerRoutines, info, FORTRAN_NATIVE_TYPE, num, fortranRoutines);
//printf("R_registerRoutines %p,%p,%d,%d,%p\n", info, FORTRAN_NATIVE_TYPE, num, fortranRoutines);
((call_registerRoutines) dynload_callbacks[registerRoutines_x])(info, FORTRAN_NATIVE_TYPE, num, (long) fortranRoutines);
}
if (externalRoutines) {
......@@ -77,10 +77,12 @@ R_registerRoutines(DllInfo *info, const R_CMethodDef * const croutines,
}
Rboolean R_useDynamicSymbols(DllInfo *dllInfo, Rboolean value) {
//printf("R_useDynamicSymbols %p %d %p\n", dllInfo, value);
return ((call_useDynamicSymbols) dynload_callbacks[useDynamicSymbols_x])(dllInfo, value);
}
Rboolean R_forceSymbols(DllInfo *dllInfo, Rboolean value) {
//printf("R_forceSymbols %p %d\n", dllInfo, value);
return ((call_forceSymbols) dynload_callbacks[forceSymbols_x])(dllInfo, value);
}
......@@ -125,10 +127,12 @@ void *Rdynload_setSymbol(DllInfo *info, int nstOrd, long routinesAddr, int index
}
void R_RegisterCCallable(const char *package, const char *name, DL_FUNC fptr) {
((call_registerCCallable) dynload_callbacks[registerCCallable_x])(ensure_string(package), ensure_string(name), (void *)fptr);
//printf("R_RegisterCCallable %s %s %p\n", package, name, fptr);
((call_registerCCallable) dynload_callbacks[registerCCallable_x])(ensure_string(package), ensure_string(name), ensure_fun((void *)fptr));
}
DL_FUNC R_GetCCallable(const char *package, const char *name) {
//printf("R_GetCCallable %s %s %p\n", package, name);
return ((call_getCCallable) dynload_callbacks[getCCallable_x])(ensure_string(package), ensure_string(name));
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment