Commit Graph

22620 Commits (8fc0be3c2f3d53cc7926221e86f71e825689eb18)

Author SHA1 Message Date
Joe Groff 8fc0be3c2f io.sockets: remove unix.ffi inserted by auto-use 2011-10-17 21:23:36 -07:00
Joe Groff 5d0ff43613 io.sockets: receive directly into byte array 2011-10-17 21:23:11 -07:00
Joe Groff 20e49c273f io.sockets: receive-unsafe and receive-into
Analogous to read-unsafe/read-into for streams (and thereby TCP sockets), provide receive-unsafe and receive-into words for datagram sockets that receive into a caller-supplied buffer.
2011-10-17 21:23:11 -07:00
Joe Groff 5443664df7 io.encodings.utf16: guess-*coded-length hints 2011-10-17 21:23:11 -07:00
Joe Groff 4bdef412fc io.encodings.utf16: fast path & slow path speedups
Implement M: utf16[bl]e encode-string to use a fast implementation if a string is ASCII only, and do some inlining so the slow path optimizes a bit better.
2011-10-17 21:23:11 -07:00
Joe Groff aa36db5ca8 io.streams.sequence: missed a USING: 2011-10-17 21:23:10 -07:00
Joe Groff dbda6cb40b compiler.tree.dead-code: fix test
It was using "read" in an optimization test, but since "read" is now inline, it wasn't getting the expected optimized quotation back.
2011-10-17 21:23:10 -07:00
Joe Groff f626e456dd specialized-arrays: fill in missing manifest bits 2011-10-17 21:23:10 -07:00
Joe Groff cd0eb76806 io: remove higher-order stack effects
More stack checker breakage
2011-10-17 21:23:10 -07:00
Joe Groff 0353179a92 io.streams.c: remove -seek and -tell methods
M: c-stream stream-seek was broken and bootstrap doesn't need it so save some code.
2011-10-17 21:23:10 -07:00
Joe Groff e426512534 more stream-seekable? and stream-length methods
- limited-streams and throw-on-eof-streams
- string-readers and byte-readers
2011-10-17 21:23:09 -07:00
Joe Groff 1b0b765e82 io: document new words 2011-10-17 21:23:09 -07:00
Joe Groff 3588e6e4dc io.streams.c: help-lint 2011-10-17 21:23:08 -07:00
Joe Groff e589f58163 delegate.protocols: clean up input-stream-protocol 2011-10-17 21:23:08 -07:00
Joe Groff 4d224b552f io: stream-read-into and stream-read-partial-into
Safe user-facing wrappers for stream-read-unsafe.
2011-10-17 21:23:08 -07:00
Joe Groff 863ab575e3 io.ports: stream-seekable? and stream-length
io.files.windows, io.backend.unix: platform-specific backends for those methods
2011-10-17 21:23:08 -07:00
Joe Groff 5627492f9b io.encodings: stream-contents method for decoder
stream-contents on decoder is much faster implemented using a read1 loop than with the default implementation.
2011-10-17 21:23:07 -07:00
Joe Groff 225d10b4dd io: stream-contents, -seekable?, -length generics
stream-contents is extremely slow on decoder streams when implemented with each-block, and it can be implemented very quickly for streams of known length using stream-read-unsafe. Make it generic and provide some off-the-shelf implementations using each-block, a read1 loop, or length + read-unsafe. Provide new stream-seekable? and stream-length generics that can be implemented by stream implementations that know their size.
2011-10-17 21:23:07 -07:00
Joe Groff bd50acf424 unix.stat: bind to fstat 2011-10-17 21:23:07 -07:00
Joe Groff 1c85631611 io: get variables out of stream-copy loop 2011-10-17 21:23:07 -07:00
Joe Groff 09f55f82fa clean up forwarding stream-read-partial-unsafe
Now that "io" provides a method on object for stream-read-partial-unsafe that forwards to stream-read-unsafe, individual stream class that don't implement partial reads don't need to provide such a method themselves.
2011-10-17 21:23:06 -07:00
Joe Groff 805b0372da io: default methods for extended stream protocols
Provide default implementations of all the input-stream methods in terms of stream-read1 and of all the output-stream methods in terms of stream-write1.
2011-10-17 21:23:06 -07:00
Joe Groff 8322ff9452 io.streams.peek: test with memory-stream
Some binary stream types use memcpy to implement read-unsafe, while element-agnostic wrapper streams have to use copy. Make sure peek-stream works with both when it has to divide a read between the peek buffer and the underlying buffer (it does).
2011-10-17 21:23:06 -07:00
Joe Groff ae6d6ba951 specialized-arrays: direct-slice for byte-arrays
Implement nth-c-ptr and direct-like for byte-arrays so that direct-slice over a byte-array makes a uchar-array{ } over a part of the byte-array
2011-10-17 21:23:06 -07:00
Joe Groff aaec2eb1ac io: add read-unsafe and read-partial-unsafe words
Add shortcut words to operate on the input-stream like the other stream methods have. Make all those words inline too just for fun.
2011-10-17 21:23:05 -07:00
Joe Groff c3c382e45c ui.tools.listener: fix stream-read-unsafe
It was returning the number of requested bytes even if eof was encountered.
2011-10-17 21:23:05 -07:00
Joe Groff 6f12322bda kill noncopying-reader mixin, stream-read generic
Now that all streams have been updated to implement the stream-read-unsafe protocol, take out the noncopying-reader shim. Turn stream-read and stream-read-partial into plain functions over the -unsafe generics.
2011-10-17 21:23:05 -07:00
Joe Groff cd00603e2d mongodb.gridfs: leave an unmaintained-reason.txt 2011-10-17 21:23:04 -07:00
Joe Groff 6828eeb27e io.streams.peek: read-unsafe protocol 2011-10-17 21:23:04 -07:00
Joe Groff a9ab3db167 ui.tools.listener: read-unsafe for interactor†
†there's a failing test with this patch that needs investigation:

===
resource:basis/ui/tools/listener/listener-tests.factor: 90

Unit Test: { [ t ] [ "promise" get 2 seconds ?promise-timeout text = ] }

wait-timeout
===
2011-10-17 21:23:04 -07:00
Joe Groff 7caed69d26 delegate.protocols: update input-stream-protocol
Add stream-read-unsafe and stream-read-partial-unsafe to input-stream-protocol.
2011-10-17 21:23:04 -07:00
Joe Groff d2855bbf09 io: remove each-block* because it's not useful 2011-10-17 21:23:03 -07:00
Joe Groff 5e2d95ebb2 io.encodings: decoders can't really seek or tell 2011-10-17 21:23:03 -07:00
Joe Groff 73b6648b0e io.encodings: re-encrypt into stack-ese for core 2011-10-17 21:23:03 -07:00
Joe Groff 008ef0afd7 io.encodings: read-unsafe for decoders†
† currently uses locals, so not bootstrappable
2011-10-17 21:23:02 -07:00
Joe Groff 5c945595ee io.encodings.string: faster decode and encode
stream-contents is apparently way slow for decoders. Write decode out more directly as a read1/push loop so it's faster. encode isn't quite as bad, but we can still get a 25% speed improvement by writing to an appropriately sized byte-vector.
2011-10-17 21:23:02 -07:00
Joe Groff ffacdaf0da io.encodings: encoded/decoded length hints
Add guess-encoded-length and guess-decoded-length generics that encodings can implement to provide hints as to how large the translation product will be, for sizing vectors and things like that.
2011-10-17 21:23:02 -07:00
Joe Groff 9082d05582 io: tweak each-block* to be byte- or char-agnostic 2011-10-17 21:23:02 -07:00
Joe Groff 92d24b0a8f vm: no-op reallot_array with same size, for real 2011-10-17 21:23:01 -07:00
Joe Groff 3f15127ead mongodb.gridfs: move to unmaintained
It has no tests and nothing appears to use it, so I don't want to mess with it to make it implement the stream-read-unsafe interface.
2011-10-17 21:23:01 -07:00
Joe Groff d54824cb40 io: nab io.streams.peek's stream-exemplar-growable
Rename stream-element-examplar to stream-exemplar to match.
2011-10-17 21:23:01 -07:00
Joe Groff 59f0b93290 vm: make reallot_array for same size a no-op 2011-10-17 21:23:01 -07:00
Joe Groff 055196d4b7 io.streams.(limited,throwing): read-unsafe methods 2011-10-17 21:23:00 -07:00
Joe Groff 01419b3e6b io.streams.null: read-unsafe methods 2011-10-17 21:23:00 -07:00
Joe Groff 8261c941c2 io: non-copying each-block and contents variants
each-(stream-)block* is like each-block but takes a buffer object and reads into it repeatedly. (stream-)contents* determines the stream length then does a single stream-read-unsafe into a preallocated buffers. Both functions currently only work for byte-arrays (and contents* only for seekable streams), so they can't replace the non-starred versions completely just yet.
2011-10-17 21:23:00 -07:00
Joe Groff a3b15543e1 io.ports: implement read-unsafe operations 2011-10-17 21:22:59 -07:00
Joe Groff 7e9dbde99f io.buffers: factor out buffer-read-unsafe word
buffer-read-unsafe returns a length and a pointer into the buffer instead of a copy.
2011-10-17 21:22:59 -07:00
Joe Groff b79d7158be io.streams.memory: implement stream-read-unsafe
(The actual method is in alien.data due to bootstrap load order issues.)
2011-10-17 21:22:59 -07:00
Joe Groff d5f4b6f155 io.streams.sequence: change to provide read-unsafe
Change io.streams.sequence and its children io.streams.byte-array and io.streams.string to implement the -unsafe protocol and mixin noncopying-reader.
2011-10-17 21:22:59 -07:00
Joe Groff 66bb07bbcf io, io.streams.c: factor noncopying-reader mixin
Instances of the mixin implement stream-read and stream-read-partial in terms of stream-read-unsafe and stream-read-partial-unsafe, respectively.
2011-10-17 21:22:58 -07:00