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
2b3f960d
Commit
2b3f960d
authored
6 years ago
by
Tomas Stupka
Browse files
Options
Downloads
Patches
Plain Diff
always return dimension for foreign arrays, even if resulting in list
parent
9d71429c
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/InspectForeignArrayNode.java
+9
-9
9 additions, 9 deletions
...le/truffle/r/runtime/interop/InspectForeignArrayNode.java
with
9 additions
and
9 deletions
com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/interop/InspectForeignArrayNode.java
+
9
−
9
View file @
2b3f960d
...
...
@@ -62,17 +62,17 @@ public abstract class InspectForeignArrayNode extends RBaseNode {
*/
public
ArrayInfo
getArrayInfo
(
TruffleObject
obj
)
{
ArrayInfo
info
=
new
ArrayInfo
();
if
(
execute
(
obj
,
true
,
info
,
0
))
{
if
(
execute
(
obj
,
true
,
info
,
0
,
false
))
{
return
info
;
}
return
null
;
}
protected
abstract
boolean
execute
(
Object
obj
,
boolean
recursive
,
ArrayInfo
data
,
int
depth
);
protected
abstract
boolean
execute
(
Object
obj
,
boolean
recursive
,
ArrayInfo
data
,
int
depth
,
boolean
skipIfList
);
@Specialization
(
guards
=
{
"isForeignArray(obj, hasSize)"
})
@CompilerDirectives
.
TruffleBoundary
protected
boolean
inspectArray
(
TruffleObject
obj
,
boolean
recursive
,
ArrayInfo
data
,
int
depth
)
{
protected
boolean
inspectArray
(
TruffleObject
obj
,
boolean
recursive
,
ArrayInfo
data
,
int
depth
,
boolean
skipIfList
)
{
try
{
ArrayInfo
arrayInfo
=
data
==
null
?
new
ArrayInfo
()
:
data
;
int
size
=
(
int
)
ForeignAccess
.
sendGetSize
(
getSize
,
obj
);
...
...
@@ -85,7 +85,7 @@ public abstract class InspectForeignArrayNode extends RBaseNode {
boolean
isArray
=
isForeignArray
(
element
,
hasSize
);
if
(
recursive
&&
isArray
)
{
if
(!
recurse
(
arrayInfo
,
element
,
depth
))
{
if
(!
recurse
(
arrayInfo
,
element
,
depth
,
skipIfList
))
{
return
false
;
}
}
else
if
(!
recursive
&&
isArray
)
{
...
...
@@ -96,7 +96,7 @@ public abstract class InspectForeignArrayNode extends RBaseNode {
return
false
;
}
else
{
RType
elementType
=
arrayInfo
.
typeCheck
.
check
(
getForeign2R
().
execute
(
element
));
if
(
elementType
==
RType
.
List
)
{
if
(
skipIfList
&&
elementType
==
RType
.
List
)
{
return
false
;
}
}
...
...
@@ -110,16 +110,16 @@ public abstract class InspectForeignArrayNode extends RBaseNode {
@Fallback
protected
boolean
fallback
(
@SuppressWarnings
(
"unused"
)
Object
obj
,
@SuppressWarnings
(
"unused"
)
boolean
recursive
,
@SuppressWarnings
(
"unused"
)
ArrayInfo
data
,
@SuppressWarnings
(
"unused"
)
int
depth
)
{
@SuppressWarnings
(
"unused"
)
int
depth
,
@SuppressWarnings
(
"unused"
)
boolean
skipIfList
)
{
return
false
;
}
private
boolean
recurse
(
ArrayInfo
arrayInfo
,
Object
element
,
int
depth
)
{
private
boolean
recurse
(
ArrayInfo
arrayInfo
,
Object
element
,
int
depth
,
boolean
skipIfList
)
{
if
(
inspectTruffleObject
==
null
)
{
CompilerDirectives
.
transferToInterpreterAndInvalidate
();
inspectTruffleObject
=
insert
(
create
());
}
return
inspectTruffleObject
.
execute
(
element
,
true
,
arrayInfo
,
depth
+
1
);
return
inspectTruffleObject
.
execute
(
element
,
true
,
arrayInfo
,
depth
+
1
,
skipIfList
);
}
public
static
final
class
ArrayInfo
{
...
...
@@ -137,7 +137,7 @@ public abstract class InspectForeignArrayNode extends RBaseNode {
return
isRectMultiDim
()
?
dims
.
stream
().
mapToInt
((
i
)
->
i
.
intValue
()).
toArray
()
:
null
;
}
private
boolean
isRectMultiDim
()
{
boolean
isRectMultiDim
()
{
return
canUseDims
&&
dims
.
size
()
>
1
;
}
...
...
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