Skip to content
Snippets Groups Projects
Commit 34ddf146 authored by Tomas Stupka's avatar Tomas Stupka
Browse files

some minor fixes in java upcalls

parent 144cc152
No related branches found
No related tags found
No related merge requests found
......@@ -321,7 +321,11 @@ public abstract class JavaUpCallsRFFIImpl implements UpCallsRFFI {
}
nameAsString = Utils.intern(nameAsString);
if (val == RNull.instance) {
removeAttr(attrObj, nameAsString);
if ("class" == nameAsString) {
removeClassAttr(attrObj);
} else {
removeAttr(attrObj, nameAsString);
}
} else if ("class" == nameAsString) {
attrObj.initAttributes().define(nameAsString, val);
} else {
......@@ -338,6 +342,11 @@ public abstract class JavaUpCallsRFFIImpl implements UpCallsRFFI {
a.removeAttr(name);
}
@TruffleBoundary
private static void removeClassAttr(RAttributable a) {
a.setClassAttr(null);
}
public static RStringVector getClassHr(Object v) {
return ClassHierarchyNode.getClassHierarchy(v);
}
......@@ -644,7 +653,7 @@ public abstract class JavaUpCallsRFFIImpl implements UpCallsRFFI {
@TruffleBoundary
public long Rf_any_duplicated(Object x, int fromLast) {
RAbstractVector vec = (RAbstractVector) x;
if (vec.getLength() == 0) {
if (vec.getLength() <= 1) {
return 0;
} else {
return DuplicationHelper.analyze(vec, null, true, fromLast != 0).getIndex();
......@@ -873,7 +882,7 @@ public abstract class JavaUpCallsRFFIImpl implements UpCallsRFFI {
RFunction indenticalBuiltin = RContext.getInstance().lookupBuiltin("identical");
Object res = RContext.getEngine().evalFunction(indenticalBuiltin, null, null, true, null, x, y, RRuntime.asLogical((!((flags & 1) == 0))),
RRuntime.asLogical((!((flags & 2) == 0))), RRuntime.asLogical((!((flags & 4) == 0))), RRuntime.asLogical((!((flags & 8) == 0))), RRuntime.asLogical((!((flags & 16) == 0))));
return (int) res;
return RRuntime.logical2int((byte) res);
}
@Override
......
......@@ -45,130 +45,132 @@
#define R_Home_x 40
#define R_HomeDir_x 41
#define R_Interactive_x 42
#define R_MakeExternalPtr_x 43
#define R_MethodsNamespace_x 44
#define R_NamespaceRegistry_x 45
#define R_NewHashedEnv_x 46
#define R_ParseVector_x 47
#define R_PreserveObject_x 48
#define R_PromiseExpr_x 49
#define R_ProtectWithIndex_x 50
#define R_ReadConnection_x 51
#define R_ReleaseObject_x 52
#define R_Reprotect_x 53
#define R_SetExternalPtrAddr_x 54
#define R_SetExternalPtrProtected_x 55
#define R_SetExternalPtrTag_x 56
#define R_TempDir_x 57
#define R_ToplevelExec_x 58
#define R_WriteConnection_x 59
#define R_alloc_x 60
#define R_compute_identical_x 61
#define R_do_MAKE_CLASS_x 62
#define R_do_new_object_x 63
#define R_do_slot_x 64
#define R_do_slot_assign_x 65
#define R_getClassDef_x 66
#define R_getContextCall_x 67
#define R_getContextEnv_x 68
#define R_getContextFun_x 69
#define R_getContextSrcRef_x 70
#define R_getGlobalFunctionContext_x 71
#define R_getParentFunctionContext_x 72
#define R_has_slot_x 73
#define R_insideBrowser_x 74
#define R_isEqual_x 75
#define R_isGlobal_x 76
#define R_lsInternal3_x 77
#define R_new_custom_connection_x 78
#define R_tryEval_x 79
#define Rf_GetOption1_x 80
#define Rf_NonNullStringMatch_x 81
#define Rf_PairToVectorList_x 82
#define Rf_ScalarDouble_x 83
#define Rf_ScalarInteger_x 84
#define Rf_ScalarLogical_x 85
#define Rf_ScalarString_x 86
#define Rf_VectorToPairList_x 87
#define Rf_allocArray_x 88
#define Rf_allocMatrix_x 89
#define Rf_allocVector_x 90
#define Rf_any_duplicated_x 91
#define Rf_asChar_x 92
#define Rf_asCharacterFactor_x 93
#define Rf_asInteger_x 94
#define Rf_asLogical_x 95
#define Rf_asReal_x 96
#define Rf_classgets_x 97
#define Rf_coerceVector_x 98
#define Rf_cons_x 99
#define Rf_copyListMatrix_x 100
#define Rf_copyMatrix_x 101
#define Rf_copyMostAttrib_x 102
#define Rf_defineVar_x 103
#define Rf_dunif_x 104
#define Rf_duplicate_x 105
#define Rf_error_x 106
#define Rf_errorcall_x 107
#define Rf_eval_x 108
#define Rf_findFun_x 109
#define Rf_findVar_x 110
#define Rf_findVarInFrame_x 111
#define Rf_findVarInFrame3_x 112
#define Rf_getAttrib_x 113
#define Rf_gsetVar_x 114
#define Rf_inherits_x 115
#define Rf_install_x 116
#define Rf_installChar_x 117
#define Rf_isNull_x 118
#define Rf_isString_x 119
#define Rf_lengthgets_x 120
#define Rf_match_x 121
#define Rf_mkCharLenCE_x 122
#define Rf_namesgets_x 123
#define Rf_ncols_x 124
#define Rf_nrows_x 125
#define Rf_protect_x 126
#define Rf_punif_x 127
#define Rf_qunif_x 128
#define Rf_runif_x 129
#define Rf_setAttrib_x 130
#define Rf_str2type_x 131
#define Rf_unprotect_x 132
#define Rf_unprotect_ptr_x 133
#define Rf_warning_x 134
#define Rf_warningcall_x 135
#define Rprintf_x 136
#define SETCADR_x 137
#define SETCAR_x 138
#define SETCDR_x 139
#define SET_NAMED_FASTR_x 140
#define SET_RDEBUG_x 141
#define SET_RSTEP_x 142
#define SET_S4_OBJECT_x 143
#define SET_STRING_ELT_x 144
#define SET_SYMVALUE_x 145
#define SET_TAG_x 146
#define SET_TYPEOF_FASTR_x 147
#define SET_VECTOR_ELT_x 148
#define STRING_ELT_x 149
#define SYMVALUE_x 150
#define TAG_x 151
#define TYPEOF_x 152
#define UNSET_S4_OBJECT_x 153
#define VECTOR_ELT_x 154
#define forceSymbols_x 155
#define getCCallable_x 156
#define getConnectionClassString_x 157
#define getOpenModeString_x 158
#define getSummaryDescription_x 159
#define isSeekable_x 160
#define registerCCallable_x 161
#define registerRoutines_x 162
#define setDotSymbolValues_x 163
#define unif_rand_x 164
#define useDynamicSymbols_x 165
#define R_LockBinding_x 43
#define R_MakeExternalPtr_x 44
#define R_MethodsNamespace_x 45
#define R_NamespaceRegistry_x 46
#define R_NewHashedEnv_x 47
#define R_ParseVector_x 48
#define R_PreserveObject_x 49
#define R_PromiseExpr_x 50
#define R_ProtectWithIndex_x 51
#define R_ReadConnection_x 52
#define R_ReleaseObject_x 53
#define R_Reprotect_x 54
#define R_SetExternalPtrAddr_x 55
#define R_SetExternalPtrProtected_x 56
#define R_SetExternalPtrTag_x 57
#define R_TempDir_x 58
#define R_ToplevelExec_x 59
#define R_WriteConnection_x 60
#define R_alloc_x 61
#define R_compute_identical_x 62
#define R_do_MAKE_CLASS_x 63
#define R_do_new_object_x 64
#define R_do_slot_x 65
#define R_do_slot_assign_x 66
#define R_getClassDef_x 67
#define R_getContextCall_x 68
#define R_getContextEnv_x 69
#define R_getContextFun_x 70
#define R_getContextSrcRef_x 71
#define R_getGlobalFunctionContext_x 72
#define R_getParentFunctionContext_x 73
#define R_has_slot_x 74
#define R_insideBrowser_x 75
#define R_isEqual_x 76
#define R_isGlobal_x 77
#define R_lsInternal3_x 78
#define R_new_custom_connection_x 79
#define R_tryEval_x 80
#define R_unLockBinding_x 81
#define Rf_GetOption1_x 82
#define Rf_NonNullStringMatch_x 83
#define Rf_PairToVectorList_x 84
#define Rf_ScalarDouble_x 85
#define Rf_ScalarInteger_x 86
#define Rf_ScalarLogical_x 87
#define Rf_ScalarString_x 88
#define Rf_VectorToPairList_x 89
#define Rf_allocArray_x 90
#define Rf_allocMatrix_x 91
#define Rf_allocVector_x 92
#define Rf_any_duplicated_x 93
#define Rf_asChar_x 94
#define Rf_asCharacterFactor_x 95
#define Rf_asInteger_x 96
#define Rf_asLogical_x 97
#define Rf_asReal_x 98
#define Rf_classgets_x 99
#define Rf_coerceVector_x 100
#define Rf_cons_x 101
#define Rf_copyListMatrix_x 102
#define Rf_copyMatrix_x 103
#define Rf_copyMostAttrib_x 104
#define Rf_defineVar_x 105
#define Rf_dunif_x 106
#define Rf_duplicate_x 107
#define Rf_error_x 108
#define Rf_errorcall_x 109
#define Rf_eval_x 110
#define Rf_findFun_x 111
#define Rf_findVar_x 112
#define Rf_findVarInFrame_x 113
#define Rf_findVarInFrame3_x 114
#define Rf_getAttrib_x 115
#define Rf_gsetVar_x 116
#define Rf_inherits_x 117
#define Rf_install_x 118
#define Rf_installChar_x 119
#define Rf_isNull_x 120
#define Rf_isString_x 121
#define Rf_lengthgets_x 122
#define Rf_match_x 123
#define Rf_mkCharLenCE_x 124
#define Rf_namesgets_x 125
#define Rf_ncols_x 126
#define Rf_nrows_x 127
#define Rf_protect_x 128
#define Rf_punif_x 129
#define Rf_qunif_x 130
#define Rf_runif_x 131
#define Rf_setAttrib_x 132
#define Rf_str2type_x 133
#define Rf_unprotect_x 134
#define Rf_unprotect_ptr_x 135
#define Rf_warning_x 136
#define Rf_warningcall_x 137
#define Rprintf_x 138
#define SETCADR_x 139
#define SETCAR_x 140
#define SETCDR_x 141
#define SET_NAMED_FASTR_x 142
#define SET_RDEBUG_x 143
#define SET_RSTEP_x 144
#define SET_S4_OBJECT_x 145
#define SET_STRING_ELT_x 146
#define SET_SYMVALUE_x 147
#define SET_TAG_x 148
#define SET_TYPEOF_FASTR_x 149
#define SET_VECTOR_ELT_x 150
#define STRING_ELT_x 151
#define SYMVALUE_x 152
#define TAG_x 153
#define TYPEOF_x 154
#define UNSET_S4_OBJECT_x 155
#define VECTOR_ELT_x 156
#define forceSymbols_x 157
#define getCCallable_x 158
#define getConnectionClassString_x 159
#define getOpenModeString_x 160
#define getSummaryDescription_x 161
#define isSeekable_x 162
#define registerCCallable_x 163
#define registerRoutines_x 164
#define setDotSymbolValues_x 165
#define unif_rand_x 166
#define useDynamicSymbols_x 167
#define UPCALLS_TABLE_SIZE 166
#define UPCALLS_TABLE_SIZE 168
#endif // RFFI_UPCALLSINDEX_H
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