Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(10)

Delta Between Two Patch Sets: go/ssa/interp/interp.go

Issue 87210044: go.tools/go/ssa: emit a recover block if the function's... (Closed)
Left Patch Set: Created 10 years, 12 months ago
Right Patch Set: diff -r 6f5d6de34e1f https://code.google.com/p/go.tools Created 10 years, 10 months ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Right: Side by side diff | Download
« go/ssa/builder.go ('K') | « go/ssa/builder.go ('k') | no next file » | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
1 // Copyright 2013 The Go Authors. All rights reserved. 1 // Copyright 2013 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 // Package ssa/interp defines an interpreter for the SSA 5 // Package ssa/interp defines an interpreter for the SSA
6 // representation of Go programs. 6 // representation of Go programs.
7 // 7 //
8 // This interpreter is provided as an adjunct for testing the SSA 8 // This interpreter is provided as an adjunct for testing the SSA
9 // construction algorithm. Its purpose is to provide a minimal 9 // construction algorithm. Its purpose is to provide a minimal
10 // metacircular implementation of the dynamic semantics of each SSA 10 // metacircular implementation of the dynamic semantics of each SSA
(...skipping 537 matching lines...) Expand 10 before | Expand all | Expand 10 after
548 if fr.i.mode&DisableRecover != 0 { 548 if fr.i.mode&DisableRecover != 0 {
549 return // let interpreter crash 549 return // let interpreter crash
550 } 550 }
551 fr.panicking = true 551 fr.panicking = true
552 fr.panic = recover() 552 fr.panic = recover()
553 if fr.i.mode&EnableTracing != 0 { 553 if fr.i.mode&EnableTracing != 0 {
554 fmt.Fprintf(os.Stderr, "Panicking: %T %v.\n", fr.panic, fr.panic) 554 fmt.Fprintf(os.Stderr, "Panicking: %T %v.\n", fr.panic, fr.panic)
555 } 555 }
556 fr.runDefers() 556 fr.runDefers()
557 fr.block = fr.fn.Recover 557 fr.block = fr.fn.Recover
558 if fr.block == nil {
559 fr.result = zero(fr.fn.Signature.Results())
560 }
561 }() 558 }()
562 559
563 for { 560 for {
564 if fr.i.mode&EnableTracing != 0 { 561 if fr.i.mode&EnableTracing != 0 {
565 fmt.Fprintf(os.Stderr, ".%s:\n", fr.block) 562 fmt.Fprintf(os.Stderr, ".%s:\n", fr.block)
566 } 563 }
567 block: 564 block:
568 for _, instr := range fr.block.Instrs { 565 for _, instr := range fr.block.Instrs {
569 if fr.i.mode&EnableTracing != 0 { 566 if fr.i.mode&EnableTracing != 0 {
570 if v, ok := instr.(ssa.Value); ok { 567 if v, ok := instr.(ssa.Value); ok {
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
722 } 719 }
723 720
724 // deref returns a pointer's element type; otherwise it returns typ. 721 // deref returns a pointer's element type; otherwise it returns typ.
725 // TODO(adonovan): Import from ssa? 722 // TODO(adonovan): Import from ssa?
726 func deref(typ types.Type) types.Type { 723 func deref(typ types.Type) types.Type {
727 if p, ok := typ.Underlying().(*types.Pointer); ok { 724 if p, ok := typ.Underlying().(*types.Pointer); ok {
728 return p.Elem() 725 return p.Elem()
729 } 726 }
730 return typ 727 return typ
731 } 728 }
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b