Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
cae604f7
Commit
cae604f7
authored
Mar 05, 2012
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cmd/gc: must not inline panic, recover
R=lvd, gri CC=golang-dev
https://golang.org/cl/5731061
parent
5ab9d2be
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
15 additions
and
7 deletions
+15
-7
src/cmd/gc/inl.c
src/cmd/gc/inl.c
+2
-0
test/escape4.go
test/escape4.go
+13
-7
No files found.
src/cmd/gc/inl.c
View file @
cae604f7
...
...
@@ -182,6 +182,8 @@ ishairy(Node *n, int *budget)
case
OCALLFUNC
:
case
OCALLINTER
:
case
OCALLMETH
:
case
OPANIC
:
case
ORECOVER
:
if
(
debug
[
'l'
]
<
4
)
return
1
;
break
;
...
...
test/escape4.go
View file @
cae604f7
...
...
@@ -11,8 +11,8 @@ package foo
var
p
*
int
func
alloc
(
x
int
)
*
int
{
// ERROR "can inline alloc" "moved to heap: x"
return
&
x
// ERROR "&x escapes to heap"
func
alloc
(
x
int
)
*
int
{
// ERROR "can inline alloc" "moved to heap: x"
return
&
x
// ERROR "&x escapes to heap"
}
var
f
func
()
...
...
@@ -22,12 +22,18 @@ func f1() {
// Escape analysis used to miss inlined code in closures.
func
()
{
// ERROR "func literal does not escape"
p
=
alloc
(
3
)
// ERROR "inlining call to alloc" "&x escapes to heap" "moved to heap: x"
func
()
{
// ERROR "func literal does not escape"
p
=
alloc
(
3
)
// ERROR "inlining call to alloc" "&x escapes to heap" "moved to heap: x"
}()
f
=
func
()
{
// ERROR "func literal escapes to heap"
p
=
alloc
(
3
)
// ERROR "inlining call to alloc" "&x escapes to heap" "moved to heap: x"
f
=
func
()
{
// ERROR "func literal escapes to heap"
p
=
alloc
(
3
)
// ERROR "inlining call to alloc" "&x escapes to heap" "moved to heap: x"
}
f
()
}
func
f2
()
{}
// ERROR "can inline f2"
// No inline for panic, recover.
func
f3
()
{
panic
(
1
)
}
func
f4
()
{
recover
()
}
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