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
8fffa1d6
Commit
8fffa1d6
authored
Oct 19, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
bug190.
also eliminate float80 dregs R=ken OCL=35894 CL=35896
parent
4db52d4f
Changes
11
Show whitespace changes
Inline
Side-by-side
Showing
11 changed files
with
135 additions
and
125 deletions
+135
-125
src/cmd/5g/gsubr.c
src/cmd/5g/gsubr.c
+0
-1
src/cmd/6g/gsubr.c
src/cmd/6g/gsubr.c
+0
-1
src/cmd/6g/reg.c
src/cmd/6g/reg.c
+0
-1
src/cmd/gc/align.c
src/cmd/gc/align.c
+131
-21
src/cmd/gc/gen.c
src/cmd/gc/gen.c
+0
-1
src/cmd/gc/go.h
src/cmd/gc/go.h
+3
-1
src/cmd/gc/lex.c
src/cmd/gc/lex.c
+0
-1
src/cmd/gc/reflect.c
src/cmd/gc/reflect.c
+1
-2
src/cmd/gc/subr.c
src/cmd/gc/subr.c
+0
-83
test/fixedbugs/bug190.go
test/fixedbugs/bug190.go
+0
-0
test/golden.out
test/golden.out
+0
-13
No files found.
src/cmd/5g/gsubr.c
View file @
8fffa1d6
...
...
@@ -245,7 +245,6 @@ regalloc(Node *n, Type *t, Node *o)
case
TFLOAT32
:
case
TFLOAT64
:
case
TFLOAT80
:
if
(
o
!=
N
&&
o
->
op
==
OREGISTER
)
{
i
=
o
->
val
.
u
.
reg
;
if
(
i
>=
REGALLOC_F0
&&
i
<=
REGALLOC_FMAX
)
...
...
src/cmd/6g/gsubr.c
View file @
8fffa1d6
...
...
@@ -275,7 +275,6 @@ regalloc(Node *n, Type *t, Node *o)
case
TFLOAT32
:
case
TFLOAT64
:
case
TFLOAT80
:
if
(
o
!=
N
&&
o
->
op
==
OREGISTER
)
{
i
=
o
->
val
.
u
.
reg
;
if
(
i
>=
D_X0
&&
i
<=
D_X7
)
...
...
src/cmd/6g/reg.c
View file @
8fffa1d6
...
...
@@ -1172,7 +1172,6 @@ allreg(uint32 b, Rgn *r)
case
TFLOAT32
:
case
TFLOAT64
:
case
TFLOAT80
:
case
TFLOAT
:
i
=
BtoF
(
~
b
);
if
(
i
&&
r
->
cost
>
0
)
{
...
...
src/cmd/gc/align.c
View file @
8fffa1d6
...
...
@@ -11,6 +11,8 @@
* (see ../6g/align.c).
*/
static
int
defercalc
;
uint32
rnd
(
uint32
o
,
uint32
r
)
{
...
...
@@ -98,6 +100,7 @@ dowidth(Type *t)
int32
et
;
uint32
w
;
int
lno
;
Type
*
t1
;
if
(
maxround
==
0
||
widthptr
==
0
)
fatal
(
"dowidth without betypeinit"
);
...
...
@@ -117,6 +120,9 @@ dowidth(Type *t)
return
;
}
// defer checkwidth calls until after we're done
defercalc
++
;
lno
=
lineno
;
lineno
=
t
->
lineno
;
t
->
width
=
-
2
;
...
...
@@ -155,33 +161,36 @@ dowidth(Type *t)
case
TINT32
:
case
TUINT32
:
case
TFLOAT32
:
case
TPTR32
:
// note lack of recursion
w
=
4
;
break
;
case
TINT64
:
case
TUINT64
:
case
TFLOAT64
:
case
TPTR64
:
// note lack of recursion
w
=
8
;
break
;
case
TFLOAT80
:
w
=
10
;
case
TPTR32
:
w
=
4
;
checkwidth
(
t
->
type
);
break
;
case
TPTR64
:
w
=
8
;
checkwidth
(
t
->
type
);
break
;
case
TDDD
:
w
=
2
*
widthptr
;
break
;
case
TINTER
:
// implemented as 2 pointers
offmod
(
t
);
w
=
2
*
widthptr
;
offmod
(
t
);
break
;
case
TCHAN
:
// implemented as pointer
dowidth
(
t
->
type
);
dowidth
(
t
->
down
);
w
=
widthptr
;
checkwidth
(
t
->
type
);
break
;
case
TMAP
:
// implemented as pointer
dowidth
(
t
->
type
);
w
=
widthptr
;
checkwidth
(
t
->
type
);
checkwidth
(
t
->
down
);
break
;
case
TFORW
:
// should have been filled in
case
TANY
:
...
...
@@ -198,15 +207,18 @@ dowidth(Type *t)
case
TARRAY
:
if
(
t
->
type
==
T
)
break
;
if
(
t
->
bound
>=
0
)
{
dowidth
(
t
->
type
);
if
(
t
->
bound
>=
0
)
w
=
t
->
bound
*
t
->
type
->
width
;
else
if
(
t
->
bound
==
-
1
)
if
(
w
==
0
)
w
=
maxround
;
}
else
if
(
t
->
bound
==
-
1
)
{
w
=
sizeof_Array
;
checkwidth
(
t
->
type
);
}
else
fatal
(
"dowidth %T"
,
t
);
// probably [...]T
if
(
w
==
0
)
w
=
maxround
;
break
;
case
TSTRUCT
:
...
...
@@ -218,20 +230,118 @@ dowidth(Type *t)
break
;
case
TFUNC
:
// function is 3 cated structures;
// compute their widths as side-effect.
w
=
widstruct
(
*
getthis
(
t
),
0
,
0
);
w
=
widstruct
(
*
getinarg
(
t
),
w
,
1
);
w
=
widstruct
(
*
getoutarg
(
t
),
w
,
1
);
t
->
argwid
=
w
;
// make fake type to check later to
// trigger function argument computation.
t1
=
typ
(
TFUNCARGS
);
t1
->
type
=
t
;
checkwidth
(
t1
);
//
but
width of func type is pointer
// width of func type is pointer
w
=
widthptr
;
break
;
case
TFUNCARGS
:
// function is 3 cated structures;
// compute their widths as side-effect.
t1
=
t
->
type
;
w
=
widstruct
(
*
getthis
(
t1
),
0
,
0
);
w
=
widstruct
(
*
getinarg
(
t1
),
w
,
1
);
w
=
widstruct
(
*
getoutarg
(
t1
),
w
,
1
);
t1
->
argwid
=
w
;
break
;
}
t
->
width
=
w
;
lineno
=
lno
;
if
(
defercalc
==
1
)
resumecheckwidth
();
else
--
defercalc
;
}
/*
* when a type's width should be known, we call checkwidth
* to compute it. during a declaration like
*
* type T *struct { next T }
*
* it is necessary to defer the calculation of the struct width
* until after T has been initialized to be a pointer to that struct.
* similarly, during import processing structs may be used
* before their definition. in those situations, calling
* defercheckwidth() stops width calculations until
* resumecheckwidth() is called, at which point all the
* checkwidths that were deferred are executed.
* dowidth should only be called when the type's size
* is needed immediately. checkwidth makes sure the
* size is evaluated eventually.
*/
typedef
struct
TypeList
TypeList
;
struct
TypeList
{
Type
*
t
;
TypeList
*
next
;
};
static
TypeList
*
tlfree
;
static
TypeList
*
tlq
;
void
checkwidth
(
Type
*
t
)
{
TypeList
*
l
;
if
(
t
==
T
)
return
;
// function arg structs should not be checked
// outside of the enclosing function.
if
(
t
->
funarg
)
fatal
(
"checkwidth %T"
,
t
);
if
(
!
defercalc
)
{
dowidth
(
t
);
return
;
}
if
(
t
->
deferwidth
)
return
;
t
->
deferwidth
=
1
;
l
=
tlfree
;
if
(
l
!=
nil
)
tlfree
=
l
->
next
;
else
l
=
mal
(
sizeof
*
l
);
l
->
t
=
t
;
l
->
next
=
tlq
;
tlq
=
l
;
}
void
defercheckwidth
(
void
)
{
// we get out of sync on syntax errors, so don't be pedantic.
// if(defercalc)
// fatal("defercheckwidth");
defercalc
=
1
;
}
void
resumecheckwidth
(
void
)
{
TypeList
*
l
;
if
(
!
defercalc
)
fatal
(
"resumecheckwidth"
);
for
(
l
=
tlq
;
l
!=
nil
;
l
=
tlq
)
{
l
->
t
->
deferwidth
=
0
;
tlq
=
l
->
next
;
dowidth
(
l
->
t
);
l
->
next
=
tlfree
;
tlfree
=
l
;
}
defercalc
=
0
;
}
void
...
...
@@ -263,7 +373,7 @@ typeinit(void)
isint
[
TUINT
]
=
1
;
isint
[
TUINTPTR
]
=
1
;
for
(
i
=
TFLOAT32
;
i
<=
TFLOAT
80
;
i
++
)
for
(
i
=
TFLOAT32
;
i
<=
TFLOAT
64
;
i
++
)
isfloat
[
i
]
=
1
;
isfloat
[
TFLOAT
]
=
1
;
...
...
src/cmd/gc/gen.c
View file @
8fffa1d6
...
...
@@ -553,7 +553,6 @@ cgen_as(Node *nl, Node *nr)
case
TFLOAT32
:
case
TFLOAT64
:
case
TFLOAT80
:
nr
->
val
.
u
.
fval
=
mal
(
sizeof
(
*
nr
->
val
.
u
.
fval
));
mpmovecflt
(
nr
->
val
.
u
.
fval
,
0
.
0
);
nr
->
val
.
ctype
=
CTFLT
;
...
...
src/cmd/gc/go.h
View file @
8fffa1d6
...
...
@@ -406,7 +406,6 @@ enum
TFLOAT32
,
// 12
TFLOAT64
,
TFLOAT80
,
TFLOAT
,
TBOOL
,
// 16
...
...
@@ -431,6 +430,9 @@ enum
TNIL
,
TBLANK
,
// pseudo-type for frame layout
TFUNCARGS
,
NTYPE
,
};
enum
...
...
src/cmd/gc/lex.c
View file @
8fffa1d6
...
...
@@ -1207,7 +1207,6 @@ static struct
"float32"
,
LNAME
,
TFLOAT32
,
OXXX
,
"float64"
,
LNAME
,
TFLOAT64
,
OXXX
,
"float80"
,
LNAME
,
TFLOAT80
,
OXXX
,
"bool"
,
LNAME
,
TBOOL
,
OXXX
,
"byte"
,
LNAME
,
TUINT8
,
OXXX
,
...
...
src/cmd/gc/reflect.c
View file @
8fffa1d6
...
...
@@ -687,7 +687,6 @@ dumptypestructs(void)
// but using runtime means fewer copies in .6 files.
if
(
strcmp
(
package
,
"runtime"
)
==
0
)
{
for
(
i
=
1
;
i
<=
TBOOL
;
i
++
)
if
(
i
!=
TFLOAT80
)
dtypesym
(
ptrto
(
types
[
i
]));
dtypesym
(
ptrto
(
types
[
TSTRING
]));
dtypesym
(
typ
(
TDDD
));
...
...
src/cmd/gc/subr.c
View file @
8fffa1d6
...
...
@@ -899,7 +899,6 @@ etnames[] =
[
TFLOAT
]
=
"FLOAT"
,
[
TFLOAT32
]
=
"FLOAT32"
,
[
TFLOAT64
]
=
"FLOAT64"
,
[
TFLOAT80
]
=
"FLOAT80"
,
[
TBOOL
]
=
"BOOL"
,
[
TPTR32
]
=
"PTR32"
,
[
TPTR64
]
=
"PTR64"
,
...
...
@@ -1044,7 +1043,6 @@ basicnames[] =
[
TFLOAT
]
=
"float"
,
[
TFLOAT32
]
=
"float32"
,
[
TFLOAT64
]
=
"float64"
,
[
TFLOAT80
]
=
"float80"
,
[
TBOOL
]
=
"bool"
,
[
TANY
]
=
"any"
,
[
TDDD
]
=
"..."
,
...
...
@@ -3073,87 +3071,6 @@ structcount(Type *t)
return
v
;
}
/*
* when a type's width should be known, we call checkwidth
* to compute it. during a declaration like
*
* type T *struct { next T }
*
* it is necessary to defer the calculation of the struct width
* until after T has been initialized to be a pointer to that struct.
* similarly, during import processing structs may be used
* before their definition. in those situations, calling
* defercheckwidth() stops width calculations until
* resumecheckwidth() is called, at which point all the
* checkwidths that were deferred are executed.
* sometimes it is okay to
*/
typedef
struct
TypeList
TypeList
;
struct
TypeList
{
Type
*
t
;
TypeList
*
next
;
};
static
TypeList
*
tlfree
;
static
TypeList
*
tlq
;
static
int
defercalc
;
void
checkwidth
(
Type
*
t
)
{
TypeList
*
l
;
// function arg structs should not be checked
// outside of the enclosing function.
if
(
t
->
funarg
)
fatal
(
"checkwidth %T"
,
t
);
if
(
!
defercalc
)
{
dowidth
(
t
);
return
;
}
if
(
t
->
deferwidth
)
return
;
t
->
deferwidth
=
1
;
l
=
tlfree
;
if
(
l
!=
nil
)
tlfree
=
l
->
next
;
else
l
=
mal
(
sizeof
*
l
);
l
->
t
=
t
;
l
->
next
=
tlq
;
tlq
=
l
;
}
void
defercheckwidth
(
void
)
{
// we get out of sync on syntax errors, so don't be pedantic.
// if(defercalc)
// fatal("defercheckwidth");
defercalc
=
1
;
}
void
resumecheckwidth
(
void
)
{
TypeList
*
l
;
if
(
!
defercalc
)
fatal
(
"restartcheckwidth"
);
defercalc
=
0
;
for
(
l
=
tlq
;
l
!=
nil
;
l
=
tlq
)
{
l
->
t
->
deferwidth
=
0
;
dowidth
(
l
->
t
);
tlq
=
l
->
next
;
l
->
next
=
tlfree
;
tlfree
=
l
;
}
}
/*
* return power of 2 of the constant
* operand. -1 if it is not a power of 2.
...
...
test/bugs/bug190.go
→
test/
fixed
bugs/bug190.go
View file @
8fffa1d6
File moved
test/golden.out
View file @
8fffa1d6
...
...
@@ -150,15 +150,6 @@ BUG: should fail
=========== bugs/bug169.go
BUG: errchk: command succeeded unexpectedly
=========== bugs/bug190.go
bugs/bug190.go:11: invalid recursive type []S
bugs/bug190.go:13: invalid recursive type chan S
bugs/bug190.go:15: invalid recursive type func(S) (S)
bugs/bug190.go:16: invalid recursive type S
bugs/bug190.go:16: invalid recursive type S
bugs/bug190.go:16: invalid recursive type S
BUG: should compile
=========== bugs/bug193.go
BUG: errchk: bugs/bug193.go:14: missing expected error: 'shift'
...
...
@@ -167,9 +158,5 @@ too many calls: 5
panic PC=xxx
BUG: bug196
=========== bugs/bug210.go
bugs/bug210.go:10: invalid recursive type []T
BUG: should compile
=========== bugs/bug211.go
BUG: errchk: command succeeded unexpectedly
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