diff options
Diffstat (limited to 'libgo/runtime')
-rw-r--r-- | libgo/runtime/goc2c.c | 3 | ||||
-rw-r--r-- | libgo/runtime/lock_futex.c | 6 | ||||
-rw-r--r-- | libgo/runtime/lock_sema.c | 8 | ||||
-rw-r--r-- | libgo/runtime/mprof.goc | 2 | ||||
-rw-r--r-- | libgo/runtime/runtime.h | 14 | ||||
-rw-r--r-- | libgo/runtime/string.goc | 3 |
6 files changed, 24 insertions, 12 deletions
diff --git a/libgo/runtime/goc2c.c b/libgo/runtime/goc2c.c index fe413fe42af..93031ffe253 100644 --- a/libgo/runtime/goc2c.c +++ b/libgo/runtime/goc2c.c @@ -2,6 +2,8 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build ignore + /* * Translate a .goc file into a .c file. A .goc file is a combination * of a limited form of Go with C. @@ -774,6 +776,7 @@ main(int argc, char **argv) } } + printf("// AUTO-GENERATED by autogen.sh; DO NOT EDIT\n\n"); process_file(); exit(0); } diff --git a/libgo/runtime/lock_futex.c b/libgo/runtime/lock_futex.c index 4f3d507726d..cdc12d7c75c 100644 --- a/libgo/runtime/lock_futex.c +++ b/libgo/runtime/lock_futex.c @@ -2,17 +2,19 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build freebsd linux + #include "runtime.h" // This implementation depends on OS-specific implementations of // -// runtime.futexsleep(uint32 *addr, uint32 val, int64 ns) +// runtime_futexsleep(uint32 *addr, uint32 val, int64 ns) // Atomically, // if(*addr == val) sleep // Might be woken up spuriously; that's allowed. // Don't sleep longer than ns; ns < 0 means forever. // -// runtime.futexwakeup(uint32 *addr, uint32 cnt) +// runtime_futexwakeup(uint32 *addr, uint32 cnt) // If any procs are sleeping on addr, wake up at most cnt. enum diff --git a/libgo/runtime/lock_sema.c b/libgo/runtime/lock_sema.c index 6b4fffbdcf8..b2a8f53be41 100644 --- a/libgo/runtime/lock_sema.c +++ b/libgo/runtime/lock_sema.c @@ -2,21 +2,23 @@ // Use of this source code is governed by a BSD-style // license that can be found in the LICENSE file. +// +build darwin netbsd openbsd plan9 windows + #include "runtime.h" // This implementation depends on OS-specific implementations of // -// uintptr runtime.semacreate(void) +// uintptr runtime_semacreate(void) // Create a semaphore, which will be assigned to m->waitsema. // The zero value is treated as absence of any semaphore, // so be sure to return a non-zero value. // -// int32 runtime.semasleep(int64 ns) +// int32 runtime_semasleep(int64 ns) // If ns < 0, acquire m->waitsema and return 0. // If ns >= 0, try to acquire m->waitsema for at most ns nanoseconds. // Return 0 if the semaphore was acquired, -1 if interrupted or timed out. // -// int32 runtime.semawakeup(M *mp) +// int32 runtime_semawakeup(M *mp) // Wake up mp, which is or will soon be sleeping on mp->waitsema. // diff --git a/libgo/runtime/mprof.goc b/libgo/runtime/mprof.goc index f44f45083f7..d143d19e5ba 100644 --- a/libgo/runtime/mprof.goc +++ b/libgo/runtime/mprof.goc @@ -12,8 +12,6 @@ package runtime #include "defs.h" #include "go-type.h" -typedef struct __go_open_array Slice; - // NOTE(rsc): Everything here could use cas if contention became an issue. static Lock proflock; diff --git a/libgo/runtime/runtime.h b/libgo/runtime/runtime.h index 040a1b617c8..94113b8db83 100644 --- a/libgo/runtime/runtime.h +++ b/libgo/runtime/runtime.h @@ -196,7 +196,7 @@ enum /* Macros. */ -#ifdef __WINDOWS__ +#ifdef GOOS_windows enum { Windows = 1 }; @@ -343,7 +343,6 @@ void runtime_panic(Eface); #define runtime_printf printf #define runtime_malloc(s) __go_alloc(s) #define runtime_free(p) __go_free(p) -#define runtime_memclr(buf, size) __builtin_memset((buf), 0, (size)) #define runtime_strcmp(s1, s2) __builtin_strcmp((s1), (s2)) #define runtime_mcmp(a, b, s) __builtin_memcmp((a), (b), (s)) #define runtime_memmove(a, b, s) __builtin_memmove((a), (b), (s)) @@ -352,9 +351,6 @@ MCache* runtime_allocmcache(void); void free(void *v); struct __go_func_type; bool runtime_addfinalizer(void*, void(*fn)(void*), const struct __go_func_type *); -#define runtime_mmap mmap -#define runtime_munmap munmap -#define runtime_madvise madvise #define runtime_cas(pval, old, new) __sync_bool_compare_and_swap (pval, old, new) #define runtime_casp(pval, old, new) __sync_bool_compare_and_swap (pval, old, new) #define runtime_xadd(p, v) __sync_add_and_fetch (p, v) @@ -384,6 +380,14 @@ void runtime_osyield(void); void runtime_LockOSThread(void) __asm__("libgo_runtime.runtime.LockOSThread"); void runtime_UnlockOSThread(void) __asm__("libgo_runtime.runtime.UnlockOSThread"); +/* + * low level C-called + */ +#define runtime_mmap mmap +#define runtime_munmap munmap +#define runtime_madvise madvise +#define runtime_memclr(buf, size) __builtin_memset((buf), 0, (size)) + struct __go_func_type; void reflect_call(const struct __go_func_type *, const void *, _Bool, _Bool, void **, void **) diff --git a/libgo/runtime/string.goc b/libgo/runtime/string.goc index fbbe393bbef..486caf09a42 100644 --- a/libgo/runtime/string.goc +++ b/libgo/runtime/string.goc @@ -4,6 +4,9 @@ package runtime #include "runtime.h" +#include "arch.h" +#include "malloc.h" + #define charntorune(pv, str, len) __go_get_rune(str, len, pv) int32 |