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

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

Issue 100870044: code review 100870044: runtime: make continuation pc available to stack walk (Closed)
Left Patch Set: diff -r 46d573d68ee6 https://code.google.com/p/go Created 10 years, 9 months ago
Right Patch Set: diff -r 95cc2b2ebec5 https://code.google.com/p/go/ Created 10 years, 9 months 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:
Right: Side by side diff | Download
« no previous file with change/comment | « no previous file | src/pkg/runtime/heapdump.c » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
(no file at all)
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 "arch_GOARCH.h" 6 #include "arch_GOARCH.h"
7 #include "stack.h" 7 #include "stack.h"
8 #include "cgocall.h" 8 #include "cgocall.h"
9 #include "race.h" 9 #include "race.h"
10 #include "../../cmd/ld/textflag.h" 10 #include "../../cmd/ld/textflag.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 m->ncgocall++; 115 m->ncgocall++;
116 116
117 /* 117 /*
118 * Lock g to m to ensure we stay on the same stack if we do a 118 * Lock g to m to ensure we stay on the same stack if we do a
119 * cgo callback. Add entry to defer stack in case of panic. 119 * cgo callback. Add entry to defer stack in case of panic.
120 */ 120 */
121 runtime·lockOSThread(); 121 runtime·lockOSThread();
122 d.fn = &endcgoV; 122 d.fn = &endcgoV;
123 d.siz = 0; 123 d.siz = 0;
124 d.link = g->defer; 124 d.link = g->defer;
125 » d.argp = (void*)-1; // unused because unlockm never recovers 125 » d.argp = NoArgs;
126 d.special = true; 126 d.special = true;
127 g->defer = &d; 127 g->defer = &d;
128 ········ 128 ········
129 m->ncgo++; 129 m->ncgo++;
130 130
131 /* 131 /*
132 * Announce we are entering a system call 132 * Announce we are entering a system call
133 * so that the scheduler knows to create another 133 * so that the scheduler knows to create another
134 * M to run goroutines while we are in the 134 * M to run goroutines while we are in the
135 * foreign code. 135 * foreign code.
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
252 252
253 if(m->needextram) { 253 if(m->needextram) {
254 m->needextram = 0; 254 m->needextram = 0;
255 runtime·newextram(); 255 runtime·newextram();
256 } 256 }
257 257
258 // Add entry to defer stack in case of panic. 258 // Add entry to defer stack in case of panic.
259 d.fn = &unwindmf; 259 d.fn = &unwindmf;
260 d.siz = 0; 260 d.siz = 0;
261 d.link = g->defer; 261 d.link = g->defer;
262 » d.argp = (void*)-1; // unused because unwindm never recovers 262 » d.argp = NoArgs;
263 d.special = true; 263 d.special = true;
264 g->defer = &d; 264 g->defer = &d;
265 265
266 if(raceenabled) 266 if(raceenabled)
267 runtime·raceacquire(&cgosync); 267 runtime·raceacquire(&cgosync);
268 268
269 // Invoke callback. 269 // Invoke callback.
270 cb = CBARGS; 270 cb = CBARGS;
271 runtime·newstackcall(cb->fn, cb->arg, cb->argsize); 271 runtime·newstackcall(cb->fn, cb->arg, cb->argsize);
272 272
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after
309 runtime·cgounimpl(void) // called from (incomplete) assembly 309 runtime·cgounimpl(void) // called from (incomplete) assembly
310 { 310 {
311 runtime·throw("runtime: cgo not implemented"); 311 runtime·throw("runtime: cgo not implemented");
312 } 312 }
313 313
314 // For cgo-using programs with external linking, 314 // For cgo-using programs with external linking,
315 // export "main" (defined in assembly) so that libc can handle basic 315 // export "main" (defined in assembly) so that libc can handle basic
316 // C runtime startup and call the Go program as if it were 316 // C runtime startup and call the Go program as if it were
317 // the C main function. 317 // the C main function.
318 #pragma cgo_export_static main 318 #pragma cgo_export_static main
LEFTRIGHT

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