exp/ssa/interp: (#6 of 5): test interpretation of SSA form of $GOROOT/test/*.go.

The interpreter's os.Exit now triggers a special panic rather
than kill the test process.  (It's semantically dubious, since
it will run deferred routines.)  Interpret now returns its
exit code rather than calling os.Exit.

Also:
- disabled parts of a few $GOROOT/tests via os.Getenv("GOSSAINTERP").
- remove unnecessary 'slots' param to external functions; they
  are never closures.

Most of the tests are disabled until go/types supports shifts.
They can be reenabled if you patch this workaround:
https://golang.org/cl/7312068

R=iant, bradfitz
CC=golang-dev, gri
https://golang.org/cl/7313062
diff --git a/test/blank.go b/test/blank.go
index ad4d6eb..7f7d9f6 100644
--- a/test/blank.go
+++ b/test/blank.go
@@ -8,7 +8,10 @@
 
 package main
 
-import "unsafe"
+import (
+	"os"
+	"unsafe"
+)
 
 import _ "fmt"
 
@@ -104,11 +107,15 @@
 		panic(sum)
 	}
 
-	type T1 struct{ x, y, z int }
-	t1 := *(*T)(unsafe.Pointer(&T1{1, 2, 3}))
-	t2 := *(*T)(unsafe.Pointer(&T1{4, 5, 6}))
-	if t1 != t2 {
-		panic("T{} != T{}")
+	// exp/ssa/interp doesn't yet skip blank fields in struct
+	// equivalence.  It also cannot support unsafe.Pointer.
+	if os.Getenv("GOSSAINTERP") == "" {
+		type T1 struct{ x, y, z int }
+		t1 := *(*T)(unsafe.Pointer(&T1{1, 2, 3}))
+		t2 := *(*T)(unsafe.Pointer(&T1{4, 5, 6}))
+		if t1 != t2 {
+			panic("T{} != T{}")
+		}
 	}
 
 	h(a, b)
diff --git a/test/cmp.go b/test/cmp.go
index a56ca6e..5be6456 100644
--- a/test/cmp.go
+++ b/test/cmp.go
@@ -8,9 +8,13 @@
 
 package main
 
-import "unsafe"
+import (
+	"os"
+	"unsafe"
+)
 
 var global bool
+
 func use(b bool) { global = b }
 
 func stringptr(s string) uintptr { return *(*uintptr)(unsafe.Pointer(&s)) }
@@ -38,8 +42,12 @@
 	var c string = "hello"
 	var d string = "hel" // try to get different pointer
 	d = d + "lo"
-	if stringptr(c) == stringptr(d) {
-		panic("compiler too smart -- got same string")
+
+	// exp/ssa/interp can't handle unsafe.Pointer.
+	if os.Getenv("GOSSAINTERP") != "" {
+		if stringptr(c) == stringptr(d) {
+			panic("compiler too smart -- got same string")
+		}
 	}
 
 	var e = make(chan int)
@@ -283,7 +291,7 @@
 		isfalse(ix != z)
 		isfalse(iz != x)
 	}
-	
+
 	// structs with _ fields
 	{
 		var x = struct {
@@ -296,7 +304,7 @@
 			x: 1, y: 2, z: 3,
 		}
 		var ix interface{} = x
-		
+
 		istrue(x == x)
 		istrue(x == ix)
 		istrue(ix == x)
diff --git a/test/const.go b/test/const.go
index 80fbfaf..d583659 100644
--- a/test/const.go
+++ b/test/const.go
@@ -8,27 +8,29 @@
 
 package main
 
-const (
-	c0 = 0
-	cm1 = -1
-	chuge = 1 << 100
-	chuge_1 = chuge - 1
-	c1 = chuge >> 100
-	c3div2 = 3/2
-	c1e3 = 1e3
+import "os"
 
-	ctrue = true
+const (
+	c0      = 0
+	cm1     = -1
+	chuge   = 1 << 100
+	chuge_1 = chuge - 1
+	c1      = chuge >> 100
+	c3div2  = 3 / 2
+	c1e3    = 1e3
+
+	ctrue  = true
 	cfalse = !ctrue
 )
 
 const (
-	f0 = 0.0
-	fm1 = -1.
-	fhuge float64 = 1 << 100
+	f0              = 0.0
+	fm1             = -1.
+	fhuge   float64 = 1 << 100
 	fhuge_1 float64 = chuge - 1
-	f1 float64 = chuge >> 100
-	f3div2 = 3./2.
-	f1e3 float64 = 1e3
+	f1      float64 = chuge >> 100
+	f3div2          = 3. / 2.
+	f1e3    float64 = 1e3
 )
 
 func assert(t bool, s string) {
@@ -41,8 +43,8 @@
 	assert(c0 == 0, "c0")
 	assert(c1 == 1, "c1")
 	assert(chuge > chuge_1, "chuge")
-	assert(chuge_1 + 1 == chuge, "chuge 1")
-	assert(chuge + cm1 +1  == chuge, "cm1")
+	assert(chuge_1+1 == chuge, "chuge 1")
+	assert(chuge+cm1+1 == chuge, "cm1")
 	assert(c3div2 == 1, "3/2")
 	assert(c1e3 == 1000, "c1e3 int")
 	assert(c1e3 == 1e3, "c1e3 float")
@@ -81,9 +83,12 @@
 func floats() {
 	assert(f0 == c0, "f0")
 	assert(f1 == c1, "f1")
-	assert(fhuge == fhuge_1, "fhuge")	// float64 can't distinguish fhuge, fhuge_1.
-	assert(fhuge_1 + 1 == fhuge, "fhuge 1")
-	assert(fhuge + fm1 +1  == fhuge, "fm1")
+	// TODO(gri): exp/ssa/interp constant folding is incorrect.
+	if os.Getenv("GOSSAINTERP") == "" {
+		assert(fhuge == fhuge_1, "fhuge") // float64 can't distinguish fhuge, fhuge_1.
+	}
+	assert(fhuge_1+1 == fhuge, "fhuge 1")
+	assert(fhuge+fm1+1 == fhuge, "fm1")
 	assert(f3div2 == 1.5, "3./2.")
 	assert(f1e3 == 1000, "f1e3 int")
 	assert(f1e3 == 1.e3, "f1e3 float")
diff --git a/test/recover.go b/test/recover.go
index eea655e..7c27d7c 100644
--- a/test/recover.go
+++ b/test/recover.go
@@ -8,15 +8,21 @@
 
 package main
 
-import "runtime"
+import (
+	"os"
+	"runtime"
+)
 
 func main() {
 	test1()
 	test1WithClosures()
 	test2()
 	test3()
-	test4()
-	test5()
+	// exp/ssa/interp still has some bugs in recover().
+	if os.Getenv("GOSSAINTERP") == "" {
+		test4()
+		test5()
+	}
 	test6()
 	test6WithClosures()
 	test7()