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
89ec208e
Commit
89ec208e
authored
Jan 04, 2013
by
Jan Ziak
Committed by
Russ Cox
Jan 04, 2013
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
runtime: introduce typedefs and delete struct keywords in mgc0.c
R=rsc CC=golang-dev
https://golang.org/cl/7029055
parent
98edf09e
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
16 additions
and
13 deletions
+16
-13
src/pkg/runtime/mgc0.c
src/pkg/runtime/mgc0.c
+16
-13
No files found.
src/pkg/runtime/mgc0.c
View file @
89ec208e
...
@@ -163,12 +163,14 @@ enum {
...
@@ -163,12 +163,14 @@ enum {
// is moved/flushed to the work buffer (Workbuf).
// is moved/flushed to the work buffer (Workbuf).
// The size of an intermediate buffer is very small,
// The size of an intermediate buffer is very small,
// such as 32 or 64 elements.
// such as 32 or 64 elements.
typedef
struct
PtrTarget
PtrTarget
;
struct
PtrTarget
struct
PtrTarget
{
{
void
*
p
;
void
*
p
;
uintptr
ti
;
uintptr
ti
;
};
};
typedef
struct
BitTarget
BitTarget
;
struct
BitTarget
struct
BitTarget
{
{
void
*
p
;
void
*
p
;
...
@@ -176,13 +178,14 @@ struct BitTarget
...
@@ -176,13 +178,14 @@ struct BitTarget
uintptr
*
bitp
,
shift
;
uintptr
*
bitp
,
shift
;
};
};
typedef
struct
BufferList
BufferList
;
struct
BufferList
struct
BufferList
{
{
struct
PtrTarget
ptrtarget
[
IntermediateBufferCapacity
];
PtrTarget
ptrtarget
[
IntermediateBufferCapacity
];
struct
BitTarget
bittarget
[
IntermediateBufferCapacity
];
BitTarget
bittarget
[
IntermediateBufferCapacity
];
struct
BufferList
*
next
;
BufferList
*
next
;
};
};
static
struct
BufferList
*
bufferList
;
static
BufferList
*
bufferList
;
static
Lock
lock
;
static
Lock
lock
;
...
@@ -207,7 +210,7 @@ static Lock lock;
...
@@ -207,7 +210,7 @@ static Lock lock;
// flushptrbuf
// flushptrbuf
// (2nd part, mark and enqueue)
// (2nd part, mark and enqueue)
static
void
static
void
flushptrbuf
(
struct
PtrTarget
*
ptrbuf
,
uintptr
n
,
Obj
**
_wp
,
Workbuf
**
_wbuf
,
uintptr
*
_nobj
,
struct
BitTarget
*
bitbuf
)
flushptrbuf
(
PtrTarget
*
ptrbuf
,
uintptr
n
,
Obj
**
_wp
,
Workbuf
**
_wbuf
,
uintptr
*
_nobj
,
BitTarget
*
bitbuf
)
{
{
byte
*
p
,
*
arena_start
,
*
obj
;
byte
*
p
,
*
arena_start
,
*
obj
;
uintptr
size
,
*
bitp
,
bits
,
shift
,
j
,
x
,
xbits
,
off
,
nobj
,
ti
;
uintptr
size
,
*
bitp
,
bits
,
shift
,
j
,
x
,
xbits
,
off
,
nobj
,
ti
;
...
@@ -215,8 +218,8 @@ flushptrbuf(struct PtrTarget *ptrbuf, uintptr n, Obj **_wp, Workbuf **_wbuf, uin
...
@@ -215,8 +218,8 @@ flushptrbuf(struct PtrTarget *ptrbuf, uintptr n, Obj **_wp, Workbuf **_wbuf, uin
PageID
k
;
PageID
k
;
Obj
*
wp
;
Obj
*
wp
;
Workbuf
*
wbuf
;
Workbuf
*
wbuf
;
struct
PtrTarget
*
ptrbuf_end
;
PtrTarget
*
ptrbuf_end
;
struct
BitTarget
*
bitbufpos
,
*
bt
;
BitTarget
*
bitbufpos
,
*
bt
;
arena_start
=
runtime
·
mheap
.
arena_start
;
arena_start
=
runtime
·
mheap
.
arena_start
;
...
@@ -323,7 +326,7 @@ flushptrbuf(struct PtrTarget *ptrbuf, uintptr n, Obj **_wp, Workbuf **_wbuf, uin
...
@@ -323,7 +326,7 @@ flushptrbuf(struct PtrTarget *ptrbuf, uintptr n, Obj **_wp, Workbuf **_wbuf, uin
if
((
bits
&
(
bitAllocated
|
bitMarked
))
!=
bitAllocated
)
if
((
bits
&
(
bitAllocated
|
bitMarked
))
!=
bitAllocated
)
continue
;
continue
;
*
bitbufpos
=
(
struct
BitTarget
){
obj
,
ti
,
bitp
,
shift
};
*
bitbufpos
=
(
BitTarget
){
obj
,
ti
,
bitp
,
shift
};
bitbufpos
++
;
bitbufpos
++
;
}
}
...
@@ -398,11 +401,11 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking)
...
@@ -398,11 +401,11 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking)
uintptr
*
pc
;
uintptr
*
pc
;
struct
BufferList
*
scanbuffers
;
BufferList
*
scanbuffers
;
struct
PtrTarget
*
ptrbuf
,
*
ptrbuf_end
;
PtrTarget
*
ptrbuf
,
*
ptrbuf_end
;
struct
BitTarget
*
bitbuf
;
BitTarget
*
bitbuf
;
struct
PtrTarget
*
ptrbufpos
;
PtrTarget
*
ptrbufpos
;
// End of local variable declarations.
// End of local variable declarations.
...
@@ -462,7 +465,7 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking)
...
@@ -462,7 +465,7 @@ scanblock(Workbuf *wbuf, Obj *wp, uintptr nobj, bool keepworking)
obj
=
*
(
byte
**
)
i
;
obj
=
*
(
byte
**
)
i
;
if
(
obj
>=
arena_start
&&
obj
<
arena_used
)
{
if
(
obj
>=
arena_start
&&
obj
<
arena_used
)
{
*
ptrbufpos
=
(
struct
PtrTarget
){
obj
,
0
};
*
ptrbufpos
=
(
PtrTarget
){
obj
,
0
};
ptrbufpos
++
;
ptrbufpos
++
;
if
(
ptrbufpos
==
ptrbuf_end
)
if
(
ptrbufpos
==
ptrbuf_end
)
goto
flush_buffers
;
goto
flush_buffers
;
...
...
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