Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
ab08eac5
Commit
ab08eac5
authored
Mar 19, 2013
by
Jan Ziak
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runtime: optimize calls to addroot()
R=golang-dev, rsc CC=dvyukov, golang-dev
https://golang.org/cl/7879043
parent
6e69df61
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
3 deletions
+6
-3
src/pkg/runtime/mgc0.c
src/pkg/runtime/mgc0.c
+6
-3
No files found.
src/pkg/runtime/mgc0.c
View file @
ab08eac5
...
...
@@ -1357,7 +1357,7 @@ addstackroots(G *gp)
runtime
·
printf
(
"scanstack inconsistent: g%D#%d sp=%p not in [%p,%p]
\n
"
,
gp
->
goid
,
n
,
sp
,
guard
-
StackGuard
,
stk
);
runtime
·
throw
(
"scanstack"
);
}
addroot
((
Obj
){
sp
,
(
byte
*
)
stk
-
sp
,
0
});
addroot
((
Obj
){
sp
,
(
byte
*
)
stk
-
sp
,
(
uintptr
)
defaultProg
|
PRECISE
|
LOOP
});
sp
=
(
byte
*
)
stk
->
gobuf
.
sp
;
guard
=
stk
->
stackguard
;
stk
=
(
Stktop
*
)
stk
->
stackbase
;
...
...
@@ -1399,14 +1399,17 @@ addroots(void)
for
(
spanidx
=
0
;
spanidx
<
runtime
·
mheap
->
nspan
;
spanidx
++
)
{
s
=
allspans
[
spanidx
];
if
(
s
->
state
==
MSpanInUse
)
{
// The garbage collector ignores type pointers stored in MSpan.types:
// - Compiler-generated types are stored outside of heap.
// - The reflect package has runtime-generated types cached in its data structures.
// The garbage collector relies on finding the references via that cache.
switch
(
s
->
types
.
compression
)
{
case
MTypes_Empty
:
case
MTypes_Single
:
break
;
case
MTypes_Words
:
case
MTypes_Bytes
:
// TODO(atom): consider using defaultProg instead of 0
addroot
((
Obj
){(
byte
*
)
&
s
->
types
.
data
,
sizeof
(
void
*
),
0
});
markonly
((
byte
*
)
s
->
types
.
data
);
break
;
}
}
...
...
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