Commit ba1d5571 authored by Alan Donovan's avatar Alan Donovan

exp/ssa/interp: uncomment tests now passing thanks to recent typechecker fixes.

Also: add support for pointer conversions, covered by one new test.

R=gri, bradfitz, dave
CC=golang-dev
https://golang.org/cl/7435047
parent 139160eb
...@@ -71,43 +71,41 @@ var gorootTests = []string{ ...@@ -71,43 +71,41 @@ var gorootTests = []string{
"bigmap.go", "bigmap.go",
"func.go", "func.go",
"reorder2.go", "reorder2.go",
// The following tests are disabled until the typechecker supports shifts correctly. "closure.go",
// They can be enabled if you patch workaround https://codereview.appspot.com/7312068. "gc.go",
// "closure.go", "goprint.go", // doesn't actually assert anything
// "gc.go", "utf.go",
// "goprint.go", // doesn't actually assert anything
// "utf.go",
"method.go", "method.go",
// "char_lit.go", "char_lit.go",
//"env.go", "env.go",
// "int_lit.go", "int_lit.go",
// "string_lit.go", "string_lit.go",
// "defer.go", "defer.go",
// "typeswitch.go", "typeswitch.go",
// "stringrange.go", "stringrange.go",
// "reorder.go", "reorder.go",
"literal.go", "literal.go",
// "nul1.go", "nul1.go",
// "zerodivide.go", "zerodivide.go",
// "convert.go", "convert.go",
"convT2X.go", "convT2X.go",
// "switch.go", "initialize.go",
// "initialize.go", "ddd.go",
// "blank.go", // partly disabled; TODO(adonovan): skip blank fields in struct{_} equivalence. "blank.go", // partly disabled; TODO(adonovan): skip blank fields in struct{_} equivalence.
// "map.go", "map.go",
// "bom.go", "bom.go",
// "closedchan.go", "closedchan.go",
// "divide.go", "divide.go",
// "rename.go", "rename.go",
// "const3.go", "const3.go",
// "nil.go", "nil.go",
// "recover.go", // partly disabled; TODO(adonovan): fix. "recover.go", // partly disabled; TODO(adonovan): fix.
// Slow tests follow. // Slow tests follow.
// "cmplxdivide.go cmplxdivide1.go", "cmplxdivide.go cmplxdivide1.go",
// "append.go", "append.go",
// "crlf.go", // doesn't actually assert anything "crlf.go", // doesn't actually assert anything
//"typeswitch1.go", "typeswitch1.go",
// "floatcmp.go", "floatcmp.go",
"gc1.go", "gc1.go",
// Working, but not worth enabling: // Working, but not worth enabling:
...@@ -119,22 +117,26 @@ var gorootTests = []string{ ...@@ -119,22 +117,26 @@ var gorootTests = []string{
// "const.go", // works but for but one bug: constant folder doesn't consider representations. // "const.go", // works but for but one bug: constant folder doesn't consider representations.
// "init1.go", // too slow (80s) and not that interesting. Cheats on ReadMemStats check too. // "init1.go", // too slow (80s) and not that interesting. Cheats on ReadMemStats check too.
// Typechecker failures:
// "switch.go", // bug re: switch ... { case 1.0:... case 1:... }
// "iota.go", // crash
// "rune.go", // error re: rune as index
// "64bit.go", // error re: comparison
// "cmp.go", // error re: comparison
// "rotate.go rotate0.go", // error re: shifts
// "rotate.go rotate1.go", // error re: shifts
// "rotate.go rotate2.go", // error re: shifts
// "rotate.go rotate3.go", // error re: shifts
// "run.go", // produces wrong constant for bufio.runeError; also, not really a test.
// Broken. TODO(adonovan): fix. // Broken. TODO(adonovan): fix.
// ddd.go // builder: variadic methods
// copy.go // very slow; but with N=4 quickly crashes, slice index out of range. // copy.go // very slow; but with N=4 quickly crashes, slice index out of range.
// nilptr.go // interp: V > uintptr not implemented. Slow test, lots of mem // nilptr.go // interp: V > uintptr not implemented. Slow test, lots of mem
// iota.go // typechecker: crash
// rotate.go // typechecker: shifts
// rune.go // typechecker: shifts
// 64bit.go // typechecker: shifts
// cmp.go // typechecker: comparison
// recover1.go // error: "spurious recover" // recover1.go // error: "spurious recover"
// recover2.go // panic: interface conversion: string is not error: missing method Error // recover2.go // panic: interface conversion: string is not error: missing method Error
// recover3.go // logic errors: panicked with wrong Error. // recover3.go // logic errors: panicked with wrong Error.
// simassign.go // requires support for f(f(x,y)). // simassign.go // requires support for f(f(x,y)).
// method3.go // Fails dynamically; (*T).f vs (T).f are distinct methods. // method3.go // Fails dynamically; (*T).f vs (T).f are distinct methods.
// ddd2.go // fails
// run.go // rtype.NumOut not yet implemented. Not really a test though.
// args.go // works, but requires specific os.Args from the driver. // args.go // works, but requires specific os.Args from the driver.
// index.go // a template, not a real test. // index.go // a template, not a real test.
// mallocfin.go // SetFinalizer not implemented. // mallocfin.go // SetFinalizer not implemented.
...@@ -145,7 +147,7 @@ var gorootTests = []string{ ...@@ -145,7 +147,7 @@ var gorootTests = []string{
// These are files in exp/ssa/interp/testdata/. // These are files in exp/ssa/interp/testdata/.
var testdataTests = []string{ var testdataTests = []string{
// "coverage.go", // shifts "coverage.go",
} }
func run(t *testing.T, dir, input string) bool { func run(t *testing.T, dir, input string) bool {
......
...@@ -226,7 +226,6 @@ func zero(t types.Type) value { ...@@ -226,7 +226,6 @@ func zero(t types.Type) value {
return map[value]value(nil) return map[value]value(nil)
} }
return (*hashmap)(nil) return (*hashmap)(nil)
case *types.Signature: case *types.Signature:
return (*ssa.Function)(nil) return (*ssa.Function)(nil)
} }
...@@ -1136,11 +1135,14 @@ func conv(t_dst, t_src types.Type, x value) value { ...@@ -1136,11 +1135,14 @@ func conv(t_dst, t_src types.Type, x value) value {
return x return x
case *types.Pointer: case *types.Pointer:
switch ut_dst := ut_dst.(type) {
case *types.Basic:
// *value to unsafe.Pointer? // *value to unsafe.Pointer?
if ut_dst, ok := ut_dst.(*types.Basic); ok {
if ut_dst.Kind == types.UnsafePointer { if ut_dst.Kind == types.UnsafePointer {
return unsafe.Pointer(x.(*value)) return unsafe.Pointer(x.(*value))
} }
case *types.Pointer:
return x
} }
case *types.Slice: case *types.Slice:
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment