vdl: Add generated vars for TypeOf, for better performance.

Also changed vdl.Decoder.StartValue to take a *vdl.Type argument,
and perform the compatibility check.  This gives up to an
additional 10% improvement, and makes it easier to optimize the
compatibility check in the future, since it's now only performed
by the 3 decoders (vom, vdl.Value and vdl.pipe).

Some numbers.  In general all the generated stuff gets better:
                                 old ns/op  new ns/op   delta
RpcRequestZeroSingleShotEncode     51010      41028    -19.57%
RpcRequestZeroRepeatedEncode         302        194    -35.76%
RpcRequestZeroSingleShotDecode      1962       1636    -16.62%
RpcRequestZeroRepeatedDecode         484        281    -41.94%
RpcRequestFullSingleShotEncode     63755      47481    -25.53%
RpcRequestFullRepeatedEncode        9407       5558    -40.92%
RpcRequestFullSingleShotDecode     58886      58863     -0.04%
RpcRequestFullRepeatedDecode       55303      54106     -2.16%
RpcResponseZeroSingleShotEncode    51700      40604    -21.46%
RpcResponseZeroRepeatedEncode        635        514    -19.06%
RpcResponseZeroSingleShotDecode     2026       1755    -13.38%
RpcResponseZeroRepeatedDecode        524        304    -41.98%
RpcResponseFullSingleShotEncode   106038      91816    -13.41%
RpcResponseFullRepeatedEncode      44273      42005     -5.12%
RpcResponseFullSingleShotDecode    43271      42635     -1.47%
RpcResponseFullRepeatedDecode      38608      37251     -3.51%

For some reason, the reflect version of large-list single-shot
encoding gets much worse.  I'm not sure why.  But I'm going to
ignore that for now, since I think there's plenty of other
optimizations we can explore.
                                  old ns/op  new ns/op   delta
LargeListSingleShotEncodeReflect   19279360   21696617  +12.54%
LargeListRepeatedEncodeReflect     19055693   19550742   +2.60%
LargeListSingleShotDecodeReflect   34161615   32556162   -4.70%
LargeListRepeatedDecodeReflect     33647837   31846309   -5.35%
LargeListSingleShotEncode           3951128    3984021   +0.83%
LargeListRepeatedEncode             3870694    3895734   +0.65%
LargeListSingleShotDecode           5221050    5465362   +4.68%
LargeListRepeatedDecode             5211915    5246888   +0.67%

MultiPart: 4/5
Change-Id: Ic5d7e80d12146fb18c8de5861b381db4ba8b7e9b
diff --git a/go/src/v.io/x/lock/lock.vdl.go b/go/src/v.io/x/lock/lock.vdl.go
index f4c1635..e23f82b 100644
--- a/go/src/v.io/x/lock/lock.vdl.go
+++ b/go/src/v.io/x/lock/lock.vdl.go
@@ -45,7 +45,7 @@
 }
 
 func (x LockStatus) VDLWrite(enc vdl.Encoder) error {
-	if err := enc.StartValue(vdl.TypeOf((*LockStatus)(nil))); err != nil {
+	if err := enc.StartValue(__VDLType_int32_1); err != nil {
 		return err
 	}
 	if err := enc.EncodeInt(int64(x)); err != nil {
@@ -55,7 +55,7 @@
 }
 
 func (x *LockStatus) VDLRead(dec vdl.Decoder) error {
-	if err := dec.StartValue(); err != nil {
+	if err := dec.StartValue(__VDLType_int32_1); err != nil {
 		return err
 	}
 	tmp, err := dec.DecodeInt(32)
@@ -352,6 +352,11 @@
 	},
 }
 
+// Hold type definitions in package-level variables, for better performance.
+var (
+	__VDLType_int32_1 *vdl.Type
+)
+
 var __VDLInitCalled bool
 
 // __VDLInit performs vdl initialization.  It is safe to call multiple times.
@@ -376,5 +381,8 @@
 	// Register types.
 	vdl.Register((*LockStatus)(nil))
 
+	// Initialize type definitions.
+	__VDLType_int32_1 = vdl.TypeOf((*LockStatus)(nil))
+
 	return struct{}{}
 }