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
ea56ff71
Commit
ea56ff71
authored
Dec 12, 2013
by
Ian Lance Taylor
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
reflect: Fix MakeFunc returning float32 or float64 on 386.
From-SVN: r205932
parent
c9846a8c
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
26 additions
and
15 deletions
+26
-15
libgo/go/reflect/makefunc_386.S
+10
-4
libgo/go/reflect/makefuncgo_386.go
+16
-11
No files found.
libgo/go/reflect/makefunc_386.S
View file @
ea56ff71
...
...
@@ -25,8 +25,9 @@ reflect.makeFuncStub:
struct {
esp uint32 // 0x0
eax uint32 // 0x4
st0 uint64 // 0x8
sr int32 // 0x10
st0 float64 // 0x8
sr bool // 0x10
sf bool // 0x11
}
The sr field is set by the function to a non-zero value if
the function takes a struct hidden pointer that must be
...
...
@@ -84,6 +85,10 @@ reflect.makeFuncStub:
/* Set return registers. */
movl -20(%ebp), %eax
cmpb $0, -7(%ebp)
je 2f
fldl -16(%ebp)
#ifdef __SSE2__
...
...
@@ -92,7 +97,8 @@ reflect.makeFuncStub:
movsd -16(%ebp), %xmm0
#endif
movl -8(%ebp), %edx
2:
movb -8(%ebp), %dl
addl $36, %esp
popl %ebx
...
...
@@ -100,7 +106,7 @@ reflect.makeFuncStub:
popl %ebp
.LCFI4:
test
l %edx,%edx
test
b %dl,%dl
jne 1f
ret
1:
...
...
libgo/go/reflect/makefuncgo_386.go
View file @
ea56ff71
...
...
@@ -14,9 +14,10 @@ import "unsafe"
// registers that might hold result values.
type
i386Regs
struct
{
esp
uint32
eax
uint32
// Value to return in %eax.
st0
uint64
// Value to return in %st(0).
sr
int32
// Set to non-zero if hidden struct pointer.
eax
uint32
// Value to return in %eax.
st0
float64
// Value to return in %st(0).
sr
bool
// Set to true if hidden struct pointer.
sf
bool
// Set to true if returning float
}
// MakeFuncStubGo implements the 386 calling convention for MakeFunc.
...
...
@@ -57,12 +58,13 @@ func MakeFuncStubGo(regs *i386Regs, c *makeFuncImpl) {
in
:=
make
([]
Value
,
0
,
len
(
ftyp
.
in
))
ap
:=
uintptr
(
regs
.
esp
)
regs
.
sr
=
0
regs
.
sr
=
false
regs
.
sf
=
false
var
retPtr
unsafe
.
Pointer
if
retStruct
{
retPtr
=
*
(
*
unsafe
.
Pointer
)(
unsafe
.
Pointer
(
ap
))
ap
+=
ptrSize
regs
.
sr
=
1
regs
.
sr
=
true
}
for
_
,
rt
:=
range
ftyp
.
in
{
...
...
@@ -126,13 +128,16 @@ func MakeFuncStubGo(regs *i386Regs, c *makeFuncImpl) {
v
:=
out
[
0
]
w
:=
v
.
iword
()
if
v
.
Kind
()
!=
Ptr
&&
v
.
Kind
()
!=
UnsafePointer
{
w
=
loadIword
(
unsafe
.
Pointer
(
w
),
v
.
typ
.
size
)
}
switch
v
.
Kind
()
{
case
Float32
,
Float64
:
regs
.
st0
=
uint64
(
uintptr
(
w
))
default
:
case
Ptr
,
UnsafePointer
:
regs
.
eax
=
uint32
(
uintptr
(
w
))
case
Float32
:
regs
.
st0
=
float64
(
*
(
*
float32
)(
unsafe
.
Pointer
(
w
)))
regs
.
sf
=
true
case
Float64
:
regs
.
st0
=
*
(
*
float64
)(
unsafe
.
Pointer
(
w
))
regs
.
sf
=
true
default
:
regs
.
eax
=
uint32
(
uintptr
(
loadIword
(
unsafe
.
Pointer
(
w
),
v
.
typ
.
size
)))
}
}
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