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
19a1a22c
Commit
19a1a22c
authored
9 years ago
by
Adam Welc
Browse files
Options
Downloads
Patches
Plain Diff
Compilation fixes due to javac bug.
parent
ac37c5c4
Branches
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.library/src/com/oracle/truffle/r/library/methods/MethodsListDispatch.java
+62
-61
62 additions, 61 deletions
...oracle/truffle/r/library/methods/MethodsListDispatch.java
with
62 additions
and
61 deletions
com.oracle.truffle.r.library/src/com/oracle/truffle/r/library/methods/MethodsListDispatch.java
+
62
−
61
View file @
19a1a22c
...
...
@@ -15,7 +15,7 @@ import com.oracle.truffle.api.CompilerDirectives.TruffleBoundary;
import
com.oracle.truffle.api.dsl.*
;
import
com.oracle.truffle.api.frame.FrameDescriptor
;
import
com.oracle.truffle.api.frame.MaterializedFrame
;
import
com.oracle.truffle.r.library.methods.MethodsListDispatchFactory.
R_getGenericNodeGen.
GetGenericInternalNodeGen
;
import
com.oracle.truffle.r.library.methods.MethodsListDispatchFactory.GetGenericInternalNodeGen
;
import
com.oracle.truffle.r.nodes.builtin.*
;
import
com.oracle.truffle.r.nodes.function.ClassHierarchyScalarNode
;
import
com.oracle.truffle.r.nodes.function.ClassHierarchyScalarNodeGen
;
...
...
@@ -155,28 +155,28 @@ public class MethodsListDispatch {
}
}
static
String
checkSingleString
(
Object
o
,
boolean
nonEmpty
,
String
what
,
RBaseNode
node
,
ClassHierarchyScalarNode
classHierarchyNode
)
{
if
(
o
instanceof
RAbstractStringVector
)
{
RAbstractStringVector
vec
=
(
RAbstractStringVector
)
o
;
if
(
vec
.
getLength
()
!=
1
)
{
throw
RError
.
error
(
node
,
RError
.
Message
.
SINGLE_STRING_TOO_LONG
,
what
,
vec
.
getLength
());
}
String
s
=
vec
.
getDataAt
(
0
);
if
(
nonEmpty
&&
s
.
length
()
==
0
)
{
throw
RError
.
error
(
node
,
RError
.
Message
.
NON_EMPTY_STRING
,
what
);
}
return
s
;
}
else
{
throw
RError
.
error
(
node
,
RError
.
Message
.
SINGLE_STRING_WRONG_TYPE
,
what
,
classHierarchyNode
.
executeString
(
o
));
}
}
public
abstract
static
class
R_getGeneric
extends
RExternalBuiltinNode
.
Arg4
{
@Child
private
ClassHierarchyScalarNode
classHierarchyNode
=
ClassHierarchyScalarNodeGen
.
create
();
@Child
private
GetGenericInternal
getGenericInternal
=
GetGenericInternalNodeGen
.
create
();
private
static
String
checkSingleString
(
Object
o
,
boolean
nonEmpty
,
String
what
,
RBaseNode
node
,
ClassHierarchyScalarNode
classHierarchyNode
)
{
if
(
o
instanceof
RAbstractStringVector
)
{
RAbstractStringVector
vec
=
(
RAbstractStringVector
)
o
;
if
(
vec
.
getLength
()
!=
1
)
{
throw
RError
.
error
(
node
,
RError
.
Message
.
SINGLE_STRING_TOO_LONG
,
what
,
vec
.
getLength
());
}
String
s
=
vec
.
getDataAt
(
0
);
if
(
nonEmpty
&&
s
.
length
()
==
0
)
{
throw
RError
.
error
(
node
,
RError
.
Message
.
NON_EMPTY_STRING
,
what
);
}
return
s
;
}
else
{
throw
RError
.
error
(
node
,
RError
.
Message
.
SINGLE_STRING_WRONG_TYPE
,
what
,
classHierarchyNode
.
executeString
(
o
));
}
}
@Specialization
protected
Object
getGeneric
(
RAbstractVector
nameVec
,
RAbstractVector
mustFindVec
,
REnvironment
env
,
RAbstractVector
packageVec
)
{
String
name
=
checkSingleString
(
nameVec
,
true
,
"The argument \"f\" to getGeneric"
,
this
,
classHierarchyNode
);
...
...
@@ -195,54 +195,55 @@ public class MethodsListDispatch {
return
value
;
}
abstract
static
class
GetGenericInternal
extends
RBaseNode
{
public
abstract
Object
executeObject
(
String
name
,
REnvironment
rho
,
String
pckg
);
private
final
RAttributeProfiles
attrProfiles
=
RAttributeProfiles
.
create
();
@Child
private
CastToVectorNode
castToVector
=
CastToVectorNodeGen
.
create
(
false
);
@Child
private
ClassHierarchyScalarNode
classHierarchyNode
=
ClassHierarchyScalarNodeGen
.
create
();
@Specialization
protected
Object
getGeneric
(
String
name
,
REnvironment
env
,
String
pckg
)
{
REnvironment
rho
=
env
;
RAttributable
generic
=
null
;
while
(
rho
!=
null
)
{
// TODO: make it faster
MaterializedFrame
currentFrame
=
rho
.
getFrame
();
FrameDescriptor
currentFrameDesc
=
currentFrame
.
getFrameDescriptor
();
Object
o
=
ExecuteMethod
.
slotRead
(
currentFrame
,
currentFrameDesc
,
name
);
if
(
o
!=
null
)
{
if
(
o
instanceof
RPromise
)
{
o
=
PromiseHelperNode
.
evaluateSlowPath
(
null
,
(
RPromise
)
o
);
}
RAttributable
vl
=
(
RAttributable
)
o
;
boolean
ok
=
false
;
if
(
vl
instanceof
RFunction
&&
vl
.
getAttr
(
attrProfiles
,
RRuntime
.
GENERIC_ATTR_KEY
)
!=
null
)
{
if
(
pckg
.
length
()
>
0
)
{
Object
gpckgObj
=
vl
.
getAttr
(
attrProfiles
,
RRuntime
.
PCKG_ATTR_KEY
);
if
(
gpckgObj
!=
null
)
{
String
gpckg
=
checkSingleString
(
castToVector
.
execute
(
gpckgObj
),
false
,
"The \"package\" slot in generic function object"
,
this
,
classHierarchyNode
);
ok
=
pckg
.
equals
(
gpckg
);
}
}
else
{
ok
=
true
;
}
abstract
static
class
GetGenericInternal
extends
RBaseNode
{
public
abstract
Object
executeObject
(
String
name
,
REnvironment
rho
,
String
pckg
);
private
final
RAttributeProfiles
attrProfiles
=
RAttributeProfiles
.
create
();
@Child
private
CastToVectorNode
castToVector
=
CastToVectorNodeGen
.
create
(
false
);
@Child
private
ClassHierarchyScalarNode
classHierarchyNode
=
ClassHierarchyScalarNodeGen
.
create
();
@Specialization
protected
Object
getGeneric
(
String
name
,
REnvironment
env
,
String
pckg
)
{
REnvironment
rho
=
env
;
RAttributable
generic
=
null
;
while
(
rho
!=
null
)
{
// TODO: make it faster
MaterializedFrame
currentFrame
=
rho
.
getFrame
();
FrameDescriptor
currentFrameDesc
=
currentFrame
.
getFrameDescriptor
();
Object
o
=
ExecuteMethod
.
slotRead
(
currentFrame
,
currentFrameDesc
,
name
);
if
(
o
!=
null
)
{
if
(
o
instanceof
RPromise
)
{
o
=
PromiseHelperNode
.
evaluateSlowPath
(
null
,
(
RPromise
)
o
);
}
RAttributable
vl
=
(
RAttributable
)
o
;
boolean
ok
=
false
;
if
(
vl
instanceof
RFunction
&&
vl
.
getAttr
(
attrProfiles
,
RRuntime
.
GENERIC_ATTR_KEY
)
!=
null
)
{
if
(
pckg
.
length
()
>
0
)
{
Object
gpckgObj
=
vl
.
getAttr
(
attrProfiles
,
RRuntime
.
PCKG_ATTR_KEY
);
if
(
gpckgObj
!=
null
)
{
String
gpckg
=
checkSingleString
(
castToVector
.
execute
(
gpckgObj
),
false
,
"The \"package\" slot in generic function object"
,
this
,
classHierarchyNode
);
ok
=
pckg
.
equals
(
gpckg
);
}
}
if
(
ok
)
{
generic
=
vl
;
break
;
}
else
{
ok
=
true
;
}
}
rho
=
rho
.
getParent
();
if
(
ok
)
{
generic
=
vl
;
break
;
}
}
// TODO: in GNU R there is additional code here that deals with the case of "name"
// being a symbol but at this point this case is not handled (even possible?) in
// FastR
return
generic
==
null
?
RNull
.
instance
:
generic
;
rho
=
rho
.
getParent
();
}
// TODO: in GNU R there is additional code here that deals with the case of "name"
// being a symbol but at this point this case is not handled (even possible?) in
// FastR
return
generic
==
null
?
RNull
.
instance
:
generic
;
}
}
...
...
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