Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
40bb0243
Commit
40bb0243
authored
May 25, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
compiler: Don't create a closure if not needed.
From-SVN: r187897
parent
31a18a7e
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
11 additions
and
23 deletions
+11
-23
gcc/go/gofrontend/expressions.cc
+11
-23
No files found.
gcc/go/gofrontend/expressions.cc
View file @
40bb0243
...
...
@@ -1312,30 +1312,18 @@ Func_expression::do_get_tree(Translate_context* context)
&&
TREE_CODE
(
TREE_OPERAND
(
fnaddr
,
0
))
==
FUNCTION_DECL
);
TREE_ADDRESSABLE
(
TREE_OPERAND
(
fnaddr
,
0
))
=
1
;
// For a normal non-nested function call, that is all we have to do.
if
(
!
this
->
function_
->
is_function
()
||
this
->
function_
->
func_value
()
->
enclosing
()
==
NULL
)
{
go_assert
(
this
->
closure_
==
NULL
);
return
fnaddr
;
}
// If there is no closure, that is all have to do.
if
(
this
->
closure_
==
NULL
)
return
fnaddr
;
// For a nested function call, we have to always allocate a
// trampoline. If we don't always allocate, then closures will not
// be reliably distinct.
Expression
*
closure
=
this
->
closure_
;
tree
closure_tree
;
if
(
closure
==
NULL
)
closure_tree
=
null_pointer_node
;
else
{
// Get the value of the closure. This will be a pointer to
// space allocated on the heap.
closure_tree
=
closure
->
get_tree
(
context
);
if
(
closure_tree
==
error_mark_node
)
return
error_mark_node
;
go_assert
(
POINTER_TYPE_P
(
TREE_TYPE
(
closure_tree
)));
}
go_assert
(
this
->
function_
->
func_value
()
->
enclosing
()
!=
NULL
);
// Get the value of the closure. This will be a pointer to space
// allocated on the heap.
tree
closure_tree
=
this
->
closure_
->
get_tree
(
context
);
if
(
closure_tree
==
error_mark_node
)
return
error_mark_node
;
go_assert
(
POINTER_TYPE_P
(
TREE_TYPE
(
closure_tree
)));
// Now we need to build some code on the heap. This code will load
// the static chain pointer with the closure and then jump to the
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment