]> Cypherpunks.ru repositories - gostls13.git/commitdiff
cmd/gc: must not inline panic, recover
authorRuss Cox <rsc@golang.org>
Mon, 5 Mar 2012 18:51:44 +0000 (13:51 -0500)
committerRuss Cox <rsc@golang.org>
Mon, 5 Mar 2012 18:51:44 +0000 (13:51 -0500)
R=lvd, gri
CC=golang-dev
https://golang.org/cl/5731061

src/cmd/gc/inl.c
test/escape4.go

index 96080cbfaf950ac60d8c1efc8e6c5bc1d54d271d..efce56057d55e55d8c513b150441aa3f83736743 100644 (file)
@@ -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;
index ab3aee22443a3897def4a8bb6da45394b305cd6e..887570896306c69e7fd455b09ea603be1ee51396 100644 (file)
@@ -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() }