github.com/sagernet/gvisor@v0.0.0-20240428053021-e691de28565f/pkg/marshal/primitive/primitive_abi_autogen_unsafe.go (about)

     1  // Automatically generated marshal implementation. See tools/go_marshal.
     2  
     3  package primitive
     4  
     5  import (
     6      "github.com/sagernet/gvisor/pkg/gohacks"
     7      "github.com/sagernet/gvisor/pkg/hostarch"
     8      "github.com/sagernet/gvisor/pkg/marshal"
     9      "io"
    10      "reflect"
    11      "runtime"
    12      "unsafe"
    13  )
    14  
    15  // Marshallable types used by this file.
    16  var _ marshal.Marshallable = (*Int16)(nil)
    17  var _ marshal.Marshallable = (*Int32)(nil)
    18  var _ marshal.Marshallable = (*Int64)(nil)
    19  var _ marshal.Marshallable = (*Int8)(nil)
    20  var _ marshal.Marshallable = (*Uint16)(nil)
    21  var _ marshal.Marshallable = (*Uint32)(nil)
    22  var _ marshal.Marshallable = (*Uint64)(nil)
    23  var _ marshal.Marshallable = (*Uint8)(nil)
    24  
    25  // SizeBytes implements marshal.Marshallable.SizeBytes.
    26  //go:nosplit
    27  func (i *Int16) SizeBytes() int {
    28      return 2
    29  }
    30  
    31  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
    32  func (i *Int16) MarshalBytes(dst []byte) []byte {
    33      hostarch.ByteOrder.PutUint16(dst[:2], uint16(*i))
    34      return dst[2:]
    35  }
    36  
    37  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
    38  func (i *Int16) UnmarshalBytes(src []byte) []byte {
    39      *i = Int16(int16(hostarch.ByteOrder.Uint16(src[:2])))
    40      return src[2:]
    41  }
    42  
    43  // Packed implements marshal.Marshallable.Packed.
    44  //go:nosplit
    45  func (i *Int16) Packed() bool {
    46      // Scalar newtypes are always packed.
    47      return true
    48  }
    49  
    50  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
    51  func (i *Int16) MarshalUnsafe(dst []byte) []byte {
    52      size := i.SizeBytes()
    53      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
    54      return dst[size:]
    55  }
    56  
    57  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
    58  func (i *Int16) UnmarshalUnsafe(src []byte) []byte {
    59      size := i.SizeBytes()
    60      gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
    61      return src[size:]
    62  }
    63  
    64  // CopyOutN implements marshal.Marshallable.CopyOutN.
    65  func (i *Int16) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
    66      // Construct a slice backed by dst's underlying memory.
    67      var buf []byte
    68      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
    69      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
    70      hdr.Len = i.SizeBytes()
    71      hdr.Cap = i.SizeBytes()
    72  
    73      length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
    74      // Since we bypassed the compiler's escape analysis, indicate that i
    75      // must live until the use above.
    76      runtime.KeepAlive(i) // escapes: replaced by intrinsic.
    77      return length, err
    78  }
    79  
    80  // CopyOut implements marshal.Marshallable.CopyOut.
    81  func (i *Int16) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
    82      return i.CopyOutN(cc, addr, i.SizeBytes())
    83  }
    84  
    85  // CopyInN implements marshal.Marshallable.CopyInN.
    86  func (i *Int16) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
    87      // Construct a slice backed by dst's underlying memory.
    88      var buf []byte
    89      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
    90      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
    91      hdr.Len = i.SizeBytes()
    92      hdr.Cap = i.SizeBytes()
    93  
    94      length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay.
    95      // Since we bypassed the compiler's escape analysis, indicate that i
    96      // must live until the use above.
    97      runtime.KeepAlive(i) // escapes: replaced by intrinsic.
    98      return length, err
    99  }
   100  
   101  // CopyIn implements marshal.Marshallable.CopyIn.
   102  func (i *Int16) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   103      return i.CopyInN(cc, addr, i.SizeBytes())
   104  }
   105  
   106  // WriteTo implements io.WriterTo.WriteTo.
   107  func (i *Int16) WriteTo(writer io.Writer) (int64, error) {
   108      // Construct a slice backed by dst's underlying memory.
   109      var buf []byte
   110      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   111      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   112      hdr.Len = i.SizeBytes()
   113      hdr.Cap = i.SizeBytes()
   114  
   115      length, err := writer.Write(buf)
   116      // Since we bypassed the compiler's escape analysis, indicate that i
   117      // must live until the use above.
   118      runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   119      return int64(length), err
   120  }
   121  
   122  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
   123  func (i *Int16) CheckedMarshal(dst []byte) ([]byte, bool) {
   124      size := i.SizeBytes()
   125      if size > len(dst) {
   126          return dst, false
   127      }
   128      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
   129      return dst[size:], true
   130  }
   131  
   132  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
   133  func (i *Int16) CheckedUnmarshal(src []byte) ([]byte, bool) {
   134      size := i.SizeBytes()
   135      if size > len(src) {
   136          return src, false
   137      }
   138      gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
   139      return src[size:], true
   140  }
   141  
   142  // CopyInt16SliceIn copies in a slice of int16 objects from the task's memory.
   143  func CopyInt16SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []int16) (int, error) {
   144      count := len(dst)
   145      if count == 0 {
   146          return 0, nil
   147      }
   148      size := (*Int16)(nil).SizeBytes()
   149  
   150      ptr := unsafe.Pointer(&dst)
   151      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   152  
   153      // Construct a slice backed by dst's underlying memory.
   154      var buf []byte
   155      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   156      hdr.Data = uintptr(val)
   157      hdr.Len = size * count
   158      hdr.Cap = size * count
   159  
   160      length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   161      // Since we bypassed the compiler's escape analysis, indicate that dst
   162      // must live until the use above.
   163      runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
   164      return length, err
   165  }
   166  
   167  // CopyInt16SliceOut copies a slice of int16 objects to the task's memory.
   168  func CopyInt16SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []int16) (int, error) {
   169      count := len(src)
   170      if count == 0 {
   171          return 0, nil
   172      }
   173      size := (*Int16)(nil).SizeBytes()
   174  
   175      ptr := unsafe.Pointer(&src)
   176      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   177  
   178      // Construct a slice backed by dst's underlying memory.
   179      var buf []byte
   180      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   181      hdr.Data = uintptr(val)
   182      hdr.Len = size * count
   183      hdr.Cap = size * count
   184  
   185      length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
   186      // Since we bypassed the compiler's escape analysis, indicate that src
   187      // must live until the use above.
   188      runtime.KeepAlive(src) // escapes: replaced by intrinsic.
   189      return length, err
   190  }
   191  
   192  // MarshalUnsafeInt16Slice is like Int16.MarshalUnsafe, but for a []Int16.
   193  func MarshalUnsafeInt16Slice(src []Int16, dst []byte) []byte {
   194      count := len(src)
   195      if count == 0 {
   196          return dst
   197      }
   198      size := (*Int16)(nil).SizeBytes()
   199  
   200      buf := dst[:size*count]
   201      gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
   202      return dst[size*count:]
   203  }
   204  
   205  // UnmarshalUnsafeInt16Slice is like Int16.UnmarshalUnsafe, but for a []Int16.
   206  func UnmarshalUnsafeInt16Slice(dst []Int16, src []byte) []byte {
   207      count := len(dst)
   208      if count == 0 {
   209          return src
   210      }
   211      size := (*Int16)(nil).SizeBytes()
   212  
   213      buf := src[:size*count]
   214      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
   215      return src[size*count:]
   216  }
   217  
   218  // SizeBytes implements marshal.Marshallable.SizeBytes.
   219  //go:nosplit
   220  func (i *Int32) SizeBytes() int {
   221      return 4
   222  }
   223  
   224  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   225  func (i *Int32) MarshalBytes(dst []byte) []byte {
   226      hostarch.ByteOrder.PutUint32(dst[:4], uint32(*i))
   227      return dst[4:]
   228  }
   229  
   230  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
   231  func (i *Int32) UnmarshalBytes(src []byte) []byte {
   232      *i = Int32(int32(hostarch.ByteOrder.Uint32(src[:4])))
   233      return src[4:]
   234  }
   235  
   236  // Packed implements marshal.Marshallable.Packed.
   237  //go:nosplit
   238  func (i *Int32) Packed() bool {
   239      // Scalar newtypes are always packed.
   240      return true
   241  }
   242  
   243  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
   244  func (i *Int32) MarshalUnsafe(dst []byte) []byte {
   245      size := i.SizeBytes()
   246      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
   247      return dst[size:]
   248  }
   249  
   250  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
   251  func (i *Int32) UnmarshalUnsafe(src []byte) []byte {
   252      size := i.SizeBytes()
   253      gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
   254      return src[size:]
   255  }
   256  
   257  // CopyOutN implements marshal.Marshallable.CopyOutN.
   258  func (i *Int32) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   259      // Construct a slice backed by dst's underlying memory.
   260      var buf []byte
   261      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   262      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   263      hdr.Len = i.SizeBytes()
   264      hdr.Cap = i.SizeBytes()
   265  
   266      length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
   267      // Since we bypassed the compiler's escape analysis, indicate that i
   268      // must live until the use above.
   269      runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   270      return length, err
   271  }
   272  
   273  // CopyOut implements marshal.Marshallable.CopyOut.
   274  func (i *Int32) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   275      return i.CopyOutN(cc, addr, i.SizeBytes())
   276  }
   277  
   278  // CopyInN implements marshal.Marshallable.CopyInN.
   279  func (i *Int32) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   280      // Construct a slice backed by dst's underlying memory.
   281      var buf []byte
   282      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   283      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   284      hdr.Len = i.SizeBytes()
   285      hdr.Cap = i.SizeBytes()
   286  
   287      length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay.
   288      // Since we bypassed the compiler's escape analysis, indicate that i
   289      // must live until the use above.
   290      runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   291      return length, err
   292  }
   293  
   294  // CopyIn implements marshal.Marshallable.CopyIn.
   295  func (i *Int32) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   296      return i.CopyInN(cc, addr, i.SizeBytes())
   297  }
   298  
   299  // WriteTo implements io.WriterTo.WriteTo.
   300  func (i *Int32) WriteTo(writer io.Writer) (int64, error) {
   301      // Construct a slice backed by dst's underlying memory.
   302      var buf []byte
   303      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   304      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   305      hdr.Len = i.SizeBytes()
   306      hdr.Cap = i.SizeBytes()
   307  
   308      length, err := writer.Write(buf)
   309      // Since we bypassed the compiler's escape analysis, indicate that i
   310      // must live until the use above.
   311      runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   312      return int64(length), err
   313  }
   314  
   315  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
   316  func (i *Int32) CheckedMarshal(dst []byte) ([]byte, bool) {
   317      size := i.SizeBytes()
   318      if size > len(dst) {
   319          return dst, false
   320      }
   321      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
   322      return dst[size:], true
   323  }
   324  
   325  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
   326  func (i *Int32) CheckedUnmarshal(src []byte) ([]byte, bool) {
   327      size := i.SizeBytes()
   328      if size > len(src) {
   329          return src, false
   330      }
   331      gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
   332      return src[size:], true
   333  }
   334  
   335  // CopyInt32SliceIn copies in a slice of int32 objects from the task's memory.
   336  func CopyInt32SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []int32) (int, error) {
   337      count := len(dst)
   338      if count == 0 {
   339          return 0, nil
   340      }
   341      size := (*Int32)(nil).SizeBytes()
   342  
   343      ptr := unsafe.Pointer(&dst)
   344      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   345  
   346      // Construct a slice backed by dst's underlying memory.
   347      var buf []byte
   348      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   349      hdr.Data = uintptr(val)
   350      hdr.Len = size * count
   351      hdr.Cap = size * count
   352  
   353      length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   354      // Since we bypassed the compiler's escape analysis, indicate that dst
   355      // must live until the use above.
   356      runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
   357      return length, err
   358  }
   359  
   360  // CopyInt32SliceOut copies a slice of int32 objects to the task's memory.
   361  func CopyInt32SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []int32) (int, error) {
   362      count := len(src)
   363      if count == 0 {
   364          return 0, nil
   365      }
   366      size := (*Int32)(nil).SizeBytes()
   367  
   368      ptr := unsafe.Pointer(&src)
   369      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   370  
   371      // Construct a slice backed by dst's underlying memory.
   372      var buf []byte
   373      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   374      hdr.Data = uintptr(val)
   375      hdr.Len = size * count
   376      hdr.Cap = size * count
   377  
   378      length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
   379      // Since we bypassed the compiler's escape analysis, indicate that src
   380      // must live until the use above.
   381      runtime.KeepAlive(src) // escapes: replaced by intrinsic.
   382      return length, err
   383  }
   384  
   385  // MarshalUnsafeInt32Slice is like Int32.MarshalUnsafe, but for a []Int32.
   386  func MarshalUnsafeInt32Slice(src []Int32, dst []byte) []byte {
   387      count := len(src)
   388      if count == 0 {
   389          return dst
   390      }
   391      size := (*Int32)(nil).SizeBytes()
   392  
   393      buf := dst[:size*count]
   394      gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
   395      return dst[size*count:]
   396  }
   397  
   398  // UnmarshalUnsafeInt32Slice is like Int32.UnmarshalUnsafe, but for a []Int32.
   399  func UnmarshalUnsafeInt32Slice(dst []Int32, src []byte) []byte {
   400      count := len(dst)
   401      if count == 0 {
   402          return src
   403      }
   404      size := (*Int32)(nil).SizeBytes()
   405  
   406      buf := src[:size*count]
   407      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
   408      return src[size*count:]
   409  }
   410  
   411  // SizeBytes implements marshal.Marshallable.SizeBytes.
   412  //go:nosplit
   413  func (i *Int64) SizeBytes() int {
   414      return 8
   415  }
   416  
   417  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   418  func (i *Int64) MarshalBytes(dst []byte) []byte {
   419      hostarch.ByteOrder.PutUint64(dst[:8], uint64(*i))
   420      return dst[8:]
   421  }
   422  
   423  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
   424  func (i *Int64) UnmarshalBytes(src []byte) []byte {
   425      *i = Int64(int64(hostarch.ByteOrder.Uint64(src[:8])))
   426      return src[8:]
   427  }
   428  
   429  // Packed implements marshal.Marshallable.Packed.
   430  //go:nosplit
   431  func (i *Int64) Packed() bool {
   432      // Scalar newtypes are always packed.
   433      return true
   434  }
   435  
   436  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
   437  func (i *Int64) MarshalUnsafe(dst []byte) []byte {
   438      size := i.SizeBytes()
   439      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
   440      return dst[size:]
   441  }
   442  
   443  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
   444  func (i *Int64) UnmarshalUnsafe(src []byte) []byte {
   445      size := i.SizeBytes()
   446      gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
   447      return src[size:]
   448  }
   449  
   450  // CopyOutN implements marshal.Marshallable.CopyOutN.
   451  func (i *Int64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   452      // Construct a slice backed by dst's underlying memory.
   453      var buf []byte
   454      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   455      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   456      hdr.Len = i.SizeBytes()
   457      hdr.Cap = i.SizeBytes()
   458  
   459      length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
   460      // Since we bypassed the compiler's escape analysis, indicate that i
   461      // must live until the use above.
   462      runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   463      return length, err
   464  }
   465  
   466  // CopyOut implements marshal.Marshallable.CopyOut.
   467  func (i *Int64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   468      return i.CopyOutN(cc, addr, i.SizeBytes())
   469  }
   470  
   471  // CopyInN implements marshal.Marshallable.CopyInN.
   472  func (i *Int64) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   473      // Construct a slice backed by dst's underlying memory.
   474      var buf []byte
   475      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   476      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   477      hdr.Len = i.SizeBytes()
   478      hdr.Cap = i.SizeBytes()
   479  
   480      length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay.
   481      // Since we bypassed the compiler's escape analysis, indicate that i
   482      // must live until the use above.
   483      runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   484      return length, err
   485  }
   486  
   487  // CopyIn implements marshal.Marshallable.CopyIn.
   488  func (i *Int64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   489      return i.CopyInN(cc, addr, i.SizeBytes())
   490  }
   491  
   492  // WriteTo implements io.WriterTo.WriteTo.
   493  func (i *Int64) WriteTo(writer io.Writer) (int64, error) {
   494      // Construct a slice backed by dst's underlying memory.
   495      var buf []byte
   496      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   497      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   498      hdr.Len = i.SizeBytes()
   499      hdr.Cap = i.SizeBytes()
   500  
   501      length, err := writer.Write(buf)
   502      // Since we bypassed the compiler's escape analysis, indicate that i
   503      // must live until the use above.
   504      runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   505      return int64(length), err
   506  }
   507  
   508  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
   509  func (i *Int64) CheckedMarshal(dst []byte) ([]byte, bool) {
   510      size := i.SizeBytes()
   511      if size > len(dst) {
   512          return dst, false
   513      }
   514      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
   515      return dst[size:], true
   516  }
   517  
   518  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
   519  func (i *Int64) CheckedUnmarshal(src []byte) ([]byte, bool) {
   520      size := i.SizeBytes()
   521      if size > len(src) {
   522          return src, false
   523      }
   524      gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
   525      return src[size:], true
   526  }
   527  
   528  // CopyInt64SliceIn copies in a slice of int64 objects from the task's memory.
   529  func CopyInt64SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []int64) (int, error) {
   530      count := len(dst)
   531      if count == 0 {
   532          return 0, nil
   533      }
   534      size := (*Int64)(nil).SizeBytes()
   535  
   536      ptr := unsafe.Pointer(&dst)
   537      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   538  
   539      // Construct a slice backed by dst's underlying memory.
   540      var buf []byte
   541      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   542      hdr.Data = uintptr(val)
   543      hdr.Len = size * count
   544      hdr.Cap = size * count
   545  
   546      length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   547      // Since we bypassed the compiler's escape analysis, indicate that dst
   548      // must live until the use above.
   549      runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
   550      return length, err
   551  }
   552  
   553  // CopyInt64SliceOut copies a slice of int64 objects to the task's memory.
   554  func CopyInt64SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []int64) (int, error) {
   555      count := len(src)
   556      if count == 0 {
   557          return 0, nil
   558      }
   559      size := (*Int64)(nil).SizeBytes()
   560  
   561      ptr := unsafe.Pointer(&src)
   562      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   563  
   564      // Construct a slice backed by dst's underlying memory.
   565      var buf []byte
   566      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   567      hdr.Data = uintptr(val)
   568      hdr.Len = size * count
   569      hdr.Cap = size * count
   570  
   571      length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
   572      // Since we bypassed the compiler's escape analysis, indicate that src
   573      // must live until the use above.
   574      runtime.KeepAlive(src) // escapes: replaced by intrinsic.
   575      return length, err
   576  }
   577  
   578  // MarshalUnsafeInt64Slice is like Int64.MarshalUnsafe, but for a []Int64.
   579  func MarshalUnsafeInt64Slice(src []Int64, dst []byte) []byte {
   580      count := len(src)
   581      if count == 0 {
   582          return dst
   583      }
   584      size := (*Int64)(nil).SizeBytes()
   585  
   586      buf := dst[:size*count]
   587      gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
   588      return dst[size*count:]
   589  }
   590  
   591  // UnmarshalUnsafeInt64Slice is like Int64.UnmarshalUnsafe, but for a []Int64.
   592  func UnmarshalUnsafeInt64Slice(dst []Int64, src []byte) []byte {
   593      count := len(dst)
   594      if count == 0 {
   595          return src
   596      }
   597      size := (*Int64)(nil).SizeBytes()
   598  
   599      buf := src[:size*count]
   600      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
   601      return src[size*count:]
   602  }
   603  
   604  // SizeBytes implements marshal.Marshallable.SizeBytes.
   605  //go:nosplit
   606  func (i *Int8) SizeBytes() int {
   607      return 1
   608  }
   609  
   610  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   611  func (i *Int8) MarshalBytes(dst []byte) []byte {
   612      dst[0] = byte(*i)
   613      return dst[1:]
   614  }
   615  
   616  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
   617  func (i *Int8) UnmarshalBytes(src []byte) []byte {
   618      *i = Int8(int8(src[0]))
   619      return src[1:]
   620  }
   621  
   622  // Packed implements marshal.Marshallable.Packed.
   623  //go:nosplit
   624  func (i *Int8) Packed() bool {
   625      // Scalar newtypes are always packed.
   626      return true
   627  }
   628  
   629  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
   630  func (i *Int8) MarshalUnsafe(dst []byte) []byte {
   631      size := i.SizeBytes()
   632      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
   633      return dst[size:]
   634  }
   635  
   636  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
   637  func (i *Int8) UnmarshalUnsafe(src []byte) []byte {
   638      size := i.SizeBytes()
   639      gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
   640      return src[size:]
   641  }
   642  
   643  // CopyOutN implements marshal.Marshallable.CopyOutN.
   644  func (i *Int8) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   645      // Construct a slice backed by dst's underlying memory.
   646      var buf []byte
   647      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   648      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   649      hdr.Len = i.SizeBytes()
   650      hdr.Cap = i.SizeBytes()
   651  
   652      length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
   653      // Since we bypassed the compiler's escape analysis, indicate that i
   654      // must live until the use above.
   655      runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   656      return length, err
   657  }
   658  
   659  // CopyOut implements marshal.Marshallable.CopyOut.
   660  func (i *Int8) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   661      return i.CopyOutN(cc, addr, i.SizeBytes())
   662  }
   663  
   664  // CopyInN implements marshal.Marshallable.CopyInN.
   665  func (i *Int8) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   666      // Construct a slice backed by dst's underlying memory.
   667      var buf []byte
   668      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   669      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   670      hdr.Len = i.SizeBytes()
   671      hdr.Cap = i.SizeBytes()
   672  
   673      length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay.
   674      // Since we bypassed the compiler's escape analysis, indicate that i
   675      // must live until the use above.
   676      runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   677      return length, err
   678  }
   679  
   680  // CopyIn implements marshal.Marshallable.CopyIn.
   681  func (i *Int8) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   682      return i.CopyInN(cc, addr, i.SizeBytes())
   683  }
   684  
   685  // WriteTo implements io.WriterTo.WriteTo.
   686  func (i *Int8) WriteTo(writer io.Writer) (int64, error) {
   687      // Construct a slice backed by dst's underlying memory.
   688      var buf []byte
   689      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   690      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(i)))
   691      hdr.Len = i.SizeBytes()
   692      hdr.Cap = i.SizeBytes()
   693  
   694      length, err := writer.Write(buf)
   695      // Since we bypassed the compiler's escape analysis, indicate that i
   696      // must live until the use above.
   697      runtime.KeepAlive(i) // escapes: replaced by intrinsic.
   698      return int64(length), err
   699  }
   700  
   701  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
   702  func (i *Int8) CheckedMarshal(dst []byte) ([]byte, bool) {
   703      size := i.SizeBytes()
   704      if size > len(dst) {
   705          return dst, false
   706      }
   707      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(i), uintptr(size))
   708      return dst[size:], true
   709  }
   710  
   711  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
   712  func (i *Int8) CheckedUnmarshal(src []byte) ([]byte, bool) {
   713      size := i.SizeBytes()
   714      if size > len(src) {
   715          return src, false
   716      }
   717      gohacks.Memmove(unsafe.Pointer(i), unsafe.Pointer(&src[0]), uintptr(size))
   718      return src[size:], true
   719  }
   720  
   721  // CopyInt8SliceIn copies in a slice of int8 objects from the task's memory.
   722  func CopyInt8SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []int8) (int, error) {
   723      count := len(dst)
   724      if count == 0 {
   725          return 0, nil
   726      }
   727      size := (*Int8)(nil).SizeBytes()
   728  
   729      ptr := unsafe.Pointer(&dst)
   730      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   731  
   732      // Construct a slice backed by dst's underlying memory.
   733      var buf []byte
   734      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   735      hdr.Data = uintptr(val)
   736      hdr.Len = size * count
   737      hdr.Cap = size * count
   738  
   739      length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   740      // Since we bypassed the compiler's escape analysis, indicate that dst
   741      // must live until the use above.
   742      runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
   743      return length, err
   744  }
   745  
   746  // CopyInt8SliceOut copies a slice of int8 objects to the task's memory.
   747  func CopyInt8SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []int8) (int, error) {
   748      count := len(src)
   749      if count == 0 {
   750          return 0, nil
   751      }
   752      size := (*Int8)(nil).SizeBytes()
   753  
   754      ptr := unsafe.Pointer(&src)
   755      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   756  
   757      // Construct a slice backed by dst's underlying memory.
   758      var buf []byte
   759      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   760      hdr.Data = uintptr(val)
   761      hdr.Len = size * count
   762      hdr.Cap = size * count
   763  
   764      length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
   765      // Since we bypassed the compiler's escape analysis, indicate that src
   766      // must live until the use above.
   767      runtime.KeepAlive(src) // escapes: replaced by intrinsic.
   768      return length, err
   769  }
   770  
   771  // MarshalUnsafeInt8Slice is like Int8.MarshalUnsafe, but for a []Int8.
   772  func MarshalUnsafeInt8Slice(src []Int8, dst []byte) []byte {
   773      count := len(src)
   774      if count == 0 {
   775          return dst
   776      }
   777      size := (*Int8)(nil).SizeBytes()
   778  
   779      buf := dst[:size*count]
   780      gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
   781      return dst[size*count:]
   782  }
   783  
   784  // UnmarshalUnsafeInt8Slice is like Int8.UnmarshalUnsafe, but for a []Int8.
   785  func UnmarshalUnsafeInt8Slice(dst []Int8, src []byte) []byte {
   786      count := len(dst)
   787      if count == 0 {
   788          return src
   789      }
   790      size := (*Int8)(nil).SizeBytes()
   791  
   792      buf := src[:size*count]
   793      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
   794      return src[size*count:]
   795  }
   796  
   797  // SizeBytes implements marshal.Marshallable.SizeBytes.
   798  //go:nosplit
   799  func (u *Uint16) SizeBytes() int {
   800      return 2
   801  }
   802  
   803  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   804  func (u *Uint16) MarshalBytes(dst []byte) []byte {
   805      hostarch.ByteOrder.PutUint16(dst[:2], uint16(*u))
   806      return dst[2:]
   807  }
   808  
   809  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
   810  func (u *Uint16) UnmarshalBytes(src []byte) []byte {
   811      *u = Uint16(uint16(hostarch.ByteOrder.Uint16(src[:2])))
   812      return src[2:]
   813  }
   814  
   815  // Packed implements marshal.Marshallable.Packed.
   816  //go:nosplit
   817  func (u *Uint16) Packed() bool {
   818      // Scalar newtypes are always packed.
   819      return true
   820  }
   821  
   822  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
   823  func (u *Uint16) MarshalUnsafe(dst []byte) []byte {
   824      size := u.SizeBytes()
   825      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
   826      return dst[size:]
   827  }
   828  
   829  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
   830  func (u *Uint16) UnmarshalUnsafe(src []byte) []byte {
   831      size := u.SizeBytes()
   832      gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
   833      return src[size:]
   834  }
   835  
   836  // CopyOutN implements marshal.Marshallable.CopyOutN.
   837  func (u *Uint16) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   838      // Construct a slice backed by dst's underlying memory.
   839      var buf []byte
   840      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   841      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
   842      hdr.Len = u.SizeBytes()
   843      hdr.Cap = u.SizeBytes()
   844  
   845      length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
   846      // Since we bypassed the compiler's escape analysis, indicate that u
   847      // must live until the use above.
   848      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
   849      return length, err
   850  }
   851  
   852  // CopyOut implements marshal.Marshallable.CopyOut.
   853  func (u *Uint16) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   854      return u.CopyOutN(cc, addr, u.SizeBytes())
   855  }
   856  
   857  // CopyInN implements marshal.Marshallable.CopyInN.
   858  func (u *Uint16) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
   859      // Construct a slice backed by dst's underlying memory.
   860      var buf []byte
   861      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   862      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
   863      hdr.Len = u.SizeBytes()
   864      hdr.Cap = u.SizeBytes()
   865  
   866      length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay.
   867      // Since we bypassed the compiler's escape analysis, indicate that u
   868      // must live until the use above.
   869      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
   870      return length, err
   871  }
   872  
   873  // CopyIn implements marshal.Marshallable.CopyIn.
   874  func (u *Uint16) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
   875      return u.CopyInN(cc, addr, u.SizeBytes())
   876  }
   877  
   878  // WriteTo implements io.WriterTo.WriteTo.
   879  func (u *Uint16) WriteTo(writer io.Writer) (int64, error) {
   880      // Construct a slice backed by dst's underlying memory.
   881      var buf []byte
   882      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   883      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
   884      hdr.Len = u.SizeBytes()
   885      hdr.Cap = u.SizeBytes()
   886  
   887      length, err := writer.Write(buf)
   888      // Since we bypassed the compiler's escape analysis, indicate that u
   889      // must live until the use above.
   890      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
   891      return int64(length), err
   892  }
   893  
   894  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
   895  func (u *Uint16) CheckedMarshal(dst []byte) ([]byte, bool) {
   896      size := u.SizeBytes()
   897      if size > len(dst) {
   898          return dst, false
   899      }
   900      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
   901      return dst[size:], true
   902  }
   903  
   904  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
   905  func (u *Uint16) CheckedUnmarshal(src []byte) ([]byte, bool) {
   906      size := u.SizeBytes()
   907      if size > len(src) {
   908          return src, false
   909      }
   910      gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
   911      return src[size:], true
   912  }
   913  
   914  // CopyUint16SliceIn copies in a slice of uint16 objects from the task's memory.
   915  func CopyUint16SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []uint16) (int, error) {
   916      count := len(dst)
   917      if count == 0 {
   918          return 0, nil
   919      }
   920      size := (*Uint16)(nil).SizeBytes()
   921  
   922      ptr := unsafe.Pointer(&dst)
   923      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   924  
   925      // Construct a slice backed by dst's underlying memory.
   926      var buf []byte
   927      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   928      hdr.Data = uintptr(val)
   929      hdr.Len = size * count
   930      hdr.Cap = size * count
   931  
   932      length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
   933      // Since we bypassed the compiler's escape analysis, indicate that dst
   934      // must live until the use above.
   935      runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
   936      return length, err
   937  }
   938  
   939  // CopyUint16SliceOut copies a slice of uint16 objects to the task's memory.
   940  func CopyUint16SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []uint16) (int, error) {
   941      count := len(src)
   942      if count == 0 {
   943          return 0, nil
   944      }
   945      size := (*Uint16)(nil).SizeBytes()
   946  
   947      ptr := unsafe.Pointer(&src)
   948      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
   949  
   950      // Construct a slice backed by dst's underlying memory.
   951      var buf []byte
   952      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
   953      hdr.Data = uintptr(val)
   954      hdr.Len = size * count
   955      hdr.Cap = size * count
   956  
   957      length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
   958      // Since we bypassed the compiler's escape analysis, indicate that src
   959      // must live until the use above.
   960      runtime.KeepAlive(src) // escapes: replaced by intrinsic.
   961      return length, err
   962  }
   963  
   964  // MarshalUnsafeUint16Slice is like Uint16.MarshalUnsafe, but for a []Uint16.
   965  func MarshalUnsafeUint16Slice(src []Uint16, dst []byte) []byte {
   966      count := len(src)
   967      if count == 0 {
   968          return dst
   969      }
   970      size := (*Uint16)(nil).SizeBytes()
   971  
   972      buf := dst[:size*count]
   973      gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
   974      return dst[size*count:]
   975  }
   976  
   977  // UnmarshalUnsafeUint16Slice is like Uint16.UnmarshalUnsafe, but for a []Uint16.
   978  func UnmarshalUnsafeUint16Slice(dst []Uint16, src []byte) []byte {
   979      count := len(dst)
   980      if count == 0 {
   981          return src
   982      }
   983      size := (*Uint16)(nil).SizeBytes()
   984  
   985      buf := src[:size*count]
   986      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
   987      return src[size*count:]
   988  }
   989  
   990  // SizeBytes implements marshal.Marshallable.SizeBytes.
   991  //go:nosplit
   992  func (u *Uint32) SizeBytes() int {
   993      return 4
   994  }
   995  
   996  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
   997  func (u *Uint32) MarshalBytes(dst []byte) []byte {
   998      hostarch.ByteOrder.PutUint32(dst[:4], uint32(*u))
   999      return dst[4:]
  1000  }
  1001  
  1002  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
  1003  func (u *Uint32) UnmarshalBytes(src []byte) []byte {
  1004      *u = Uint32(uint32(hostarch.ByteOrder.Uint32(src[:4])))
  1005      return src[4:]
  1006  }
  1007  
  1008  // Packed implements marshal.Marshallable.Packed.
  1009  //go:nosplit
  1010  func (u *Uint32) Packed() bool {
  1011      // Scalar newtypes are always packed.
  1012      return true
  1013  }
  1014  
  1015  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
  1016  func (u *Uint32) MarshalUnsafe(dst []byte) []byte {
  1017      size := u.SizeBytes()
  1018      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
  1019      return dst[size:]
  1020  }
  1021  
  1022  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
  1023  func (u *Uint32) UnmarshalUnsafe(src []byte) []byte {
  1024      size := u.SizeBytes()
  1025      gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
  1026      return src[size:]
  1027  }
  1028  
  1029  // CopyOutN implements marshal.Marshallable.CopyOutN.
  1030  func (u *Uint32) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
  1031      // Construct a slice backed by dst's underlying memory.
  1032      var buf []byte
  1033      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1034      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1035      hdr.Len = u.SizeBytes()
  1036      hdr.Cap = u.SizeBytes()
  1037  
  1038      length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
  1039      // Since we bypassed the compiler's escape analysis, indicate that u
  1040      // must live until the use above.
  1041      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1042      return length, err
  1043  }
  1044  
  1045  // CopyOut implements marshal.Marshallable.CopyOut.
  1046  func (u *Uint32) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
  1047      return u.CopyOutN(cc, addr, u.SizeBytes())
  1048  }
  1049  
  1050  // CopyInN implements marshal.Marshallable.CopyInN.
  1051  func (u *Uint32) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
  1052      // Construct a slice backed by dst's underlying memory.
  1053      var buf []byte
  1054      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1055      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1056      hdr.Len = u.SizeBytes()
  1057      hdr.Cap = u.SizeBytes()
  1058  
  1059      length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay.
  1060      // Since we bypassed the compiler's escape analysis, indicate that u
  1061      // must live until the use above.
  1062      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1063      return length, err
  1064  }
  1065  
  1066  // CopyIn implements marshal.Marshallable.CopyIn.
  1067  func (u *Uint32) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
  1068      return u.CopyInN(cc, addr, u.SizeBytes())
  1069  }
  1070  
  1071  // WriteTo implements io.WriterTo.WriteTo.
  1072  func (u *Uint32) WriteTo(writer io.Writer) (int64, error) {
  1073      // Construct a slice backed by dst's underlying memory.
  1074      var buf []byte
  1075      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1076      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1077      hdr.Len = u.SizeBytes()
  1078      hdr.Cap = u.SizeBytes()
  1079  
  1080      length, err := writer.Write(buf)
  1081      // Since we bypassed the compiler's escape analysis, indicate that u
  1082      // must live until the use above.
  1083      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1084      return int64(length), err
  1085  }
  1086  
  1087  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
  1088  func (u *Uint32) CheckedMarshal(dst []byte) ([]byte, bool) {
  1089      size := u.SizeBytes()
  1090      if size > len(dst) {
  1091          return dst, false
  1092      }
  1093      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
  1094      return dst[size:], true
  1095  }
  1096  
  1097  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
  1098  func (u *Uint32) CheckedUnmarshal(src []byte) ([]byte, bool) {
  1099      size := u.SizeBytes()
  1100      if size > len(src) {
  1101          return src, false
  1102      }
  1103      gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
  1104      return src[size:], true
  1105  }
  1106  
  1107  // CopyUint32SliceIn copies in a slice of uint32 objects from the task's memory.
  1108  func CopyUint32SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []uint32) (int, error) {
  1109      count := len(dst)
  1110      if count == 0 {
  1111          return 0, nil
  1112      }
  1113      size := (*Uint32)(nil).SizeBytes()
  1114  
  1115      ptr := unsafe.Pointer(&dst)
  1116      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
  1117  
  1118      // Construct a slice backed by dst's underlying memory.
  1119      var buf []byte
  1120      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1121      hdr.Data = uintptr(val)
  1122      hdr.Len = size * count
  1123      hdr.Cap = size * count
  1124  
  1125      length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
  1126      // Since we bypassed the compiler's escape analysis, indicate that dst
  1127      // must live until the use above.
  1128      runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
  1129      return length, err
  1130  }
  1131  
  1132  // CopyUint32SliceOut copies a slice of uint32 objects to the task's memory.
  1133  func CopyUint32SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []uint32) (int, error) {
  1134      count := len(src)
  1135      if count == 0 {
  1136          return 0, nil
  1137      }
  1138      size := (*Uint32)(nil).SizeBytes()
  1139  
  1140      ptr := unsafe.Pointer(&src)
  1141      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
  1142  
  1143      // Construct a slice backed by dst's underlying memory.
  1144      var buf []byte
  1145      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1146      hdr.Data = uintptr(val)
  1147      hdr.Len = size * count
  1148      hdr.Cap = size * count
  1149  
  1150      length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
  1151      // Since we bypassed the compiler's escape analysis, indicate that src
  1152      // must live until the use above.
  1153      runtime.KeepAlive(src) // escapes: replaced by intrinsic.
  1154      return length, err
  1155  }
  1156  
  1157  // MarshalUnsafeUint32Slice is like Uint32.MarshalUnsafe, but for a []Uint32.
  1158  func MarshalUnsafeUint32Slice(src []Uint32, dst []byte) []byte {
  1159      count := len(src)
  1160      if count == 0 {
  1161          return dst
  1162      }
  1163      size := (*Uint32)(nil).SizeBytes()
  1164  
  1165      buf := dst[:size*count]
  1166      gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
  1167      return dst[size*count:]
  1168  }
  1169  
  1170  // UnmarshalUnsafeUint32Slice is like Uint32.UnmarshalUnsafe, but for a []Uint32.
  1171  func UnmarshalUnsafeUint32Slice(dst []Uint32, src []byte) []byte {
  1172      count := len(dst)
  1173      if count == 0 {
  1174          return src
  1175      }
  1176      size := (*Uint32)(nil).SizeBytes()
  1177  
  1178      buf := src[:size*count]
  1179      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
  1180      return src[size*count:]
  1181  }
  1182  
  1183  // SizeBytes implements marshal.Marshallable.SizeBytes.
  1184  //go:nosplit
  1185  func (u *Uint64) SizeBytes() int {
  1186      return 8
  1187  }
  1188  
  1189  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
  1190  func (u *Uint64) MarshalBytes(dst []byte) []byte {
  1191      hostarch.ByteOrder.PutUint64(dst[:8], uint64(*u))
  1192      return dst[8:]
  1193  }
  1194  
  1195  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
  1196  func (u *Uint64) UnmarshalBytes(src []byte) []byte {
  1197      *u = Uint64(uint64(hostarch.ByteOrder.Uint64(src[:8])))
  1198      return src[8:]
  1199  }
  1200  
  1201  // Packed implements marshal.Marshallable.Packed.
  1202  //go:nosplit
  1203  func (u *Uint64) Packed() bool {
  1204      // Scalar newtypes are always packed.
  1205      return true
  1206  }
  1207  
  1208  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
  1209  func (u *Uint64) MarshalUnsafe(dst []byte) []byte {
  1210      size := u.SizeBytes()
  1211      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
  1212      return dst[size:]
  1213  }
  1214  
  1215  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
  1216  func (u *Uint64) UnmarshalUnsafe(src []byte) []byte {
  1217      size := u.SizeBytes()
  1218      gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
  1219      return src[size:]
  1220  }
  1221  
  1222  // CopyOutN implements marshal.Marshallable.CopyOutN.
  1223  func (u *Uint64) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
  1224      // Construct a slice backed by dst's underlying memory.
  1225      var buf []byte
  1226      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1227      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1228      hdr.Len = u.SizeBytes()
  1229      hdr.Cap = u.SizeBytes()
  1230  
  1231      length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
  1232      // Since we bypassed the compiler's escape analysis, indicate that u
  1233      // must live until the use above.
  1234      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1235      return length, err
  1236  }
  1237  
  1238  // CopyOut implements marshal.Marshallable.CopyOut.
  1239  func (u *Uint64) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
  1240      return u.CopyOutN(cc, addr, u.SizeBytes())
  1241  }
  1242  
  1243  // CopyInN implements marshal.Marshallable.CopyInN.
  1244  func (u *Uint64) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
  1245      // Construct a slice backed by dst's underlying memory.
  1246      var buf []byte
  1247      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1248      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1249      hdr.Len = u.SizeBytes()
  1250      hdr.Cap = u.SizeBytes()
  1251  
  1252      length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay.
  1253      // Since we bypassed the compiler's escape analysis, indicate that u
  1254      // must live until the use above.
  1255      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1256      return length, err
  1257  }
  1258  
  1259  // CopyIn implements marshal.Marshallable.CopyIn.
  1260  func (u *Uint64) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
  1261      return u.CopyInN(cc, addr, u.SizeBytes())
  1262  }
  1263  
  1264  // WriteTo implements io.WriterTo.WriteTo.
  1265  func (u *Uint64) WriteTo(writer io.Writer) (int64, error) {
  1266      // Construct a slice backed by dst's underlying memory.
  1267      var buf []byte
  1268      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1269      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1270      hdr.Len = u.SizeBytes()
  1271      hdr.Cap = u.SizeBytes()
  1272  
  1273      length, err := writer.Write(buf)
  1274      // Since we bypassed the compiler's escape analysis, indicate that u
  1275      // must live until the use above.
  1276      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1277      return int64(length), err
  1278  }
  1279  
  1280  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
  1281  func (u *Uint64) CheckedMarshal(dst []byte) ([]byte, bool) {
  1282      size := u.SizeBytes()
  1283      if size > len(dst) {
  1284          return dst, false
  1285      }
  1286      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
  1287      return dst[size:], true
  1288  }
  1289  
  1290  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
  1291  func (u *Uint64) CheckedUnmarshal(src []byte) ([]byte, bool) {
  1292      size := u.SizeBytes()
  1293      if size > len(src) {
  1294          return src, false
  1295      }
  1296      gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
  1297      return src[size:], true
  1298  }
  1299  
  1300  // CopyUint64SliceIn copies in a slice of uint64 objects from the task's memory.
  1301  func CopyUint64SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []uint64) (int, error) {
  1302      count := len(dst)
  1303      if count == 0 {
  1304          return 0, nil
  1305      }
  1306      size := (*Uint64)(nil).SizeBytes()
  1307  
  1308      ptr := unsafe.Pointer(&dst)
  1309      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
  1310  
  1311      // Construct a slice backed by dst's underlying memory.
  1312      var buf []byte
  1313      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1314      hdr.Data = uintptr(val)
  1315      hdr.Len = size * count
  1316      hdr.Cap = size * count
  1317  
  1318      length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
  1319      // Since we bypassed the compiler's escape analysis, indicate that dst
  1320      // must live until the use above.
  1321      runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
  1322      return length, err
  1323  }
  1324  
  1325  // CopyUint64SliceOut copies a slice of uint64 objects to the task's memory.
  1326  func CopyUint64SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []uint64) (int, error) {
  1327      count := len(src)
  1328      if count == 0 {
  1329          return 0, nil
  1330      }
  1331      size := (*Uint64)(nil).SizeBytes()
  1332  
  1333      ptr := unsafe.Pointer(&src)
  1334      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
  1335  
  1336      // Construct a slice backed by dst's underlying memory.
  1337      var buf []byte
  1338      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1339      hdr.Data = uintptr(val)
  1340      hdr.Len = size * count
  1341      hdr.Cap = size * count
  1342  
  1343      length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
  1344      // Since we bypassed the compiler's escape analysis, indicate that src
  1345      // must live until the use above.
  1346      runtime.KeepAlive(src) // escapes: replaced by intrinsic.
  1347      return length, err
  1348  }
  1349  
  1350  // MarshalUnsafeUint64Slice is like Uint64.MarshalUnsafe, but for a []Uint64.
  1351  func MarshalUnsafeUint64Slice(src []Uint64, dst []byte) []byte {
  1352      count := len(src)
  1353      if count == 0 {
  1354          return dst
  1355      }
  1356      size := (*Uint64)(nil).SizeBytes()
  1357  
  1358      buf := dst[:size*count]
  1359      gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
  1360      return dst[size*count:]
  1361  }
  1362  
  1363  // UnmarshalUnsafeUint64Slice is like Uint64.UnmarshalUnsafe, but for a []Uint64.
  1364  func UnmarshalUnsafeUint64Slice(dst []Uint64, src []byte) []byte {
  1365      count := len(dst)
  1366      if count == 0 {
  1367          return src
  1368      }
  1369      size := (*Uint64)(nil).SizeBytes()
  1370  
  1371      buf := src[:size*count]
  1372      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
  1373      return src[size*count:]
  1374  }
  1375  
  1376  // SizeBytes implements marshal.Marshallable.SizeBytes.
  1377  //go:nosplit
  1378  func (u *Uint8) SizeBytes() int {
  1379      return 1
  1380  }
  1381  
  1382  // MarshalBytes implements marshal.Marshallable.MarshalBytes.
  1383  func (u *Uint8) MarshalBytes(dst []byte) []byte {
  1384      dst[0] = byte(*u)
  1385      return dst[1:]
  1386  }
  1387  
  1388  // UnmarshalBytes implements marshal.Marshallable.UnmarshalBytes.
  1389  func (u *Uint8) UnmarshalBytes(src []byte) []byte {
  1390      *u = Uint8(uint8(src[0]))
  1391      return src[1:]
  1392  }
  1393  
  1394  // Packed implements marshal.Marshallable.Packed.
  1395  //go:nosplit
  1396  func (u *Uint8) Packed() bool {
  1397      // Scalar newtypes are always packed.
  1398      return true
  1399  }
  1400  
  1401  // MarshalUnsafe implements marshal.Marshallable.MarshalUnsafe.
  1402  func (u *Uint8) MarshalUnsafe(dst []byte) []byte {
  1403      size := u.SizeBytes()
  1404      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
  1405      return dst[size:]
  1406  }
  1407  
  1408  // UnmarshalUnsafe implements marshal.Marshallable.UnmarshalUnsafe.
  1409  func (u *Uint8) UnmarshalUnsafe(src []byte) []byte {
  1410      size := u.SizeBytes()
  1411      gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
  1412      return src[size:]
  1413  }
  1414  
  1415  // CopyOutN implements marshal.Marshallable.CopyOutN.
  1416  func (u *Uint8) CopyOutN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
  1417      // Construct a slice backed by dst's underlying memory.
  1418      var buf []byte
  1419      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1420      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1421      hdr.Len = u.SizeBytes()
  1422      hdr.Cap = u.SizeBytes()
  1423  
  1424      length, err := cc.CopyOutBytes(addr, buf[:limit]) // escapes: okay.
  1425      // Since we bypassed the compiler's escape analysis, indicate that u
  1426      // must live until the use above.
  1427      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1428      return length, err
  1429  }
  1430  
  1431  // CopyOut implements marshal.Marshallable.CopyOut.
  1432  func (u *Uint8) CopyOut(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
  1433      return u.CopyOutN(cc, addr, u.SizeBytes())
  1434  }
  1435  
  1436  // CopyInN implements marshal.Marshallable.CopyInN.
  1437  func (u *Uint8) CopyInN(cc marshal.CopyContext, addr hostarch.Addr, limit int) (int, error) {
  1438      // Construct a slice backed by dst's underlying memory.
  1439      var buf []byte
  1440      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1441      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1442      hdr.Len = u.SizeBytes()
  1443      hdr.Cap = u.SizeBytes()
  1444  
  1445      length, err := cc.CopyInBytes(addr, buf[:limit]) // escapes: okay.
  1446      // Since we bypassed the compiler's escape analysis, indicate that u
  1447      // must live until the use above.
  1448      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1449      return length, err
  1450  }
  1451  
  1452  // CopyIn implements marshal.Marshallable.CopyIn.
  1453  func (u *Uint8) CopyIn(cc marshal.CopyContext, addr hostarch.Addr) (int, error) {
  1454      return u.CopyInN(cc, addr, u.SizeBytes())
  1455  }
  1456  
  1457  // WriteTo implements io.WriterTo.WriteTo.
  1458  func (u *Uint8) WriteTo(writer io.Writer) (int64, error) {
  1459      // Construct a slice backed by dst's underlying memory.
  1460      var buf []byte
  1461      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1462      hdr.Data = uintptr(gohacks.Noescape(unsafe.Pointer(u)))
  1463      hdr.Len = u.SizeBytes()
  1464      hdr.Cap = u.SizeBytes()
  1465  
  1466      length, err := writer.Write(buf)
  1467      // Since we bypassed the compiler's escape analysis, indicate that u
  1468      // must live until the use above.
  1469      runtime.KeepAlive(u) // escapes: replaced by intrinsic.
  1470      return int64(length), err
  1471  }
  1472  
  1473  // CheckedMarshal implements marshal.CheckedMarshallable.CheckedMarshal.
  1474  func (u *Uint8) CheckedMarshal(dst []byte) ([]byte, bool) {
  1475      size := u.SizeBytes()
  1476      if size > len(dst) {
  1477          return dst, false
  1478      }
  1479      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(u), uintptr(size))
  1480      return dst[size:], true
  1481  }
  1482  
  1483  // CheckedUnmarshal implements marshal.CheckedMarshallable.CheckedUnmarshal.
  1484  func (u *Uint8) CheckedUnmarshal(src []byte) ([]byte, bool) {
  1485      size := u.SizeBytes()
  1486      if size > len(src) {
  1487          return src, false
  1488      }
  1489      gohacks.Memmove(unsafe.Pointer(u), unsafe.Pointer(&src[0]), uintptr(size))
  1490      return src[size:], true
  1491  }
  1492  
  1493  // CopyUint8SliceIn copies in a slice of uint8 objects from the task's memory.
  1494  func CopyUint8SliceIn(cc marshal.CopyContext, addr hostarch.Addr, dst []uint8) (int, error) {
  1495      count := len(dst)
  1496      if count == 0 {
  1497          return 0, nil
  1498      }
  1499      size := (*Uint8)(nil).SizeBytes()
  1500  
  1501      ptr := unsafe.Pointer(&dst)
  1502      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
  1503  
  1504      // Construct a slice backed by dst's underlying memory.
  1505      var buf []byte
  1506      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1507      hdr.Data = uintptr(val)
  1508      hdr.Len = size * count
  1509      hdr.Cap = size * count
  1510  
  1511      length, err := cc.CopyInBytes(addr, buf) // escapes: okay.
  1512      // Since we bypassed the compiler's escape analysis, indicate that dst
  1513      // must live until the use above.
  1514      runtime.KeepAlive(dst) // escapes: replaced by intrinsic.
  1515      return length, err
  1516  }
  1517  
  1518  // CopyUint8SliceOut copies a slice of uint8 objects to the task's memory.
  1519  func CopyUint8SliceOut(cc marshal.CopyContext, addr hostarch.Addr, src []uint8) (int, error) {
  1520      count := len(src)
  1521      if count == 0 {
  1522          return 0, nil
  1523      }
  1524      size := (*Uint8)(nil).SizeBytes()
  1525  
  1526      ptr := unsafe.Pointer(&src)
  1527      val := gohacks.Noescape(unsafe.Pointer((*reflect.SliceHeader)(ptr).Data))
  1528  
  1529      // Construct a slice backed by dst's underlying memory.
  1530      var buf []byte
  1531      hdr := (*reflect.SliceHeader)(unsafe.Pointer(&buf))
  1532      hdr.Data = uintptr(val)
  1533      hdr.Len = size * count
  1534      hdr.Cap = size * count
  1535  
  1536      length, err := cc.CopyOutBytes(addr, buf) // escapes: okay.
  1537      // Since we bypassed the compiler's escape analysis, indicate that src
  1538      // must live until the use above.
  1539      runtime.KeepAlive(src) // escapes: replaced by intrinsic.
  1540      return length, err
  1541  }
  1542  
  1543  // MarshalUnsafeUint8Slice is like Uint8.MarshalUnsafe, but for a []Uint8.
  1544  func MarshalUnsafeUint8Slice(src []Uint8, dst []byte) []byte {
  1545      count := len(src)
  1546      if count == 0 {
  1547          return dst
  1548      }
  1549      size := (*Uint8)(nil).SizeBytes()
  1550  
  1551      buf := dst[:size*count]
  1552      gohacks.Memmove(unsafe.Pointer(&buf[0]), unsafe.Pointer(&src[0]), uintptr(len(buf)))
  1553      return dst[size*count:]
  1554  }
  1555  
  1556  // UnmarshalUnsafeUint8Slice is like Uint8.UnmarshalUnsafe, but for a []Uint8.
  1557  func UnmarshalUnsafeUint8Slice(dst []Uint8, src []byte) []byte {
  1558      count := len(dst)
  1559      if count == 0 {
  1560          return src
  1561      }
  1562      size := (*Uint8)(nil).SizeBytes()
  1563  
  1564      buf := src[:size*count]
  1565      gohacks.Memmove(unsafe.Pointer(&dst[0]), unsafe.Pointer(&buf[0]), uintptr(len(buf)))
  1566      return src[size*count:]
  1567  }
  1568