Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
R
riscv-gcc-1
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
lvzhengyang
riscv-gcc-1
Commits
ef1f3432
Commit
ef1f3432
authored
May 22, 2012
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runtime: Use getcontext, not setjmp, to save regs for GC.
From-SVN: r187777
parent
3cd50158
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
4 additions
and
7 deletions
+4
-7
libgo/runtime/proc.c
+3
-5
libgo/runtime/runtime.h
+1
-2
No files found.
libgo/runtime/proc.c
View file @
ef1f3432
...
@@ -1239,9 +1239,7 @@ runtime_entersyscall(void)
...
@@ -1239,9 +1239,7 @@ runtime_entersyscall(void)
// Save the registers in the g structure so that any pointers
// Save the registers in the g structure so that any pointers
// held in registers will be seen by the garbage collector.
// held in registers will be seen by the garbage collector.
// We could use getcontext here, but setjmp is more efficient
getcontext
(
&
g
->
gcregs
);
// because it doesn't need to save the signal mask.
setjmp
(
g
->
gcregs
);
g
->
status
=
Gsyscall
;
g
->
status
=
Gsyscall
;
...
@@ -1299,7 +1297,7 @@ runtime_exitsyscall(void)
...
@@ -1299,7 +1297,7 @@ runtime_exitsyscall(void)
gp
->
gcstack
=
nil
;
gp
->
gcstack
=
nil
;
#endif
#endif
gp
->
gcnext_sp
=
nil
;
gp
->
gcnext_sp
=
nil
;
runtime_memclr
(
gp
->
gcregs
,
sizeof
gp
->
gcregs
);
runtime_memclr
(
&
gp
->
gcregs
,
sizeof
gp
->
gcregs
);
if
(
m
->
profilehz
>
0
)
if
(
m
->
profilehz
>
0
)
runtime_setprof
(
true
);
runtime_setprof
(
true
);
...
@@ -1328,7 +1326,7 @@ runtime_exitsyscall(void)
...
@@ -1328,7 +1326,7 @@ runtime_exitsyscall(void)
gp
->
gcstack
=
nil
;
gp
->
gcstack
=
nil
;
#endif
#endif
gp
->
gcnext_sp
=
nil
;
gp
->
gcnext_sp
=
nil
;
runtime_memclr
(
gp
->
gcregs
,
sizeof
gp
->
gcregs
);
runtime_memclr
(
&
gp
->
gcregs
,
sizeof
gp
->
gcregs
);
}
}
// Allocate a new g, with a stack big enough for stacksize bytes.
// Allocate a new g, with a stack big enough for stacksize bytes.
...
...
libgo/runtime/runtime.h
View file @
ef1f3432
...
@@ -7,7 +7,6 @@
...
@@ -7,7 +7,6 @@
#include "config.h"
#include "config.h"
#include "go-assert.h"
#include "go-assert.h"
#include <setjmp.h>
#include <signal.h>
#include <signal.h>
#include <stdio.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdlib.h>
...
@@ -128,7 +127,7 @@ struct G
...
@@ -128,7 +127,7 @@ struct G
void
*
gcnext_segment
;
void
*
gcnext_segment
;
void
*
gcnext_sp
;
void
*
gcnext_sp
;
void
*
gcinitial_sp
;
void
*
gcinitial_sp
;
jmp_buf
gcregs
;
ucontext_t
gcregs
;
byte
*
entry
;
// initial function
byte
*
entry
;
// initial function
G
*
alllink
;
// on allg
G
*
alllink
;
// on allg
void
*
param
;
// passed parameter on wakeup
void
*
param
;
// passed parameter on wakeup
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment