Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
N
neoppod
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
1
Issues
1
List
Boards
Labels
Milestones
Merge Requests
2
Merge Requests
2
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
nexedi
neoppod
Commits
dca2750d
Commit
dca2750d
authored
Jan 26, 2017
by
Kirill Smelkov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
.
parent
604c81aa
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
6 additions
and
27 deletions
+6
-27
t/neo/protogen.go
t/neo/protogen.go
+6
-27
No files found.
t/neo/protogen.go
View file @
dca2750d
...
@@ -479,17 +479,14 @@ func (e *encoder) generatedCode() string {
...
@@ -479,17 +479,14 @@ func (e *encoder) generatedCode() string {
return
code
.
String
()
return
code
.
String
()
}
}
// XXX place?
// XXX place?
naming?
// data <- data[pos:]
// data <- data[pos:]
// // nread += pos XXX clarify about nread update
// pos <- 0
// pos <- 0
func
(
d
*
decoder
)
resetPos
()
{
func
(
d
*
decoder
)
resetPos
()
{
if
d
.
n
!=
0
{
if
d
.
n
!=
0
{
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
//d.emit("%v += %v", d.var_("nread"), d.n)
}
d
.
n
=
0
d
.
n
=
0
}
}
}
// XXX place?
// XXX place?
...
@@ -507,6 +504,7 @@ func (d *decoder) resetPos() {
...
@@ -507,6 +504,7 @@ func (d *decoder) resetPos() {
// it is inserted
// it is inserted
// - before reading a variable sized item
// - before reading a variable sized item
// - in the beginning of a loop inside
// - in the beginning of a loop inside
// - right after loop exit
func
(
d
*
decoder
)
overflowCheckPoint
()
{
func
(
d
*
decoder
)
overflowCheckPoint
()
{
// nop if we know overflow was already checked
// nop if we know overflow was already checked
if
d
.
overflowCheck
.
checked
{
if
d
.
overflowCheck
.
checked
{
...
@@ -645,11 +643,7 @@ func (d *decoder) genSlice1(assignto string, typ types.Type) {
...
@@ -645,11 +643,7 @@ func (d *decoder) genSlice1(assignto string, typ types.Type) {
d
.
emit
(
"{"
)
d
.
emit
(
"{"
)
d
.
genBasic
(
"l:"
,
types
.
Typ
[
types
.
Uint32
],
nil
)
d
.
genBasic
(
"l:"
,
types
.
Typ
[
types
.
Uint32
],
nil
)
// XXX vvv = resetPos but with nread += ... + l
d
.
resetPos
()
// XXX -> resetPos("l") ?
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
//d.emit("%v += %v + l", d.var_("nread"), d.n)
d
.
n
=
0
d
.
overflowCheckPoint
()
d
.
overflowCheckPoint
()
d
.
overflowCheck
.
AddExpr
(
"l"
)
d
.
overflowCheck
.
AddExpr
(
"l"
)
...
@@ -750,15 +744,7 @@ func (d *decoder) genSlice(assignto string, typ *types.Slice, obj types.Object)
...
@@ -750,15 +744,7 @@ func (d *decoder) genSlice(assignto string, typ *types.Slice, obj types.Object)
codegenType
(
"(*a)"
,
typ
.
Elem
(),
obj
,
d
)
codegenType
(
"(*a)"
,
typ
.
Elem
(),
obj
,
d
)
// d.resetPos() with nread update optionally skipped
d
.
resetPos
()
// XXX ^^^ criteria to skip is overflowCheck.Checked
if
d
.
n
!=
0
{
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
//if !elemFixed {
// d.emit("%v += %v", d.var_("nread"), d.n)
//}
d
.
n
=
0
}
d
.
emit
(
"}"
)
d
.
emit
(
"}"
)
d
.
overflowCheckPoint
()
d
.
overflowCheckPoint
()
...
@@ -866,14 +852,7 @@ func (d *decoder) genMap(assignto string, typ *types.Map, obj types.Object) {
...
@@ -866,14 +852,7 @@ func (d *decoder) genMap(assignto string, typ *types.Map, obj types.Object) {
d
.
emit
(
"m[key] = v"
)
d
.
emit
(
"m[key] = v"
)
}
}
// d.resetPos() with nread update optionally skipped
d
.
resetPos
()
if
d
.
n
!=
0
{
d
.
emit
(
"data = data[%v:]"
,
d
.
n
)
//if !itemFixed {
// d.emit("%v += %v", d.var_("nread"), d.n)
//}
d
.
n
=
0
}
d
.
emit
(
"}"
)
d
.
emit
(
"}"
)
d
.
emit
(
"}"
)
d
.
emit
(
"}"
)
...
...
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