mirror of
https://github.com/golang/go
synced 2024-11-23 15:30:05 -07:00
cmd/compile: remove ignored bool from exported ODCL nodes
This shortens the export format by 1 byte for each exported ODCL node in inlined function bodies. Maintain backward compatibility by updating format version and continue to accept older format. Change-Id: I549bb3ade90bc0f146decf8016d5c9c3f14eb293 Reviewed-on: https://go-review.googlesource.com/27999 Run-TryBot: Robert Griesemer <gri@golang.org> Reviewed-by: Matthew Dempsky <mdempsky@google.com>
This commit is contained in:
parent
428d79bd38
commit
595cebb055
@ -158,7 +158,7 @@ const debugFormat = false // default: false
|
||||
const forceObjFileStability = true
|
||||
|
||||
// Current export format version. Increase with each format change.
|
||||
const exportVersion = 1
|
||||
const exportVersion = 2
|
||||
|
||||
// exportInlined enables the export of inlined function bodies and related
|
||||
// dependencies. The compiler should work w/o any loss of functionality with
|
||||
@ -1418,17 +1418,7 @@ func (p *exporter) stmt(n *Node) {
|
||||
switch op := n.Op; op {
|
||||
case ODCL:
|
||||
p.op(ODCL)
|
||||
switch n.Left.Class {
|
||||
case PPARAM, PPARAMOUT, PAUTO, PAUTOHEAP:
|
||||
// TODO(gri) when is this not PAUTO?
|
||||
// Also, originally this didn't look like
|
||||
// the default case. Investigate.
|
||||
fallthrough
|
||||
default:
|
||||
// TODO(gri) Can we ever reach here?
|
||||
p.bool(false)
|
||||
p.sym(n.Left)
|
||||
}
|
||||
p.sym(n.Left)
|
||||
p.typ(n.Left.Type)
|
||||
|
||||
// case ODCLFIELD:
|
||||
|
@ -86,10 +86,10 @@ func Import(in *bufio.Reader) {
|
||||
|
||||
// read version specific flags - extend as necessary
|
||||
switch p.version {
|
||||
// case 2:
|
||||
// case 3:
|
||||
// ...
|
||||
// fallthrough
|
||||
case 1:
|
||||
case 2, 1:
|
||||
p.debugFormat = p.rawStringln(p.rawByte()) == "debug"
|
||||
p.trackAllTypes = p.bool()
|
||||
p.posInfoFormat = p.bool()
|
||||
@ -1000,14 +1000,14 @@ func (p *importer) node() *Node {
|
||||
// --------------------------------------------------------------------
|
||||
// statements
|
||||
case ODCL:
|
||||
var lhs *Node
|
||||
if p.bool() {
|
||||
lhs = p.expr()
|
||||
} else {
|
||||
lhs = dclname(p.sym())
|
||||
if p.version < 2 {
|
||||
// versions 0 and 1 exported a bool here but it
|
||||
// was always false - simply ignore in this case
|
||||
p.bool()
|
||||
}
|
||||
// TODO(gri) avoid list created here!
|
||||
return liststmt(variter([]*Node{lhs}, typenod(p.typ()), nil))
|
||||
lhs := dclname(p.sym())
|
||||
typ := typenod(p.typ())
|
||||
return liststmt(variter([]*Node{lhs}, typ, nil)) // TODO(gri) avoid list creation
|
||||
|
||||
// case ODCLFIELD:
|
||||
// unimplemented
|
||||
|
@ -3,7 +3,7 @@
|
||||
package gc
|
||||
|
||||
const runtimeimport = "" +
|
||||
"version 1\n\n\x00\x00\x01\rruntime\x00\t\x11newobject\x00\x02\x17\"\vt" +
|
||||
"version 2\n\n\x00\x00\x01\rruntime\x00\t\x11newobject\x00\x02\x17\"\vt" +
|
||||
"yp·2\x00\x00\x01\x17:\x00\t\x13panicindex\x00\x00\x00\t\x13panicslice\x00\x00" +
|
||||
"\x00\t\x15panicdivide\x00\x00\x00\t\x15throwreturn\x00\x00\x00\t\x11throw" +
|
||||
"init\x00\x00\x00\t\x11panicwrap\x00\x05 \x00 \x00 \x00\x00\t\rgopanic\x00\x01\x1b\x00" +
|
||||
@ -106,6 +106,6 @@ const runtimeimport = "" +
|
||||
"b\x16\x98\x03\x00b\x00\v\xf8\x01\v\x00\x01\x00\n$$\n"
|
||||
|
||||
const unsafeimport = "" +
|
||||
"version 1\n\n\x00\x00\x01\vunsafe\x00\x05\r\rPointer\x00\x16\x00\t\x0fOff" +
|
||||
"version 2\n\n\x00\x00\x01\vunsafe\x00\x05\r\rPointer\x00\x16\x00\t\x0fOff" +
|
||||
"setof\x00\x01:\x00\x01\x16\x00\t\vSizeof\x00\x01:\x00\x01\x16\x00\t\rAlignof\x00\x01:\x00" +
|
||||
"\x01\x16\x00\v\b\v\x00\x01\x00\n$$\n"
|
||||
|
@ -93,10 +93,10 @@ func BImportData(imports map[string]*types.Package, data []byte, path string) (_
|
||||
|
||||
// read version specific flags - extend as necessary
|
||||
switch p.version {
|
||||
// case 2:
|
||||
// case 3:
|
||||
// ...
|
||||
// fallthrough
|
||||
case 1:
|
||||
case 2, 1:
|
||||
p.debugFormat = p.rawStringln(p.rawByte()) == "debug"
|
||||
p.trackAllTypes = p.int() != 0
|
||||
p.posInfoFormat = p.int() != 0
|
||||
|
Loading…
Reference in New Issue
Block a user