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
fd3b9913
Commit
fd3b9913
authored
10 years ago
by
Lukas Stadler
Browse files
Options
Downloads
Patches
Plain Diff
use special-purpose array copying in RArguments
parent
f05d2e88
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.runtime/src/com/oracle/truffle/r/runtime/RArguments.java
+17
-2
17 additions, 2 deletions
....runtime/src/com/oracle/truffle/r/runtime/RArguments.java
with
17 additions
and
2 deletions
com.oracle.truffle.r.runtime/src/com/oracle/truffle/r/runtime/RArguments.java
+
17
−
2
View file @
fd3b9913
...
...
@@ -23,6 +23,7 @@
package
com.oracle.truffle.r.runtime
;
import
com.oracle.truffle.api.frame.*
;
import
com.oracle.truffle.api.nodes.*
;
import
com.oracle.truffle.api.source.*
;
import
com.oracle.truffle.api.utilities.*
;
import
com.oracle.truffle.r.runtime.data.*
;
...
...
@@ -139,11 +140,25 @@ public final class RArguments {
a
[
INDEX_ENCLOSING_FRAME
]
=
enclosingFrame
;
a
[
INDEX_N_ARGS
]
=
evaluatedArgs
.
length
;
a
[
INDEX_N_NAMES
]
=
names
.
length
;
System
.
arraycopy
(
evaluatedArgs
,
0
,
a
,
INDEX_ARGUMENTS
,
evaluatedArgs
.
length
);
System
.
arraycopy
(
names
,
0
,
a
,
INDEX_ARGUMENTS
+
evaluatedArgs
.
length
,
names
.
length
);
copyArguments
(
evaluatedArgs
,
a
,
INDEX_ARGUMENTS
);
copyArguments
(
names
,
a
,
INDEX_ARGUMENTS
+
evaluatedArgs
.
length
);
assert
envFunctionInvariant
(
a
);
}
/**
* This method is used instead of System.arraycopy because the arraycopy would be optimized too
* late (after Truffle partial evaluation). At this late stage, there is no more information
* about the finalness of array contents, and according to the Java spec array contents can
* change at any point in time. Therefore, even though source is known at compile time, Graal
* would have to be conservative and keep the array copy.
*/
@ExplodeLoop
private
static
void
copyArguments
(
Object
[]
source
,
Object
[]
destination
,
int
position
)
{
for
(
int
i
=
0
;
i
<
source
.
length
;
i
++)
{
destination
[
position
+
i
]
=
source
[
i
];
}
}
private
static
boolean
envFunctionInvariant
(
Object
[]
a
)
{
return
!(
a
[
INDEX_ENVIRONMENT
]
==
null
&&
a
[
INDEX_FUNCTION
]
==
null
);
}
...
...
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