Mark deflate's decode_huffman_fast as !? not !??

This commit is contained in:
Nigel Tao committed 2018-11-24 20:34:31 +11:00
1 parent ec0fd9649d
commit 4ff64de78e
4 files changed
+23 -5

No files matched your search

+19
View File
@@ -155,9 +155,21 @@ func (g *gen) writeStatementAssign(b *buffer, n *a.Assign, depth uint32) error {
}
func (g *gen) writeStatementExpr(b *buffer, n *a.Expr, depth uint32) error {
// TODO: this same derived code-gen should happen for assignment and var
// statements.
//
// TODO: clean up how this and writeSuspendibles interact.
derived := n.Effect().RootCause() && n.Effect().Optional() && !n.Effect().Coroutine()
if derived {
if err := g.writeSaveExprDerivedVars(b, n); err != nil {
return err
}
}
if err := g.writeSuspendibles(b, n, depth); err != nil {
return err
}
checkStatus := false
if n.Effect().RootCause() {
if n.Effect().Coroutine() {
@@ -171,6 +183,13 @@ func (g *gen) writeStatementExpr(b *buffer, n *a.Expr, depth uint32) error {
return err
}
b.writes(";\n")
if derived {
if err := g.writeLoadExprDerivedVars(b, n); err != nil {
return err
}
}
if checkStatus {
b.writes("if (status) { goto exit; }\n")
}
+2 -3
View File
@@ -5216,7 +5216,6 @@ wuffs_deflate__decoder__decode_blocks(wuffs_deflate__decoder* self,
goto exit;
}
self->private_impl.f_end_of_block = false;
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
if (a_src.private_impl.buf) {
a_src.private_impl.buf->meta.ri =
iop_a_src - a_src.private_impl.buf->data.ptr;
@@ -5227,12 +5226,12 @@ wuffs_deflate__decoder__decode_blocks(wuffs_deflate__decoder* self,
a_src.private_impl.buf->data.ptr + a_src.private_impl.buf->meta.ri;
}
if (status) {
goto suspend;
goto exit;
}
if (self->private_impl.f_end_of_block) {
goto label_0_continue;
}
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(5);
WUFFS_BASE__COROUTINE_SUSPENSION_POINT(4);
if (a_src.private_impl.buf) {
a_src.private_impl.buf->meta.ri =
iop_a_src - a_src.private_impl.buf->data.ptr;
+1 -1
View File
@@ -199,7 +199,7 @@ pri func decoder.decode_blocks!??(dst base.io_writer, src base.io_reader) {
}
this.end_of_block = false
this.decode_huffman_fast!??(dst:args.dst, src:args.src)
this.decode_huffman_fast!?(dst:args.dst, src:args.src)
if this.end_of_block {
continue
}
+1 -1
View File
@@ -14,7 +14,7 @@
// TODO: describe how the xxx_fast version differs from the xxx_slow one, the
// assumptions that xxx_fast makes, and how that makes it fast.
pri func decoder.decode_huffman_fast!??(dst base.io_writer, src base.io_reader) {
pri func decoder.decode_huffman_fast!?(dst base.io_writer, src base.io_reader) {
// When editing this function, consider making the equivalent change to the
// decode_huffman_slow function. Keep the diff between the two
// decode_huffman_*.wuffs files as small as possible, while retaining both