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

Subversion Repositories openrisc

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

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

Line No. Rev Author Line
1 747 jeremybenn
/* go-unreflect.c -- implement unsafe.Unreflect 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.Unreflect.  */
13
 
14
struct __go_empty_interface Unreflect (struct __go_empty_interface type,
15
                                       void *object)
16
  asm ("libgo_unsafe.unsafe.Unreflect");
17
 
18
struct __go_empty_interface
19
Unreflect (struct __go_empty_interface type, void *object)
20
{
21
  struct __go_empty_interface ret;
22
 
23
  if (((uintptr_t) type.__type_descriptor & reflectFlags) != 0)
24
    runtime_panicstring ("invalid interface value");
25
 
26
  /* FIXME: We should check __type_descriptor to verify that this is
27
     really a type descriptor.  */
28
  ret.__type_descriptor = type.__object;
29
  if (__go_is_pointer_type (ret.__type_descriptor))
30
    ret.__object = *(void **) object;
31
  else
32
    ret.__object = object;
33
  return ret;
34
}

powered by: WebSVN 2.1.0

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