Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code | Sign in
(424)

Delta Between Two Patch Sets: src/pkg/runtime/cgocall.c

Issue 4058046: code review 4058046: windows: multiple improvements and cleanups (Closed)
Left Patch Set: Created 14 years, 1 month ago
Right Patch Set: code review 4058046: windows: multiple improvements and cleanups Created 14 years, 1 month ago
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments. Please Sign in to add in-line comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « src/pkg/runtime/cgocall.h ('k') | src/pkg/runtime/runtime.h » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 // Copyright 2009 The Go Authors. All rights reserved. 1 // Copyright 2009 The Go Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style 2 // Use of this source code is governed by a BSD-style
3 // license that can be found in the LICENSE file. 3 // license that can be found in the LICENSE file.
4 4
5 #include "runtime.h" 5 #include "runtime.h"
6 #include "cgocall.h" 6 #include "cgocall.h"
7 7
8 void *initcgo; /* filled in by dynamic linker when Cgo is available */ 8 void *initcgo; /* filled in by dynamic linker when Cgo is available */
9 int64 ncgocall; 9 int64 ncgocall;
10 void runtime·entersyscall(void); 10 void runtime·entersyscall(void);
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
46 g->lockedm = nil; 46 g->lockedm = nil;
47 47
48 return; 48 return;
49 } 49 }
50 50
51 // When a C function calls back into Go, the wrapper function will 51 // When a C function calls back into Go, the wrapper function will
52 // call this. This switches to a Go stack, copies the arguments 52 // call this. This switches to a Go stack, copies the arguments
53 // (arg/argsize) on to the stack, calls the function, copies the 53 // (arg/argsize) on to the stack, calls the function, copies the
54 // arguments back where they came from, and finally returns to the old 54 // arguments back where they came from, and finally returns to the old
55 // stack. 55 // stack.
56
57 #pragma textflag 7
58 uintptr 56 uintptr
59 runtime·cgocallback(void (*fn)(void), void *arg, int32 argsize) 57 runtime·cgocallback(void (*fn)(void), void *arg, int32 argsize)
60 { 58 {
61 Gobuf oldsched, oldg1sched; 59 Gobuf oldsched, oldg1sched;
62 G *g1; 60 G *g1;
63 void *sp; 61 void *sp;
64 uintptr ret; 62 uintptr ret;
65 63
66 if(g != m->g0) 64 if(g != m->g0)
67 runtime·throw("bad g in cgocallback"); 65 runtime·throw("bad g in cgocallback");
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
112 runtime·cgocall(_cgo_malloc, &a); 110 runtime·cgocall(_cgo_malloc, &a);
113 return a.ret; 111 return a.ret;
114 } 112 }
115 113
116 void 114 void
117 runtime·cfree(void *p) 115 runtime·cfree(void *p)
118 { 116 {
119 runtime·cgocall(_cgo_free, p); 117 runtime·cgocall(_cgo_free, p);
120 } 118 }
121 119
LEFTRIGHT

Powered by Google App Engine
RSS Feeds Recent Issues | This issue
This is Rietveld f62528b