Formerly known as libcgo.
Almost no code here is changing; the diffs
are shown relative to the originals in libcgo.
R=r
CC=golang-dev
https://golang.org/cl/
3420043
rpc\
rpc/jsonrpc\
runtime\
+ runtime/cgo\
runtime/pprof\
scanner\
smtp\
image/jpeg\
net/dict\
rand\
+ runtime/cgo\
runtime/pprof\
syscall\
testing\
-include Make.deps
../cmd/cgo.install: ../libcgo.install
+runtime/cgo.install: ../cmd/cgo.install
{
G *oldlock;
- if(initcgo == nil)
+ if(!runtime·iscgo)
runtime·throw("cgocall unavailable");
+ if(fn == 0)
+ runtime·throw("cgocall nil");
+
ncgocall++;
/*
void*
runtime·cmalloc(uintptr n)
{
- struct a {
+ struct {
uint64 n;
void *ret;
} a;
// Register our thread-creation callback (see {amd64,386}/sys.s)
// but only if we're not using cgo. If we are using cgo we need
// to let the C pthread libary install its own thread-creation callback.
- extern void (*libcgo_thread_start)(void*);
- if(libcgo_thread_start == nil)
+ if(!runtime·iscgo)
runtime·bsdthread_register();
}
#include "malloc.h"
#include "os.h"
+bool runtime·iscgo;
+
static void unwindstack(G*, byte*);
typedef struct Sched Sched;
runtime·allm = m;
m->id = runtime·sched.mcount++;
- if(libcgo_thread_start != nil) {
+ if(runtime·iscgo) {
CgoThreadStart ts;
+
+ if(libcgo_thread_start == nil)
+ runtime·throw("libcgo_thread_start missing");
// pthread_create will make us a stack.
m->g0 = runtime·malg(-1);
ts.m = m;
extern int32 runtime·fd; // usually 1; set to 2 when panicking
extern int32 runtime·gcwaiting; // gc is waiting to run
int8* runtime·goos;
+extern bool runtime·iscgo;
/*
* common functions and data