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
1af36d25
Commit
1af36d25
authored
8 years ago
by
Lukas Stadler
Browse files
Options
Downloads
Patches
Plain Diff
small improvements in ArgState handling
parent
9dd84cc1
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.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentStatePush.java
+41
-40
41 additions, 40 deletions
...om/oracle/truffle/r/nodes/function/ArgumentStatePush.java
with
41 additions
and
40 deletions
com.oracle.truffle.r.nodes/src/com/oracle/truffle/r/nodes/function/ArgumentStatePush.java
+
41
−
40
View file @
1af36d25
...
...
@@ -65,49 +65,51 @@ public abstract class ArgumentStatePush extends Node {
public
void
transitionState
(
VirtualFrame
frame
,
RShareable
shareable
)
{
if
(
isRefCountUpdateable
.
profile
(!
shareable
.
isSharedPermanent
()))
{
shareable
.
incRefCount
();
}
if
(!
FastROptions
.
RefCountIncrementOnly
.
getBooleanValue
())
{
if
(
mask
==
0
)
{
CompilerDirectives
.
transferToInterpreterAndInvalidate
();
if
(
shareable
instanceof
RAbstractContainer
)
{
if
(
shareable
instanceof
RLanguage
||
((
RAbstractContainer
)
shareable
).
getLength
()
<
REF_COUNT_SIZE_THRESHOLD
)
{
// don't decrement ref count for small objects or language objects- this is
// pretty conservative and can be further finessed
if
(!
FastROptions
.
RefCountIncrementOnly
.
getBooleanValue
())
{
if
(
mask
==
0
)
{
CompilerDirectives
.
transferToInterpreterAndInvalidate
();
if
(
shareable
instanceof
RAbstractContainer
)
{
if
(
shareable
instanceof
RLanguage
||
((
RAbstractContainer
)
shareable
).
getLength
()
<
REF_COUNT_SIZE_THRESHOLD
)
{
// don't decrement ref count for small objects or language objects- this
// is
// pretty conservative and can be further finessed
mask
=
-
1
;
return
;
}
}
RFunction
fun
=
RArguments
.
getFunction
(
frame
);
if
(
fun
==
null
)
{
mask
=
-
1
;
return
;
}
Object
root
=
fun
.
getRootNode
();
if
(!(
root
instanceof
FunctionDefinitionNode
))
{
// root is RBuiltinRootNode
mask
=
-
1
;
return
;
}
FunctionDefinitionNode
fdn
=
(
FunctionDefinitionNode
)
root
;
PostProcessArgumentsNode
postProcessNode
=
fdn
.
getArgPostProcess
();
if
(
postProcessNode
==
null
)
{
// arguments to this function are not to be reference counted
mask
=
-
1
;
return
;
}
// this is needed for when FunctionDefinitionNode is split by the Truffle
// runtime
postProcessNode
=
postProcessNode
.
getActualNode
();
if
(
index
>=
Math
.
min
(
postProcessNode
.
getLength
(),
MAX_COUNTED_ARGS
))
{
mask
=
-
1
;
return
;
}
mask
=
1
<<
index
;
int
transArgsBitSet
=
postProcessNode
.
transArgsBitSet
;
postProcessNode
.
transArgsBitSet
=
transArgsBitSet
|
mask
;
writeArgNode
=
insert
(
WriteLocalFrameVariableNode
.
createForRefCount
(
Integer
.
valueOf
(
mask
)));
}
RFunction
fun
=
RArguments
.
getFunction
(
frame
);
if
(
fun
==
null
)
{
mask
=
-
1
;
return
;
}
Object
root
=
fun
.
getRootNode
();
if
(!(
root
instanceof
FunctionDefinitionNode
))
{
// root is RBuiltinRootNode
mask
=
-
1
;
return
;
}
FunctionDefinitionNode
fdn
=
(
FunctionDefinitionNode
)
root
;
PostProcessArgumentsNode
postProcessNode
=
fdn
.
getArgPostProcess
();
if
(
postProcessNode
==
null
)
{
// arguments to this function are not to be reference counted
mask
=
-
1
;
return
;
}
// this is needed for when FunctionDefinitionNode is split by the Truffle runtime
postProcessNode
=
postProcessNode
.
getActualNode
();
if
(
index
>=
Math
.
min
(
postProcessNode
.
getLength
(),
MAX_COUNTED_ARGS
))
{
mask
=
-
1
;
return
;
if
(
mask
!=
-
1
)
{
writeArgNode
.
execute
(
frame
,
shareable
);
}
mask
=
1
<<
index
;
int
transArgsBitSet
=
postProcessNode
.
transArgsBitSet
;
postProcessNode
.
transArgsBitSet
=
transArgsBitSet
|
mask
;
writeArgNode
=
insert
(
WriteLocalFrameVariableNode
.
createForRefCount
(
Integer
.
valueOf
(
mask
)));
}
if
(
mask
!=
-
1
)
{
writeArgNode
.
execute
(
frame
,
shareable
);
}
}
}
...
...
@@ -135,8 +137,7 @@ public abstract class ArgumentStatePush extends Node {
// this is expected to be used in rare cases where no RNode is easily available
if
(
o
instanceof
RShareable
)
{
RShareable
shareable
=
(
RShareable
)
o
;
// it's never decremented so no point in incrementing past shared state
if
(!
shareable
.
isShared
())
{
if
(!
shareable
.
isSharedPermanent
())
{
shareable
.
incRefCount
();
}
}
...
...
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