OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [runtime/] [go-unsafe-new.c] - Blame information for rev 791

Go to most recent revision | Details | Compare with Previous | View Log

Line No. Rev Author Line
1 747 jeremybenn
/* go-unsafe-new.c -- unsafe.New function for Go.
2
 
3
   Copyright 2009 The Go Authors. All rights reserved.
4
   Use of this source code is governed by a BSD-style
5
   license that can be found in the LICENSE file.  */
6
 
7
#include "runtime.h"
8
#include "go-alloc.h"
9
#include "go-type.h"
10
#include "interface.h"
11
 
12
/* Implement unsafe.New.  */
13
 
14
void *New (struct __go_empty_interface type) asm ("libgo_unsafe.unsafe.New");
15
 
16
/* The dynamic type of the argument will be a pointer to a type
17
   descriptor.  */
18
 
19
void *
20
New (struct __go_empty_interface type)
21
{
22
  const struct __go_type_descriptor *descriptor;
23
 
24
  if (((uintptr_t) type.__type_descriptor & reflectFlags) != 0)
25
    runtime_panicstring ("invalid interface value");
26
 
27
  /* FIXME: We should check __type_descriptor to verify that this is
28
     really a type descriptor.  */
29
  descriptor = (const struct __go_type_descriptor *) type.__object;
30
  return __go_alloc (descriptor->__size);
31
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.