[Vm-dev] Bug in Interpreter>>primitiveNextPut:
henrik.s.johansen at veloxit.no
Thu Nov 26 14:10:52 UTC 2009
Interpreter >> primitiveNextPut:
limit := self fetchInteger: StreamReadLimitIndex ofObject: stream.
atIx := (array bitAnd: AtCacheMask) + AtPutBase.
(index < limit and: [(atCache at: atIx+AtCacheOop) = array])
so basically, it needs ReadLimit to be > 0. (Which is only true for (Read)WriteStreams if created with on:from:to:).
Changing the first line to
limit := self fetchInteger: StreamWriteLimitIndex ofObject: stream.
and the primitive now works.
ws := WriteStream on: (String new: 500000).
[1 to: 500000 do: [:ix | ws nextPut: $a]] timeToRun
Inserted a counter after the prim call, for the loop above it was always >= 500000, with fix it's >=1.
More information about the Vm-dev