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
eb6f6836
Commit
eb6f6836
authored
Oct 15, 2010
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
8l: function at a time code layout
R=ken2 CC=golang-dev
https://golang.org/cl/2481042
parent
e39bd1dd
Changes
4
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
343 additions
and
247 deletions
+343
-247
src/cmd/6l/span.c
src/cmd/6l/span.c
+1
-5
src/cmd/8l/asm.c
src/cmd/8l/asm.c
+4
-51
src/cmd/8l/l.h
src/cmd/8l/l.h
+1
-1
src/cmd/8l/span.c
src/cmd/8l/span.c
+337
-190
No files found.
src/cmd/6l/span.c
View file @
eb6f6836
...
...
@@ -153,9 +153,7 @@ span(void)
// NOTE(rsc): If we get rid of the globals we should
// be able to parallelize these iterations.
for
(
cursym
=
textp
;
cursym
!=
nil
;
cursym
=
cursym
->
next
)
{
if
(
!
cursym
->
reachable
)
continue
;
// TODO: move into span1
for
(
p
=
cursym
->
text
;
p
!=
P
;
p
=
p
->
link
)
{
n
=
0
;
if
(
p
->
to
.
type
==
D_BRANCH
)
...
...
@@ -189,8 +187,6 @@ span(void)
sect
=
segtext
.
sect
;
sect
->
vaddr
=
c
;
for
(
cursym
=
textp
;
cursym
!=
nil
;
cursym
=
cursym
->
next
)
{
if
(
!
cursym
->
reachable
)
continue
;
cursym
->
value
=
c
;
for
(
p
=
cursym
->
text
;
p
!=
P
;
p
=
p
->
link
)
p
->
pc
+=
c
;
...
...
src/cmd/8l/asm.c
View file @
eb6f6836
...
...
@@ -332,11 +332,9 @@ phsh(Elf64_Phdr *ph, Elf64_Shdr *sh)
void
asmb
(
void
)
{
Prog
*
p
;
int32
v
,
magic
;
int
a
,
dynsym
;
uint32
va
,
fo
,
w
,
symo
,
startva
,
machlink
;
uchar
*
op1
;
ulong
expectpc
;
ElfEhdr
*
eh
;
ElfPhdr
*
ph
,
*
pph
;
...
...
@@ -349,54 +347,9 @@ asmb(void)
seek
(
cout
,
HEADR
,
0
);
pc
=
INITTEXT
;
for
(
cursym
=
textp
;
cursym
!=
nil
;
cursym
=
cursym
->
next
)
{
for
(
p
=
cursym
->
text
;
p
!=
P
;
p
=
p
->
link
)
{
curp
=
p
;
if
(
HEADTYPE
==
8
)
{
// native client
expectpc
=
p
->
pc
;
p
->
pc
=
pc
;
asmins
(
p
);
if
(
p
->
pc
!=
expectpc
)
{
Bflush
(
&
bso
);
diag
(
"phase error %ux sb %ux in %s"
,
p
->
pc
,
expectpc
,
TNAME
);
}
while
(
pc
<
p
->
pc
)
{
cput
(
0x90
);
// nop
pc
++
;
}
}
if
(
p
->
pc
!=
pc
)
{
Bflush
(
&
bso
);
if
(
!
debug
[
'a'
])
print
(
"%P
\n
"
,
curp
);
diag
(
"phase error %ux sb %ux in %s"
,
p
->
pc
,
pc
,
TNAME
);
pc
=
p
->
pc
;
}
if
(
HEADTYPE
!=
8
)
{
asmins
(
p
);
if
(
pc
!=
p
->
pc
)
{
Bflush
(
&
bso
);
diag
(
"asmins changed pc %ux sb %ux in %s"
,
p
->
pc
,
pc
,
TNAME
);
}
}
if
(
cbc
<
sizeof
(
and
))
cflush
();
a
=
(
andptr
-
and
);
if
(
debug
[
'a'
])
{
Bprint
(
&
bso
,
pcstr
,
pc
);
for
(
op1
=
and
;
op1
<
andptr
;
op1
++
)
Bprint
(
&
bso
,
"%.2ux"
,
*
op1
&
0xff
);
Bprint
(
&
bso
,
"
\t
%P
\n
"
,
curp
);
}
memmove
(
cbp
,
and
,
a
);
cbp
+=
a
;
pc
+=
a
;
cbc
-=
a
;
}
}
codeblk
(
pc
,
segtext
.
sect
->
len
);
pc
+=
segtext
.
sect
->
len
;
if
(
HEADTYPE
==
8
)
{
int32
etext
;
...
...
@@ -406,8 +359,8 @@ asmb(void)
pc
++
;
}
pc
=
segrodata
.
vaddr
;
cflush
();
}
cflush
();
/* output read-only data in text segment */
sect
=
segtext
.
sect
->
next
;
...
...
src/cmd/8l/l.h
View file @
eb6f6836
...
...
@@ -94,8 +94,8 @@ struct Prog
Adr
from
;
Adr
to
;
Prog
*
forwd
;
Prog
*
comefrom
;
Prog
*
link
;
Prog
*
dlink
;
Prog
*
pcond
;
/* work on this */
int32
pc
;
int32
spadj
;
...
...
src/cmd/8l/span.c
View file @
eb6f6836
This diff is collapsed.
Click to expand it.
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