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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libgo/] [runtime/] [go-cgo.c] - Blame information for rev 749

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

Line No. Rev Author Line
1 747 jeremybenn
/* go-cgo.c -- SWIG support routines for libgo.
2
 
3
   Copyright 2011 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 "go-alloc.h"
8
#include "interface.h"
9
#include "go-panic.h"
10
#include "go-string.h"
11
 
12
/* These are routines used by SWIG.  The gc runtime library provides
13
   the same routines under the same name, though in that case the code
14
   is required to import runtime/cgo.  */
15
 
16
void *
17
_cgo_allocate (size_t n)
18
{
19
  return __go_alloc (n);
20
}
21
 
22
extern const struct __go_type_descriptor string_type_descriptor
23
  asm ("__go_tdn_string");
24
 
25
void
26
_cgo_panic (const char *p)
27
{
28
  int len;
29
  unsigned char *data;
30
  struct __go_string *ps;
31
  struct __go_empty_interface e;
32
 
33
  len = __builtin_strlen (p);
34
  data = __go_alloc (len);
35
  __builtin_memcpy (data, p, len);
36
  ps = __go_alloc (sizeof *ps);
37
  ps->__data = data;
38
  ps->__length = len;
39
  e.__type_descriptor = &string_type_descriptor;
40
  e.__object = ps;
41
  __go_panic (e);
42
}

powered by: WebSVN 2.1.0

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