diff --git a/cmd/puffs-c/internal/cgen/expr.go b/cmd/puffs-c/internal/cgen/expr.go index f3f6a6f7..223fedcf 100644 --- a/cmd/puffs-c/internal/cgen/expr.go +++ b/cmd/puffs-c/internal/cgen/expr.go @@ -168,7 +168,7 @@ func (g *gen) writeExprOther(b *buffer, n *a.Expr, rp replacementPolicy, pp pare b.writes(")") return nil } - if isInDst(g.tm, n, t.KeySlice, 0) { + if isInDst(g.tm, n, t.KeySinceMark, 0) { b.printf("((puffs_base__slice_u8){ "+ ".ptr = %sdst.private_impl.mark, "+ ".len = %sdst.private_impl.mark ? %swptr_dst - %sdst.private_impl.mark : 0, })", diff --git a/cmd/puffs-c/internal/cgen/statement.go b/cmd/puffs-c/internal/cgen/statement.go index 29963e8a..e9419f1f 100644 --- a/cmd/puffs-c/internal/cgen/statement.go +++ b/cmd/puffs-c/internal/cgen/statement.go @@ -695,7 +695,7 @@ func isInDst(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool { methodName != t.KeyCopyFromHistory32 && methodName != t.KeyCopyFromSlice32 && methodName != t.KeyCopyFromSlice && - methodName != t.KeySlice && + methodName != t.KeySinceMark && methodName != t.KeyMark // TODO: check that n.Args() is "(x:bar)". if n.ID0().Key() != t.KeyOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs { diff --git a/lang/check/bounds.go b/lang/check/bounds.go index f09f70d3..fe344735 100644 --- a/lang/check/bounds.go +++ b/lang/check/bounds.go @@ -723,7 +723,7 @@ func (q *checker) bcheckExprOther(n *a.Expr, depth uint32) (*big.Int, *big.Int, isInSrc(q.tm, n, t.KeySkip32, 1) || isInDst(q.tm, n, t.KeyCopyFromSlice, 1) || isInDst(q.tm, n, t.KeyCopyFromSlice32, 2) || isInDst(q.tm, n, t.KeyCopyFromReader32, 2) || isInDst(q.tm, n, t.KeyCopyFromHistory32, 2) || - isInDst(q.tm, n, t.KeyWriteU8, 1) || isInDst(q.tm, n, t.KeySlice, 0) || + isInDst(q.tm, n, t.KeyWriteU8, 1) || isInDst(q.tm, n, t.KeySinceMark, 0) || isInDst(q.tm, n, t.KeyMark, 0) || isThisMethod(q.tm, n, "decode_header", 1) || isThisMethod(q.tm, n, "decode_lsd", 1) || isThisMethod(q.tm, n, "decode_extension", 1) || isThisMethod(q.tm, n, "decode_id", 2) || diff --git a/lang/check/type.go b/lang/check/type.go index dbb4c9fa..22a4a7f5 100644 --- a/lang/check/type.go +++ b/lang/check/type.go @@ -441,7 +441,7 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error { isInSrc(q.tm, n, t.KeySkip32, 1) || isInDst(q.tm, n, t.KeyCopyFromSlice, 1) || isInDst(q.tm, n, t.KeyCopyFromSlice32, 2) || isInDst(q.tm, n, t.KeyCopyFromReader32, 2) || isInDst(q.tm, n, t.KeyCopyFromHistory32, 2) || - isInDst(q.tm, n, t.KeyWriteU8, 1) || isInDst(q.tm, n, t.KeySlice, 0) || + isInDst(q.tm, n, t.KeyWriteU8, 1) || isInDst(q.tm, n, t.KeySinceMark, 0) || isInDst(q.tm, n, t.KeyMark, 0) || isThisMethod(q.tm, n, "decode_header", 1) || isThisMethod(q.tm, n, "decode_lsd", 1) || isThisMethod(q.tm, n, "decode_extension", 1) || isThisMethod(q.tm, n, "decode_id", 2) || @@ -464,7 +464,7 @@ func (q *checker) tcheckExprOther(n *a.Expr, depth uint32) error { n.SetMType(typeExprPlaceholder32) // HACK. } else if isInSrc(q.tm, n, t.KeyReadU16BE, 0) || isInSrc(q.tm, n, t.KeyReadU16LE, 0) { n.SetMType(typeExprPlaceholder16) // HACK. - } else if isInDst(q.tm, n, t.KeySlice, 0) { + } else if isInDst(q.tm, n, t.KeySinceMark, 0) { n.SetMType(typeExprSliceU8) // HACK. } else if isInDst(q.tm, n, t.KeyCopyFromSlice, 1) { n.SetMType(typeExprU64) // HACK. @@ -712,7 +712,7 @@ func isInDst(tm *t.Map, n *a.Expr, methodName t.Key, nArgs int) bool { methodName != t.KeyCopyFromHistory32 && methodName != t.KeyCopyFromSlice32 && methodName != t.KeyCopyFromSlice && - methodName != t.KeySlice && + methodName != t.KeySinceMark && methodName != t.KeyMark // TODO: check that n.Args() is "(x:bar)". if n.ID0().Key() != t.KeyOpenParen || n.CallSuspendible() != callSuspendible || len(n.Args()) != nArgs { diff --git a/lang/token/list.go b/lang/token/list.go index 5674e1ea..bc931cfa 100644 --- a/lang/token/list.go +++ b/lang/token/list.go @@ -279,6 +279,7 @@ const ( KeyReadU32LE = Key(IDReadU32LE >> KeyShift) KeyReadU64BE = Key(IDReadU64BE >> KeyShift) KeyReadU64LE = Key(IDReadU64LE >> KeyShift) + KeySinceMark = Key(IDSinceMark >> KeyShift) KeyWriteU8 = Key(IDWriteU8 >> KeyShift) KeyWriteU16BE = Key(IDWriteU16BE >> KeyShift) KeyWriteU16LE = Key(IDWriteU16LE >> KeyShift) @@ -296,7 +297,6 @@ const ( KeyCopyFromSlice32 = Key(IDCopyFromSlice32 >> KeyShift) KeySkip32 = Key(IDSkip32 >> KeyShift) KeySkip64 = Key(IDSkip64 >> KeyShift) - KeySlice = Key(IDSlice >> KeyShift) KeyLength = Key(IDLength >> KeyShift) KeyAvailable = Key(IDAvailable >> KeyShift) KeyPrefix = Key(IDPrefix >> KeyShift) @@ -466,6 +466,7 @@ const ( IDReadU32LE = ID(0xB5<= 0x8000 { // If written is longer than the ringbuffer, we can ignore the diff --git a/std/flate/decode_zlib.puffs b/std/flate/decode_zlib.puffs index 3ec97a71..6653a65a 100644 --- a/std/flate/decode_zlib.puffs +++ b/std/flate/decode_zlib.puffs @@ -50,10 +50,7 @@ pub func zlib_decoder.decode?(dst writer1, src reader1)() { var z status = try this.flate.decode?(dst:in.dst, src:in.src) // TODO: expose some API to opt out of checksumming, trading off error // detection for throughput. - // - // TODO: in.dst.slice needs a previous mark statement. Do that, and - // remove the b_wstart_dst derived variables. - checksum = this.adler.update(x:in.dst.slice()) + checksum = this.adler.update(x:in.dst.since_mark()) if z.is_ok() { break }