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
0d079a53
Commit
0d079a53
authored
Jul 07, 2008
by
Ken Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
start of coroutine
SVN=126152
parent
c0eb7026
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
133 additions
and
94 deletions
+133
-94
src/cmd/gc/go.h
src/cmd/gc/go.h
+1
-0
src/cmd/gc/go.y
src/cmd/gc/go.y
+2
-1
src/cmd/gc/sys.go
src/cmd/gc/sys.go
+9
-4
src/cmd/gc/sysimport.c
src/cmd/gc/sysimport.c
+94
-89
src/cmd/gc/walk.c
src/cmd/gc/walk.c
+27
-0
No files found.
src/cmd/gc/go.h
View file @
0d079a53
...
...
@@ -581,6 +581,7 @@ Node* nodpanic(long);
Node
*
newcompat
(
Node
*
);
Node
*
stringop
(
Node
*
,
int
);
Node
*
mapop
(
Node
*
,
int
);
Node
*
procop
(
Node
*
);
Node
*
convas
(
Node
*
);
void
arrayconv
(
Type
*
,
Node
*
);
Node
*
colas
(
Node
*
,
Node
*
);
...
...
src/cmd/gc/go.y
View file @
0d079a53
...
...
@@ -388,7 +388,8 @@ semi_stmt:
}
|
LGO
pexpr
'('
oexpr_list
')'
{
$$
=
nod
(
OPROC
,
$
2
,
$
4
);
$$
=
nod
(
OCALL
,
$
2
,
$
4
);
$$
=
nod
(
OPROC
,
$$,
N
);
}
|
LPRINT
expr_list
{
...
...
src/cmd/gc/sys.go
View file @
0d079a53
...
...
@@ -31,10 +31,10 @@ func envv(int32) string;
func
frexp
(
float64
)
(
int32
,
float64
);
// break fp into exp,fract
func
ldexp
(
int32
,
float64
)
float64
;
// make fp from exp,fract
func
modf
(
float64
)
(
float64
,
float64
);
// break fp into double.double
func
isInf
(
float64
,
int32
)
bool
;
// test for infinity
func
isNaN
(
float64
)
bool
;
// test for not-a-number
func
Inf
(
int32
)
float64
;
// return signed Inf
func
NaN
()
float64
;
// return a NaN
func
isInf
(
float64
,
int32
)
bool
;
// test for infinity
func
isNaN
(
float64
)
bool
;
// test for not-a-number
func
Inf
(
int32
)
float64
;
// return signed Inf
func
NaN
()
float64
;
// return a NaN
func
newmap
(
keysize
uint32
,
valsize
uint32
,
keyalg
uint32
,
valalg
uint32
,
...
...
@@ -44,6 +44,8 @@ func mapaccess2(hmap *map[any]any, key any) (val any, pres bool);
func
mapassign1
(
hmap
*
map
[
any
]
any
,
key
any
,
val
any
);
func
mapassign2
(
hmap
*
map
[
any
]
any
,
key
any
,
val
any
,
pres
bool
);
func
newproc
()
bool
;
// create a new coroutine; true is child
func
readfile
(
string
)
(
string
,
bool
);
// read file into string; boolean status
func
exit
(
int32
);
...
...
@@ -91,6 +93,9 @@ export
mapassign1
mapassign2
// threads/coroutines
newproc
// files
readfile
...
...
src/cmd/gc/sysimport.c
View file @
0d079a53
This diff is collapsed.
Click to expand it.
src/cmd/gc/walk.c
View file @
0d079a53
...
...
@@ -156,6 +156,12 @@ loop:
n
=
n
->
nbody
;
goto
loop
;
case
OPROC
:
if
(
top
!=
Etop
)
goto
nottop
;
*
n
=
*
procop
(
n
);
goto
ret
;
case
OCALLMETH
:
case
OCALLINTER
:
case
OCALL
:
...
...
@@ -1588,6 +1594,27 @@ nottop:
return
N
;
}
Node
*
procop
(
Node
*
n
)
{
Node
*
r
,
*
on
;
switch
(
n
->
op
)
{
default:
fatal
(
"mapop: unknown op %E"
,
n
->
op
);
case
OPROC
:
// rewrite if(sys.newproc()) (n->left)
on
=
syslook
(
"newproc"
,
0
);
r
=
nod
(
OIF
,
N
,
N
);
r
->
ntest
=
nod
(
OCALL
,
on
,
N
);
r
->
nbody
=
n
->
left
;
dump
(
"newproc"
,
r
);
walktype
(
r
,
Etop
);
break
;
}
return
r
;
}
void
diagnamed
(
Type
*
t
)
{
...
...
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