diff --git a/ssa/interp/interp.go b/ssa/interp/interp.go index 59c81cd9..5d8cf0fd 100644 --- a/ssa/interp/interp.go +++ b/ssa/interp/interp.go @@ -613,6 +613,8 @@ func setGlobal(i *interpreter, pkg *ssa.Package, name string, v value) { panic("no global variable: " + pkg.Object.Path() + "." + name) } +var stdSizes = types.StdSizes{WordSize: 8, MaxAlign: 8} + // Interpret interprets the Go program whose main package is mainpkg. // mode specifies various interpreter options. filename and args are // the initial values of os.Args for the target program. @@ -659,7 +661,7 @@ func Interpret(mainpkg *ssa.Package, mode Mode, filename string, args []string) case "runtime": // (Assumes no custom Sizeof used during SSA construction.) - sz := types.DefaultSizeof(pkg.Object.Scope().Lookup("MemStats").Type()) + sz := stdSizes.Sizeof(pkg.Object.Scope().Lookup("MemStats").Type()) setGlobal(i, pkg, "sizeof_C_MStats", uintptr(sz)) case "os": diff --git a/ssa/interp/reflect.go b/ssa/interp/reflect.go index ef74a2da..f2048f2d 100644 --- a/ssa/interp/reflect.go +++ b/ssa/interp/reflect.go @@ -162,7 +162,7 @@ func ext۰reflect۰rtype۰Out(fn *ssa.Function, args []value) value { func ext۰reflect۰rtype۰Size(fn *ssa.Function, args []value) value { // Signature: func (t reflect.rtype) uintptr // (Assumes no custom Sizeof used during SSA construction.) - return uintptr(types.DefaultSizeof(args[0].(rtype).t)) + return uintptr(stdSizes.Sizeof(args[0].(rtype).t)) } func ext۰reflect۰rtype۰String(fn *ssa.Function, args []value) value {