Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
Q
QueryR
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Julien Lopez
QueryR
Commits
42a95534
Commit
42a95534
authored
7 years ago
by
Tomas Stupka
Browse files
Options
Downloads
Patches
Plain Diff
multi-dim arrays not yet supported with ForeignWrappers
parent
5c688a60
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/ForeignArray2R.java
+32
-34
32 additions, 34 deletions
.../com/oracle/truffle/r/runtime/interop/ForeignArray2R.java
with
32 additions
and
34 deletions
com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/ForeignArray2R.java
+
32
−
34
View file @
42a95534
...
...
@@ -99,45 +99,43 @@ public abstract class ForeignArray2R extends RBaseNode {
*
*/
public
Object
convert
(
Object
obj
,
boolean
recursive
)
{
if
(
FastROptions
.
ForeignObjectWrappers
.
getBooleanValue
())
{
if
(
isForeignArray
(
obj
))
{
TruffleObject
truffleObject
=
(
TruffleObject
)
obj
;
try
{
int
size
=
(
int
)
ForeignAccess
.
sendGetSize
(
getSize
,
truffleObject
);
if
(
size
==
0
)
{
return
new
RForeignListWrapper
(
truffleObject
);
}
else
{
Object
firstElement
=
ForeignAccess
.
sendRead
(
read
,
truffleObject
,
0
);
switch
(
InteropTypeCheck
.
determineType
(
firstElement
))
{
case
BOOLEAN:
return
new
RForeignBooleanWrapper
(
truffleObject
);
case
DOUBLE:
return
new
RForeignDoubleWrapper
(
truffleObject
);
case
INTEGER:
return
new
RForeignIntWrapper
(
truffleObject
);
case
STRING:
return
new
RForeignStringWrapper
(
truffleObject
);
default
:
return
new
RForeignListWrapper
(
truffleObject
);
}
if
(
FastROptions
.
ForeignObjectWrappers
.
getBooleanValue
()
&&
isForeignArray
(
obj
))
{
TruffleObject
truffleObject
=
(
TruffleObject
)
obj
;
try
{
int
size
=
(
int
)
ForeignAccess
.
sendGetSize
(
getSize
,
truffleObject
);
if
(
size
==
0
)
{
return
new
RForeignListWrapper
(
truffleObject
);
}
else
{
Object
firstElement
=
ForeignAccess
.
sendRead
(
read
,
truffleObject
,
0
);
if
(
isForeignArray
(
firstElement
))
{
throw
error
(
RError
.
Message
.
GENERIC
,
"Wrapping of multi-dim arrays not supported."
);
}
switch
(
InteropTypeCheck
.
determineType
(
firstElement
))
{
case
BOOLEAN:
return
new
RForeignBooleanWrapper
(
truffleObject
);
case
DOUBLE:
return
new
RForeignDoubleWrapper
(
truffleObject
);
case
INTEGER:
return
new
RForeignIntWrapper
(
truffleObject
);
case
STRING:
return
new
RForeignStringWrapper
(
truffleObject
);
default
:
return
new
RForeignListWrapper
(
truffleObject
);
}
}
catch
(
UnsupportedMessageException
|
UnknownIdentifierException
e
)
{
throw
RInternalError
.
shouldNotReachHere
(
e
);
}
}
else
{
return
obj
;
}
catch
(
UnsupportedMessageException
|
UnknownIdentifierException
e
)
{
throw
RInternalError
.
shouldNotReachHere
(
e
)
;
}
}
else
{
Object
result
=
execute
(
obj
,
recursive
,
null
,
0
);
if
(
result
instanceof
ForeignArrayData
)
{
ForeignArrayData
arrayData
=
(
ForeignArrayData
)
result
;
if
(
arrayData
.
elements
.
isEmpty
())
{
return
RDataFactory
.
createList
();
}
return
asAbstractVector
(
arrayData
);
}
Object
result
=
execute
(
obj
,
recursive
,
null
,
0
);
if
(
result
instanceof
ForeignArrayData
)
{
ForeignArrayData
arrayData
=
(
ForeignArrayData
)
result
;
if
(
arrayData
.
elements
.
isEmpty
())
{
return
RDataFactory
.
createList
();
}
return
result
;
return
asAbstractVector
(
arrayData
)
;
}
return
result
;
}
protected
abstract
Object
execute
(
Object
obj
,
boolean
recursive
,
ForeignArrayData
arrayData
,
int
depth
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment