[squeak-dev] Interpreter VM on Debian testing/unstable 64 bits?

David T. Lewis lewis at mail.msen.com
Wed Jun 7 01:23:18 UTC 2017


On Tue, Jun 06, 2017 at 11:40:36PM +0200, Bert Freudenberg wrote:
> More info on the VM problem: it disappears when compiled with -O1. Sounds
> like it may be some undefined behavior, which may have been fixed in the
> mean time?
> 
> https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=862576
> 
> - Bert -

I think that to some extent the issue is how or if to support Etoys directly
as a Debian package, as opposed to something that a Debian user might expect
to download from an Etoys web site without compiling the VM.

Supporting the interpreter VM as a Debian package is something that we have not
done well in the past, and it will require some time and effort if we want to do
it in the future. I don't think it would be terribly difficult, but it does require
time and effort, and it is not something that I would have the cycles to support
right now (but maybe someone else might have an interest? if so please speak up!).

The squeak-vm 4.10.2.2614-4 package on Debian is based on some fairly old
sources, so it is quite likely that whatever bug is being reported on the
Debian list has been long since fixed.

To give an idea of how much has changed since that time, see the attached list
of changes from VMMaker. If we were to update the Debian squeak-vm package with
current sources, it would include all of these changes, along with matching
changes on the ./platforms side.

Dave

-------------- next part --------------
-----
VMMaker-dtl.392 (12 January 2017):
VMMaker 4.16.3

Support very early images in which method context copy fails due to stack pointer not yet adjusted to position. For these images, disable stack limit bounds check. Based on SqueakJS implementation as described below.

From: Bert Freudenberg <bert at freudenbergs.de>
Date: Wed, 11 Jan 2017 17:10:24 +0100
To: The general-purpose Squeak developers list <squeak-dev at lists.squeakfoundation.org>
Subject: Re: [squeak-dev] Backward image and VM compatibility

Some early images fill the context stack before advancing its stack pointer. I have a flag to allow that, it's pretty certainly used in primitive 61. Normally the VM does not allow access beyond the SP because there is garbage there (stack pops do not nil out the context slot):

https://github.com/bertfreudenberg/SqueakJS/search?q=allowAccessBeyondSP

But since the regular VM does not allow it, no image (except the really old ones) ever does it, so I just leave the flag enabled whenever "oldPrims" is in effect ;) Would be better if we could come up with a better way to identify these images.
-----
VMMaker-dtl.391 (5 January 2017):
VMMaker 4.16.2

Old image support: Rescue five sound primitive assignments for updatePrimitiveTable for primitives that should be loaded from SouondGenerationPlugin, not from SoundPlugin.

The following ancient primitives are still not loadable into the primitiive table for old image support:

  #primWaveTableSoundmixSampleCountintostartingAtpan
  #primFMSoundmixSampleCountintostartingAtpan
  #primPluckedSoundmixSampleCountintostartingAtpan
  #primSampledSoundmixSampleCountintostartingAtpan
  #oldprimSampledSoundmixSampleCountintostartingAtleftVolrightVol

In addition #primitiveReadJoystick does not load from JoystickTabletPlugin when running on Linux, but this is confirmed to be an artifact of the function loader, which abandons the attempt to load a module if #initialiseModule answers false, as is the case in the Unix stub code implementation (so it should work on platforms that do support the joystick plugin).
-----
VMMaker-dtl.390 (2 January 2017):
VMMaker 4.16.1 - Support older Squeak images back to version 1.13 (circa 1996)

This set of updates is based on SqueakJS as a reference implementation that
supports a full range of images from Squeak 1.13 through the latest Spur images.

Numbered primitives are identified in the primitive table, established by the
implementations of #initializePrimitiveTable in the various images. Class
PrimitiveTableHistory has been added to document known versions of the
primitive table.

Background: In general, primitives that originated as numbered primitives in early
Squeak versions have been reimplemented as named primitives in the base
interpreter and in various interpreter plugins. The goal is to reduce or eliminate
use of numbered primitives. Support for old images therefore amounts to reassiging
the old primitive numbers to named primitives where necessary to support
running an older image.

Strategy: Check if the current image #hasClosures based on the image format
number, then provide an older set of numbered primitives suitable for a range of
pre-closure images dating back to Squeak 1.13. Do this by starting with the
default primitive table, checking at entry to interpreter() to see if this is a
pre-closure image, then installing old primitives as needed in #updatePrimitiveTable.

Interpreter primitives that require a primitive number for older images are
added to the primitive table with #installPrimitive:at: and primitives that are now
implemented in interpreter plugins are loaded and installed in the primitive
table with #installPrimitive:from:at:.
-----
VMMaker-dtl.389 (21 December 2016):
VMMaker 4.15.11

Fix the interpreter for running images of the Squeak 3.6 and 3.8 era. Several obsolete primitives were removed in VMMaker-dtl.387, but these are still required for older images.

For this update, the primitive table initialiation is unchanged, but a run time update is done for the ContextInterpreter to restore the old primitive assignments. It is not clear if this will be a good strategy but for now add InterpreterPrimitives>>installPrimitive:at: and use it to update the table on first entry to the interpret() loop.

Possible future updates could support run time fixup to the primitive table for Squeak 3.2 and earlier images.
-----
VMMaker-dtl.388 (11 December 2016):
VMMaker 4.15.10 - Fix 'debug it' from the menu for V3 images.

Fix primitiveChangeClass by factoring fetchClassOfNonImm: into a version for ClassicObjectMemory that calls fetchClassofNonInt: and a version for NewObjectMemory that retains the oscog implementation.

TODO: The primitive now works as expected for interpreter VM, but fetchClassOfNonImm: should be revisited for StackInterpreter on V3 image (may depend on Spur logic).
-----
VMMaker-dtl.387 (8 November 2016):
VMMaker 4.15.9

Various refactorings for stack/context interpreters.

VMMaker tool allow selection of context or stack interpreter (stack is not yet functional, requires struct code generation).

Add some FilePlugin updates from oscog, excluding those with platforms code dependencies (primitiveDirectoryEntry, primitiveDirectoryDelimitor).

Retire some old primitives in Interpreter class>>initializePrimitiveTable to align with oscog.
-----
VMMaker-dtl.386 (11 September 2016):
VMMaker 4.15.8

Update primitiveAdoptInstance and related methods from latest oscog. Resolves a problem in which primitive could fail but still modify the stack.

Add SlangTest>>testStatementListAsExpression to document a missing feature from oscog code generator not yet present here. Reorganize objCouldBeClassObj: to avoid the feature.
-----
VMMaker-dtl.385 (10 August 2016):
Deprecate buildCodeGeneratorUpTo: as per VMMaker.oscog. Resolves a code generation problem for the Squeak3D plugin (maintained on squeaksource.com independent of VMMaker) that was introduced in Balloon3D-Plugins-eem.11.

Follow up for Balloon3D package : The #respondsTo: hack in B3DEnginePlugin class>> translateInDirectory:doInlining: can now be removed.
-----
VMMaker-dtl.384 (9 July 2016):
VMMaker 4.15.7
Updates from oscog, Laura's JPEGReadWriter2 plus a missing fsync primitive:

Name: VMMaker.oscog-eem.1489

Integrate Monty's fsync primitive.

Name: VMMaker.oscog-eem.1887

Integrate Laura's greyscale JPEG support code, eliminating one cCode:inSmalltalk.  Too lazy to eliminate the other. Requires http://squeakvm.org/svn/squeak/trunk/platforms/Cross/plugins r3742.

Name: VMMaker.oscog-eem.1888

Integrate changes proposed by Laura Perez Cerrato

"Working on JPEGReadWriter2 I noticed that both reading and writing primitives include a sanity check that ensures that the source/destination Smalltalk bitmap has the exact size in bytes needed, instead of checking that its size is at least that needed. Some BitBlt primitives perform the same check, thus not allowing operations with forms with associated bitmaps with a size greater than needed. 

When performing operations with images, and specially when such images are large in size, actually processing the images takes a small fraction of the time it takes to perform the whole operation, while allocating and deallocating correctly sized bitmaps takes much longer. If one would wish to process a series of similarly sized images (with a definite maximum size), it would be desirable to allocate a bitmap big enough to hold any of them only once and then reuse it, thus avoiding the aforementioned cost. Checking that source and destination bitmaps are big enough instead of checking that their size is exactly that which is expected would allow that optimization.

A brief exploration of BitBlt and JPEGReadWriter2's code, accompanied with some experimenting of what would happen if such sanity checks were modified as proposed, has lead me to thinking that these changes would be benefitial. I haven't observed any undesirable side effects (meaning, nothing seems to have blown up :))....."
-----
VMMaker-dtl.383 (14 May 2016):
Add ImmX11Plugin to generated sources
-----
VMMaker-dtl.382 (1 May 2016):
VMMaker 4.15.6

Fix export declarations for primitives, and remove the now unnecessary type cast in #primitiveTableString.

The problem was caused by return types being set in TMethods prior to all primitives having been added to the code generator. Move the TMethod return type settings up to InterpreterPrimitives. Issue had been masked by the type casts in primitiveTableString.
-----
VMMaker-dtl.381 (22 April 2016):
Let the classic interpreter be ContextInterpreter, the stack interpreter be StackInterpreter, and both inherit from Interpreter. Begin associated refactorings.

No change to generate code for context interpreter.
-----
VMMaker-dtl.380 (9 April 2016):
Ensure an initialization in #inlineSelectorType: required now by earlier changes introduced in VMMaker-dtl.357. Fixes improper test failures, no change to generated code.

Test notes: #testIvarShouldNotBeRedeclaredAsLocal remains as a failure that needs a fix in code generation. FloatMathPluginTests are failing, need to investigate.
-----
VMMaker-dtl.379 (27 March 2016):
VMMaker 4.15.5
Nicolas Cellier's LargeIntegersPlugin improvements from oscog branch.
-----
VMMaker-dtl.378 (16 March 2016):
VMMaker 4.15.4
Allow the optional parameter to primitiveUtcWithOffset to be either an Array or other object with two or more slots to store UTC posix microseconds and time zone offset in seconds. This allows possible future implementations of DateAndTime or similar to accept Posix UTC in the first instance variable, time zone offset in the second instance variable, with possible additional instance variables added as required.
-----
VMMaker-dtl.377 (27 February 2016):
VMMaker 4.15.3

For Interpreter>>primitiveResume: add check for isContext: required for Squeak trunk as of Kernel-eem.1000 and above.

Background - see Kernel-eem.1000 in Squeak trunk, update comment repeated here for reference:
Make Process>>resume primitive.  Andreas fixed the ancestor of the Cog VM so that the resume primitive fails if the suspendedContext is not a context.  This renders Tim's suspendedCOntext ifNil: [^self primitiveFailed] guard obsolete.  Hence nuke primitiveResume.

Remove <inline: false> from Interpreter>>resume: because it is no longer required. The inliner is much improved since early days, and many other <inline: false> directives can probably also be removed, but that can be the subject of a later update.
-----
VMMaker-tfel.376 (17 February 2016):
Merge relevant Simulation changes from oscog

VMMaker.oscog-tfel.1683
  - Move BitBlt simulation methods into VMMaker, they can only be used if VMMaker is loaded, anyway, and they do not have any senders (besides a duplicated test that is also in VMMaker)
  - Avoid ENABLE_FAST_BLT binding lookup in BitBltSimulator, because that is not simulatable code

VMMaker.oscog-tfel.1682
  - fix BitBlt simulation to go through primitiveCopyBits primitive.

VMMaker.oscog-tfel.1677
  - Fix BitBltSimulation (for RSqueak on Spur)
-----
VMMaker-dtl.375 (23 January 2016):
VMMaker 4.15.2

Move the critical section primitives and related methods to InterpreterPrimitives from StackInterpreter, and make them work in the context interpreter.. Install as numbered primitives 185, 186, 187.
-----
VMMaker-dtl.374 (23 January 2016):
VMMaker 4.15.1

As of Kernel-eem.971 in the Squeak trunk update stream, primitiveSignalAtUTCMicroseconds
is a required primitive. Provide an implementation for the context interpreter. Tick resolution
continues to be 1 msec (not microsecond precision).

Refoctoring note: The microsecond primitives are currently implemented separately in
the context interpreter and stack interpreter. Future refactoring could move these to
InterpreterPrimitives, such that the oriiginal millisecond tick resolution would be replaced.
-----
VMMaker-dtl.373 (10 December 2015):
VMMaker 4.14.3
Mantis 5228: Include Cryptographic Primitives in Base VM - DESPlugin

Remove DSAPlugin from VMMaker because it can be loaded from package CryptographyPlugins from http://www.squeaksource.com/Cryptography which also permits the other plugins in that package to be included.

Assume that the following four plugins will now be loaded from Cryptography:
  DESPlugin
  DSAPlugin (generated as module name DSAPrims)
  MD5Plugin
  SHA256Plugin

Update VMMakerTool class defaultUnixSpec to include DESPlugin (internal)
-----
VMMaker-tpr.372 (23 November 2015):
Add two (currently null) methods so that the Squeak3D plugin (via B3DEnginePlugin) can be modified to work in a Cog VMmaker without breaking this version.
A check generate shows that none of the code generated changes.
-----
VMMaker-dtl.371 (26 September 2015):
Collect a few scattered method comments into InterpreterProxy to provide better reference for plugin writers.
-----
VMMaker-dtl.370 (14 September 2015):
VMMaker 4.14.2

Nicolai Hess fix for Mantis 0007265: Bug in Matrix2x3Plugin okayIntValue: (also fixed in VMMaker.oscog-eem.1449 for Spur).
BitmapStreamTests pass before and after the change.

Change VMMakerTool layout to work with Squeak 4.6 / 5.0
-----
VMMaker-tfel.369 (12 August 2015):
simulate SNAPSHOT primitive in RSqueak (requires SystemTracer2 to be installed)
-----
VMMaker-dtl.368 (21 July 2015):
Fix VMMaker updateFromServer
-----
VMMaker-dtl.367 (21 July 2015):
VMMaker 4.14.1

Eliot's fix for sqComplexEvent on 64-bit object memory to support iOS VM.

Requires platforms source version SVN 3412 or greater.

Background:

In sq.h, the sqInputEvent struct was originally defined with all fields of type int. These fields are accessed in primitiveGetNextEvent by treating the sqInputEvent struct as an array of int. The sqComplexEvent struct variation was introduced for the iOS VM, and uses one of the available fields to store an object pointer of type usqInt.

In the case of a 64 bit object memory, sizeof(usqInt) is 8, and the object pointer cannot be stored in a C variable of type int. Therefore, change the declaration of all sqInputEvent data structures to have fields of type long, which are large enough to store objects pointers on all platforms of interest. This allows the event struct to safely store both integers and object pointers regardless of object memory word size.
-----
VMMaker-tfel.366 (26 June 2015):
fix some code paths in the BalloonEngineSimulation that are used when rendering true type fonts
-----
VMMaker-tfel.365 (26 June 2015):
generalize primitive simulation for Balloon, BitBlt, and image snapshot simulation (used RSqueak in lieu of VM implementation/plugin)
-----
VMMaker-dtl.364 (13 May 2015):
When running in Spur with a default update stream set to 'update.spur', allow "VMMaker updateFromServer" to work with the 'update' stream in the VMMaker project.

@eliot: If we add 'update.oscog' configuration maps in VMMaker, they can now be used to provide a separate update stream for vmmaker.oscog. The 'update' and 'update.oscog' update streams would be independent of the 'update' and 'update.spur' preferences in Squeak trunk.
-----
VMMaker-tfel.363 (30 April 2015):
Fix botched merge of VMMaker-tfel.362 and VMMaker-dtl.359
-----
VMMaker-tfel.362 (30 April 2015):
Refactor InterpreterProxy to always go through primitiveFailFor: to set the primFailCode. In primitiveFailFor: primitive 255 is called to indicate that we are currently simulating a primitive that is about to fail for VMs (like RSqueakVM) that need to handle that case
-----
VMMaker-MattSpr.361 (29 April 2015):
Call primitive 255 in InterpreterProxy to indicate failing primitive simulations to the VM (if supported).
-----
VMMaker-tfel.360 (12 March 2015):
Add methods to simulate B2DPlugin primitives easily
-----
VMMaker-tfel.359 (11 March 2015):
optimize BitBltSimulator to avoid reinitialization on each call to simulatedCopyBits. Makes it roughly 500x faster on RSqueakVM
-----
VMMaker-tfel.358 (11 February 2015):
Fix simulation of full world draw
-----
VMMaker-dtl.357 (30 December 2014):
VMMaker 4.13.10
Incorporate Plan9 compatibility changes by Alex Franchuk .
Reference Mantis 7821: Make generated interpreter code compatible with Plan9's POSIX C compiler

Summary of changes:
- Add inlineReturnTypes to CCodeGenerator. Use this in TSendNode to provide type casts where necessary to avoid compiler complaints.
- In TMethod, add a return null to void methods that do not contain an explicit return.
- In TAssigmentNode, generated an explicit type cast if needed.
- Variable declaration fixes for callExternalPrimitive:, ioUTCMicroseconds, primitiveLocalMicrosecondClock, primitiveUTCMicrosecondClock.

Miscellaneous
- Do not initialize inlineList to an empty Array or Dictionary because it is actually a Set that is initialized elsewhere in collectInlineList.
- Eliminate redundant calls to #initialize in VMMaker and subclasses.
- Clean up redundant initializations in ObjectMemory class>>initialize.

Note: RomePlugin (not in VMMaker package) now requires an update to ensure that #replaceCairoCalls produces selectors that are symbols, not strings.
-----
VMMaker-dtl.356 (16 December 2014):
VMMaker 4.13.9 - Update ScratchPlugin from VMMaker.oscog-tpr.989 plus previous updates by Eliot:

Name: VMMaker.oscog-tpr.989
Author: tpr
Time: 16 December 2014, 2:59:27.229 pm
Update the ScratchPlugin bilinear scaling prim to include the correct alpha channel value for non-transparent output pixels.
-----
VMMaker-dtl.355 (25 November 2014):
VMMaker 4.13.8

Complete the adoption of oscog improvements that eliminate use of #asSymbol hacks, and that produce correct code generation for #sizeOf: and #flag: methods. Also includes generation of constants in hex format, which improves readability of generated code.

Add SlangTest>>testLiteralName to verify translation of sizeOf: #Foo as sizeOf(Foo) rather than sizeOf("Foo").
-----
VMMaker-dtl.354 (24 October 2014):
VMMaker 4.13.7

Fix bug in primitiveChangeClass exposed in the 64 bit 68002 image format.
Corrects failure in evaluating:

   Inspector new primitiveChangeClassTo: CompiledMethodInspector new
-----
VMMaker-bf.353 (10 October 2014):
Use '.js' as moduleExtension if JSCodeGenerator is present and active. This is to avoid the need for an override in the VMMakerJS package..
-----
VMMaker-bf.352 (9 October 2014):
Set reclaimableContextCount to 0 in internalCannotReturn:.
-----
VMMaker-bf.351 (1 October 2014):
Do not hard-code ".c" module file extension.
-----
VMMaker-dtl.350 (6 September 2014):
VMMaker 4.13.6

Fix primitiveBitShift (primitive 17) for sqInt declared 64 bits, as in a VM for 64-bit image format 68002.

In image format 68002, bit shift left failed because of return type limited to a 32-bit large integer, but internally the primitive successfully shifted left into a variable declared as a 64 bit sqInt.. The simple fix (implemented here) is to declare the variable as 32 bit unsigned to agree with the 32-bit logic of the existing primitive.

Note that permitting a left shift into a 64 bit variable makes sense generally, and the primitive could be recoded to accomodate this for shift left, with the primitive answering positive64BitIntegerFor: rather than positive32BitIntegerFor: in the case of a shift left to allow for the greater range (not implemented in this update).

With this update, all KernelTests-Numbers tests pass for the 64-bit image format 68002.
-----
VMMaker-dtl.349 (20 July 2014):
VMMaker 4.13.7
Add the improved LargeIntegersPlugin implementation by Nicolas Cellier
-----
VMMaker-dtl.348 (20 July 2014):
VMMaker 4.13.6
Merge VMMaker.oscog-eem.826 except:
- Do not add the #initialize methods, not required because variables are declared static, therefore guaranteed to be initialized to 0. Also would require code generator changes for special treatment of instance side #initialize..
- Do not ^self unnecessarily, not required here and code generated changes would be needed.

Name: VMMaker.oscog-eem.826
Author: eem
Time: 18 July 2014, 5:25:22.251 pm
Fix the ZipPlugin (InflatePlugin&DeflatePlugin) to no longer depend on specific instance sizes for ReadStream and WriteStream which allows some leniency in redefining these classes.
-----
VMMaker-dtl.347 (23 June 2014):
Ensure that initializeSmallIntegers is called before generating the interpreter file because pool constants may have been changed when running simulation (symptom: a 64 bit image crashes because ConstMinusOne has been rendered as unsigned 32 bit, when it should be twos complement -1).

Remove KedamaPlugin from defaultUnixSpec because it duplicates the more up to date KedamaPlugin2.

Fix a trivial comment typo in SlangTest>>testFetchClssOfIsFullyInlined.
-----
VMMaker-dtl.346 (30 May 2014):
VMMaker 4.13.5
In primitiveUtcWithOffset, use storePointer:ofObject:withValue: rather than stObject:at:put: to avoid unnecessary checks
-----
VMMaker-dtl.345 (12 March 2014):
Add a unit test to document the inlining bug that was addressed in VMMaker-dtl.344
-----
VMMaker-dtl.344 (12 March 2014):
VMMaker 4.13.4

Fix slang inlining regression introduced in VMMaker-dtl.339 caused by TMethod>>tryToInlineMethodsIn: that excluded nodes with selector #cCode:inSmalltalk: which must remain inlineable to support various methods for 32/64 bit image format from common code base, as well as for low level MemoryAccess in slang that must be fully inlined for performance.

Change FloatArrayPlugin>>primitiveDivFloatArray and BitBltSimulation>>primitiveDisplayString to send intAtPointer and byteAtPointer to self rather than to interpreterProxy, because they are not defined in the interpreter proxy and cause compilation errors when slang inlining is turned off. These should be added to the interpreter proxy (or arguably to a hypothetical objects memory proxy) but send to self is a lesser evil for now. 

These changes restore a very small performance gain for the standard VM due to the inlining fix, and also restore inlining of low level MemoryAccess methods when added to the VM build. Inlined MemoryAccess methods are essentially equivalent to the C macros in sqMemoryAccess.h but can be run in simulation, and play nicely with C debuggers and profilers.
-----
VMMaker-dtl.343 (2 March 2014):
VMMaker 4.13.3
Fix an obscure bug in generating type declarations caused by unreferenced type declarations remaining after their associated variables have been inlined away. See TMethod>>removeUnreferencedDeclarations.

Document the bug in SlangTest>>testRemoveTypeDeclartionForRemovedIntermediate.

Fix SlangTest>>testSetInstanceVariableWithAnAccessorMethod which contained an error that was masked because the test is an expected failure.

Fix code generator initialization for MemoryAccess.

Note - there is no change to generated C code unless MemoryAccess methods are added to the code generator, therefore regeneration of sources for SVN is not required.
-----
VMMaker-dtl.342 (23 February 2014):
VMMaker 4.13.3

Make it possible to produce a working VM with inlining disabled.

To build a VM without inlining: A VMMaker instance has an #inline variable, set it false to disable inlining. During build, disable the gnufication step.

Changes are:

Fix BalloonEnginePlugin>>stepToNextBezierForward:at: by removing unneeded cCoerce (this was an earlier workaround for a slang generation bug, no longer relevant).

Rename accessors in ObjectMemory and Interpreter to prevent name clashes in generated code. For variable foo the accessors would be getFoo and setFoo. Accessors are required because the object memory and interpreter have been factored into separate hierarchies.

For variables that represent C arrays, provide accessors such as fooAt: and fooAt:put: for array access.
-----
VMMaker-dtl.341 (14 February 2014):
Use the equivalent #shallowCopy rather than #clone (Pharo compatibility)
-----
VMMaker-dtl.340 (11 February 2014):
VMMaker 4.13.2

For primitiveAllObjects, move the allObjects logic to ObjectMemory.

Incorporate various oscog code generation improvements, including code generation for sending #value: to a block, and elimination of unnecessary temp vars in inlining, for example, generate this:

	thisWord = long32At(sourceIndex);

instead of this:

	idx7 = sourceIndex;
	thisWord = long32At(idx7);
-----
VMMaker-dtl.339 (27 January 2014):
VMMaker 4.13.1

Add primitiveAllObjects, answering an array of all objects in the object memory at the time of calling the primitive, possibly excluding those that were garbage collected as a side effect of allocating the result array for the primitive.

Fix comment for ObjectMemory>>lengthOf:baseHeader:format: to indicate that length includes the fixed fields as well as indexable fields (the length of an OrderedCollection instance is 3, not 0).

Add shorten:toIndexableSize: with error checks and correct size logic for long arrays. Change the return value to be the number of bytes released to free memory, allowing sender to test for success. The implementation for ClassicObjectMemory is tested for both 32-bit and 64-bit object memories. The implementation for NewObjectMemory is based on this, but has not been tested.

Add primitiveTestShortenIndexableSize to allow shorten:toIndexableSize: to be exercised from the image. This primitive is for testing purposes only and will probably be removed in the future.

FT2Plugin to external plugins in VMMakerTool class>>defaultUnixSpec because some platforms (e.g. OS X) may not have the runtime library conveniently available.
-----
VMMaker-dtl.338 (20 January 2014):
VMMaker 4.12.14

C translation updates from oscog required for case statement code generation, e.g. shorten:toIndexableSize code generation.

Add shorten:toIndexableSize from oscog, presumed working for NewObjectMemory but not verified for ClassicObjectMemory
-----
VMMaker-dtl.337 (10 January 2014):
VMMaker 4.12.13
Name: SqueakSSL-Plugin-eem.4
Author: eem
Time: 9 January 2014, 2:24:57.418 pm

Pragmatize the plugin's primitives.
-----
VMMaker-dtl.336 (10 January 2014):
Add SqueakSSLPlugin to VMMaker.

SqueakSSLPlugin is a platform SSL interface for Squeak by Andreas Raab.

The original source repository is at http://www.squeaksource.com/SqueakSSL. This is the original source from SqueakSSL-Plugin-ar.3 with category changed to VMMaker-Plugins.

License: This project is covered by the MIT License:

Copyright (c) 2010 Andreas Raab and Contributors

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
-----
VMMaker-tpr.335 (4 January 2014):
fix typo bug in ScratchPlugin>primitiveWaterRipples1
-----
VMMaker-dtl.334 (4 January 2014):
VMMaker 4.12.12
Convert Scratch plugins to pragmas. Changes to generated code are cosmetic, e.g. variable names and ordering.

Conversion script:
  converter := Pragmatizer
      on: 'VMMaker'
      selectors: #(#export: #static: #inline: #returnTypeC: #var:declareC: #var:type: ).
  converter classes: { CameraPlugin . ScratchPlugin . WeDoPlugin . UnicodePlugin }.
  converter pragmatize.
-----
VMMaker-dtl.333 (30 December 2013):
VMMaker 4.12.11

Nicolas Cellier bitblt speedups
Reference Mantis issues 7802 and 7803

Mantis 7802: Fast-up BitBlt rgbAdd rule

Current implementation is naive:
- adds component by component after shifting and masking
- test each component for overflow
- recompose the result by shifting/bit-oring

It is possible to process the components all at once instead of looping and it is possible to avoid the test, making a branch free algorithm:

- in order to prevent overflowing over the next component, the highest bit of each component is cleared
- the last bit of each component is then obtained by overflow free operation (bitXor: instead of +)
- overflow condition is tested by some bitops, leaving a 1 on each highest which would overflow, 0 otherwise, which appropriately shifted and multiplied by component mask provide a mask to bitOr: for saturating without testing. 

Each component has nBits.
The componentMask is 1<<nBits-1.
The carryOverflowMask is a mask with high bit of each component set to 1.

For example with 4 components of 3 bits,
noting that 2r1001001001 * 2r111 -> 2r111111111111, we see that we can obtain such carryOverflowMask by a division 2r111111111111 / 2r111 -> 2r1001001001 and a shift << (nBits -1) -> 2r100100100100 

Mantis 7803: Fast-up BitBlt alpha blending rules

The alpha blending rules do apply on each ARGB component:
- shift and mask to isolate the component
- blend: ((1-alpha)*dst+(alpha*src))/255 (replace src by 16rFF for alpha channel)
- or (1-alpha)*dst>>8+src in case of pre-multiplied source
- saturate component at 16rFF in case of overflow for pre-multiplied source
  (this normally does not happen if source is correctly pre-multiplied)
- shift and bitOr: to recompose

Each component is on a byte.
Since multiplication spans over 2 bytes, it's possible to multiply 2 non adjacent components at once without overflowing on the other.
Thus, algorithm is applied on _R_B and A_G_>>8.

Division by 255 can be obtained by (x+1+(x>>8))>>8 for 0<=x<=16rFFFF.
This can easily be extended on two non adjacent bytes.

A reduction of about -25% of run time has been measured on an interpreter VM.

Note that very same kind of bit trick has been applied on accelerated ARM BitBlt.

See also VM-dev thread [Vm-dev] Little speed up of BitBlt alpha-blending
http://lists.squeakfoundation.org/pipermail/vm-dev/2013-December/014342.html
-----
VMMaker-dtl.332 (21 December 2013):
VMMaker 4.12.10
Check for valid bitmap in primitivePixelValueAt aka BitBltSimulation>>primitivePixelValueAtX:y:
Fix provided by Nicolas Cellier
Reference Mantis 7799
-----
VMMaker-dtl.331 (11 December 2013):
VMMaker 4.12.9
BitBltSimulation>>lockSurfaces fix from VMMaker.oscog-eem.553
Bug reported by David Binderman:
http://lists.squeakfoundation.org/pipermail/vm-dev/2013-December/014237.html
-----
VMMaker-dtl.330 (26 November 2013):
Fix loading of format 6505 (Cog) images in InterpreterSimulator in float word order fixup. An interpreter must send #lengthOf:baseHeader:format: to its object memory, not to self.

No change to generated code, so versionString is unchanged.
-----
VMMaker-dtl.329 (15 November 2013):
Merge MiscPrimitivePluginTest into IncludedMethodsTest, and remove MiscPrimitivePluginTest. Various classes in the image contain methods that are intended to be translated to C and executed as primitives. IncludedMethodsTest provides tests to validate these methods.
-----
VMMaker-dtl.328 (31 October 2013):
VMMaker 4.12.8
Mantis 7794: BitBltSimulation primitiveDisplayString fails to advance destX
Fix by Nicolas Cellier:

BitBlt>>primDisplayString:from:to:map:xTable:kern: regularly fails to increment destX instance variable.
The primitiveDisplayString changes destX global variable but then forgets to copy this global destX into BitBlt's inst var destX. As a consequence, BitBlt>>displayString:on:from:to:at:kern: regularly fall in fallback code.
-----
VMMaker-dtl.327 (19 October 2013):
VMMaker 4.12.7
Adopt primitiveQuit from oscog with exit status parameter
Reference http://bugs.squeak.org/view.php?id=7792
The 4.11.7 generated sources will include VMMaker-tpr.326 and VMMaker-tpr.325
-----
VMMaker-tpr.326 (7 October 2013):
Fix a single-bit constant error in BitBltSimulation>>copyBits:Fallback: - change 16r3FFF to 16r7FFF to correct tallyIntoMap behaviour for Scratch using BenBlt on the Pi.
-----
VMMaker-tpr.325 (17 September 2013):
(probable) fix for Mantis http://bugs.squeak.org/view.php?id=7247 BitBlt Bug in alphaSourceBlendBits8
-----
VMMaker-dtl.324 (29 August 2013):
VMMaker 4.12.6

RePlugin fixes from VMMaker-eem.323. Declare rePluginMalloc: and rePluginFree: as required method names otherwise they are excluded from code generation. Previously they were declared extern for this reason (oscog code generator does not have the update to trim unreferenced methods in plugins, so not an issue for Cog).
-----
VMMaker-eem.323 (28 August 2013):
Merge RePlugin with Cog VMMaker.oscog-eem.337.
.
Merge RePlugin fix for
http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=710375
http://bugs.squeak.org/view.php?id=7785
(pcre_info => pcre_fullinfo).

Fix prim arg count for primPCREExecfromto.

Merge Cog compilation warning fixes for rePluginFree: &
rePluginMalloc:.
-----
VMMaker-dtl.322 (22 June 2013):
VMMaker 4.12.5
Update version string for VMMaker-tpr.321
-----
VMMaker-tpr.321 (18 June 2013):
Add the VMMaker parts to support a new faster BitBLT plugin.
In copyBIts we can now branch off to a specialised function that will make use of more tightly code routines for many important BLT rules and cases. For ARM cpu platforms there are also very specialised assembler routines for some cases - but many are in C and suitable for any platform.
-----
VMMaker-dtl.320 (8 May 2013):
VMMaker 4.12.4

Move lengthOf: from interpreter to object memory, and update senders.
Move numObjects, allObjectsDo: and allObjectsSelect: to object memory.
Add InterpreterSimulator>>objectMemory to facilitate tracing.
Update InterpreterStackPages from oscog, changing BytesPerWord references to self bytesPerWord.
Update InterpreterPrimitives class comment from oscog.
Remove obsolete comments in InterpreterPrimitives>>failed and InterpreterPrimivies>>successful.
In primitiveUtcWithOffset, allow caller to provide a pre-allocated result array to eliminate possible GC in the time primitive.
-----
VMMaker-dtl.319 (13 April 2013):
VMMaker 4.12.3
Fix errors in VMMaker-dtl.317
Move NewObjectMemory>>addressCouldBeObj: to ObjectMemory
Use latest version of floatArg: with assertions removed.
-----
VMMaker-dtl.318 (13 April 2013):
VMMaker 4.12.2
SocketPlugin fixes from VMMaker.oscog-eem.284
-----
VMMaker-dtl.317 (13 April 2013):
VMMaker 4.12.1

Caution: FloatMathPluginTests now included in  VMMaker-Tests will crash the VM if compiled 64-bit (Mantis 7760)

Merge changes from oscog plugins.

Update to VM_PROXY_MINOR 11 (was 9). Requires some support code functions not present in SVN trunk, so temporary implementations are provided in InterpreterPrimitives method category "FIXME" for:
	add: ticker HighPriorityTickee: periodms
	add: ticker Synchronous: periodms Tickee: roundms
	amInVMThread
	ioUTCMicroseconds
These methods must be removed when platform sources are updated.

Not included in merge:
	FilePlugin>>primitiveDirectoryEntry requires support code
	SocketPlugin>>primitiveSocketCreateRaw:... requires support code.

Revert previous cosmetic changes (e.g.  space added to <returnTypeC:'void*'> declaration) in order to eliminate unnecessary differences versus oscog.

Add missing __buildInfo[] and comment generation for src/vm files.

Classes in oscog that require updates from VMM trunk:
	AsyncFilePlugin oscog requires update from trunk
	BitBltSimulation in oscog has the rgbMul:with: unicode comment bug, update it from trunk
	CameraPlugin missing from oscog
	ClipboardExtendedPlugin missing from oscog
	JPEGReaderPlugin update oscog from trunk to get missing fix from Mantis 7691 (VMMaker-dtl.192)
	LargeIntegersPlugin one unneeded method in oscog
	MIDIPlugin update oscog with fix from trunk
	MacMenubarPlugin restore oscog from trunk to fix author initials
	MiscPrimitivePlugin update class comment from trunk
	Mpeg3Plugin class>> requiredMethodNames missing in oscog.
	ScratchPlugin missing from oscog
	SerialPlugin update oscog from trunk. 
	UnicodePlugin missing from oscog.
	WeDoPlugin missing from oscog.
-----
VMMaker-dtl.316 (10 April 2013):
Change default directory structure for generated sources to use a common directory for all plugins.

Support for the old directory structure is still available. To generate plugins in the old directory structure, evaluate "VMMaker useSinglePluginsDirectory: false"
-----
VMMaker-dtl.315 (6 April 2013):
VMMaker 4.11.5

Remove PixelValuePeekPlugin from defaultUnixSpec.

New SlangTest tests for loop limit code generation.

>From VMMaker.oscog-eem.279 and VMMaker.oscog-eem.282:

Fix translation of to:by:do: loops so that the limit is not re-evaluated
on each iteration if it may have side-effects.
As part of this change make TMethod locals a Set, and sort only when
emitting locals.  Alas this causes a number of methods to change.

Fix SmartSyntaxPlugin support method affected by the fixes
for generating to:by:do: loops in VMMaker.oscog-eem.279.
-----
VMMaker-dtl.314 (25 March 2013):
VMMaker 4.11.4
Remove PixelValuePeekPlugin because primitivePixelValueAt is now in BitBltSimulation
-----
VMMaker-tpr.313 (25 March 2013):
Move BitBltSimulation (ie BitBltPlugin) to be a subclass of SmartSyntaxInterpreterPlugin and copy the PixelValuePeekPlugin primitivePixelValueAtX:y: code into it.

Also updated the class comment a little to include newly added combination rules. Well, new about ten years ago.

A resulting VM runs the tests in BitBltTests ok.
-----
VMMaker-dtl.312 (23 March 2013):
VMMaker 4.11.3

Merge from oscog: Identify generated sources using fileHeaderVersionStampForSourceClass: to specify the code generator, generated class, and Monticello source.

Merge VMMaker-tpr.302 (misnamed package due to MC glitch), original commit was:

Name: VMMaker-tpr.302
Author: tpr
Time: 7 March 2013, 2:40:39.704 pm
Ancestors: VMMaker-dtl.301

change HostWindowPlugin> primitiveShowHostWindow... to referto dispBits as ByteArray in order to have the C type be (char *) and not (unsigned *) as before.
This reduces the compile errors for ioShowDisplayOnWindow() which is declared as (sqInt, unsigned char *.....
-----
VMMaker-dtl.311 (22 March 2013):
Add Tim's PixelValuePeekPlugin to the defaultUnixSpec so it will be included in the test build on build.squeak.org.
-----
VMMaker-dtl.310 (22 March 2013):
VMMaker 4.11.2

Restore method with mangled comment (Unicode characters). This is an old problem that crept back in a recent update.

Includes Tim's PixelValuePeekPlugin.
-----
VMMaker-tpr.309 (21 March 2013):
Oh, hooray; is thing woring now? Can we finally save this damned tiny  change?It's only taken *all day*.
Try again; add a tiny plugin to make the surprisingly frequent Form>pixelValueAt: faster - ie don't do an entire bitblt for it.
This first version handles 1/2/4/8/16 & 32 bpp but not LSB bitmaps.
-----
VMMaker-dtl.308 (19 March 2013):
VMMaker 4.11.1

Comment out five unimplemented translation selectors in SmartSyntaxPluginCodeGenerator>>initializeCTranslationDictionary and fix the presumptive selectors for four of these. Leave as comments to reflect original author intent.

Remove redundant class SlangTestSupportSmartSyntaxInterpreterPlugin and move its test method #declareInt:wordPointer: to SlangTestSupportSSIP.

SlangTest should not depend on SlangBrowser package, so break the dependency. Create code generators in the support classes, caching to initialize once per test method, and add asCString instance methods to these classes distinct from class side methods used by SlangBrowser caching. Change all tests to use these code generators.

Ensure that SlangTestSupportPlugin and SlangTestSupportSSIP are not included in VMMaker code generation, as these are intended only as support classes for SlangTest and may contain methods that connot be compiled.
-----
VMMaker-eem.307 (19 March 2013):
Nuke unused InterpreterSimulationObject.
Move default implementations of declareCVarsIn: &
requiredMethodNames from Object to VMClass.
-----
VMMaker-eem.306 (14 March 2013):
Remove erroneous flushing of method class on changing an
object's class.  Make sure that the class mutation primitives
*do* flush the AtCache.
Changing the class of an object doesn't invalidate the
entries in the method lookup cache which are from
class x selector to method x primtive.
*do* flush the AtCache since changing an object's class
can change how it is accessed.
-----
VMMaker-eem.305 (14 March 2013):
Flush the AtCache if required in primitiveFlushCacheByMethod
and primitiveFlushCacheBySelector.  Rename
primitiveFlushCacheSelective to
primitiveFlushCacheBySelector for consistency.
-----
VMMaker-dtl.304 (11 March 2013):
VMMaker 4.10.14

Reference Mantis 0007751: Add SSL plugin
Add Andreas Raab's SqueakSSLPlugin to the update map for source.squeak.org/VMMaker.
Add SqueakSSLPlugin to the VMMakerTool defaultUnixSpec.

Follow up required: Add platform sources to SVN from Andreas' repository at http://code.google.com/p/squeakssl, or from the oscog branch.
-----
VMMaker-dtl.303 (11 March 2013):
Add SlangTest unit tests to document the slang C preprocessor directives.

Background:
Mantis 0005238: Integer bug on 64bit image/32bit VM
VMMaker-dtl.133: VMMaker 3.11.0 Add support for C preprocessor statements in Slang
-----
VMMaker-dtl.302 (9 March 2013):
VMMaker 4.10.13

A WordArray parameter in the parameter list of a primitive declaration should be declared as (unsigned *) not (usqInt *) in the generated C code. Fix WordArray class>>ccgDeclareCForVar: code generation and provide a unit test.

Also remove redundant type declaration in HostWindowPlugin>>primitiveShowHostWindow:bits:width:height:depth:left:right:top:bottom: which was an ineffective attempt to work around the code generation bug.
-----
VMMaker-dtl.301 (26 February 2013):
Add IncludedMethodsTest to VMMaker-Tests.

Various classes in the image contain methods that are intended to be translated to C and executed as primitives. IncludedMethodsTest provides tests to validate these methods.

Reference Mantis 7479: Plugins depending on Methods in the Image VMMaker is loaded into (http://bugs.squeak.org/view.php?id=7479)

Coverage for included methods is not complete, see todoForSoundGeneratorPlugin and todoForADPCMCodecPlugin for the list of tests not yet implemented.

Unit tests only, no change to VMMaker class>>versionString
-----
VMMaker-tpr.300 (15 February 2013):
Many small changes to correct C type clashes.
Primtives now declared as void foo() instead of sqInt foo().
PrimitiveTable corrected to suit and all prim calling & lookup matched.
isBytes() added to VMPluginCodeGenerator>emithCHeaderForPrimitivesOn: to support changed MiscPrimitivesPlugin
-----
VMMaker-dtl.298 (12 February 2013):
VMMaker 4.10.11

Enable large cursor support in the 64-bit image. Previous concern about bitmap conversion is apparently no longer relevant, as #primitiveBeCursor works properly on the 64-bit image (but tested only on little-endian).
-----
VMMaker-dtl.297 (9 January 2013):
Recategorize Object class>>declareCVarsIn: and Object class>>requiredMethodNames from package SlangBrowser to package VMMaker. VMMaker should have no dependencies on the slang browsing extensions, which are specific to Squeak and may not be appropriate for other images.
-----
VMMaker-dtl.296 (8 January 2013):
VMMaker 4.10.10

Fix copy and paste bug in primitiveRemLargeIntegers.
Reference http://code.google.com/p/cog/issues/detail?id=117
-----
VMMaker-dtl.295 (5 January 2013):
VMMaker 4.10.9

Install primitiveRemLargeIntegers as primitive number 20.
Reference http://lists.squeakfoundation.org/pipermail/vm-dev/2013-January/011704.html

Primitive 20 is in the range of large integer primitives, and has been unused since at least Squeak 3.6.

primitiveRemLargeIntegers should be a numbered primitive consistent with other large integer primitives, so install it as number 20.
-----
VMMaker-dtl.294 (3 January 2013):
VMMaker 4.10.8

Add missing comment generation for TStmtListNode. This provides additional embedded comments in generated C source.

Background:

A recent change to the compiler in Squeak trunk causes comments to be associated with statement lists rather than assignment nodes if the comment appears at the beginning of a block. This is a worthwhile change, but it exposes a bug in C code generation in which these comments are lost from from generated C code.

This update restores the expected generation of comments at the beginning of blocks when VMMaker is run in updated Squeak images. It also results in additional embedded comments in various places throughout the generated C sources.

There is no functional impact on generated code, and the bug is not present in the oscog branch of VMMaker.
-----
VMMaker-dtl.293 (29 December 2012):
VMMaker 4.10.7

Bitshift optimizations by Nicolas Cellier. Use #>> or #<< operator rather than #bitShift: in cases where shift direction is known in order to eliminate runtime check for shift direction.

Discussion thread: http://lists.squeakfoundation.org/pipermail/vm-dev/2012-December/011688.html

Change sets: http://code.google.com/p/cog/issues/detail?id=111

Follow up required: Nicolas' changes for the sound primitives should also be adopted. These are methods in package Sound that are translated from the image into primitives for ADPCMCodecPlugin. Add these to Squeak trunk after the next release (Squeak 4.4).
-----
VMMaker-dtl.292 (22 December 2012):
VMMaker 4.10.6

Fix divideByZero protection in JPEGReaderPlugin (by Nicolas Cellier)
http://lists.squeakfoundation.org/pipermail/vm-dev/2012-December/011671.html
-----
VMMaker-eem.291 (11 December 2012):
Fix receiver of a remapOop:in: send in LargeIntegersPlugin.
Replace _'s with :='s in the ImmX11Plugin (so it can load into
trunk without fooling with settings) and categorize.
-----
VMMaker-dtl.290 (25 September 2012):
VMMaker 4.10.5

Prepare to change directory structure for generated sources. Future default will place all plugins in a common directory rather than separate directories for internal and external plugins, consistent with CrossPlatformVMMaker convention.

Provide VMMaker class >> useSinglePluginsDirectory: to specify output directory structure. Currently this is set for old directory structure in VMMaker class>>initialize, to be changed soon in coordination with unix cmake build process.

Win32VMMaker, MacOSPowerPCOS9VMMaker, and RiscOSVMMaker retain existing behavior.
-----
VMMaker-dtl.289 (22 September 2012):
VMMaker 4.10.4

Update unit tests.

Add SlangTest>>testExportsForSqueak3D to ensure that the code generation bug fixed in 4.10.3 does not come back.

InterpreterPrimitivesTest>>testPrimitiveSubtractLargeIntegersParameterBounds is no longer listed as a expected failure. Update comment in testPrimitiveSubtractLargeIntegersParameterBounds to explain that the questionable expected failure is now a pass due to large integer fixes of Nicolas Cellier (VMM 4.10.1).

Update InterpreterPrimitivesTest>>testSigned64BitValueOfLargeNegativeInteger and InterpreterPrimitivesTest>>testSigned64BitValueOfLargePositiveInteger to reflect expanded range of large integer arithmetic in primitives due to large integer fixes of Nicolas Cellier (VMM 4.10.1).

Update VMConstantsTest>>testConstMinusOne to reflect various recent Interpreter/ObjectMemory refactorings.

All VMMaker-tests tests pass except SlangTest>>testIvarShouldNotBeRedeclaredAsLocal
-----
VMMaker-dtl.288 (22 September 2012):
VMMaker 4.10.3

Fix code generator initialization for B3DEnginePlugin (Squeak3D). Fixes a bug introduced in VMMaker-dtl.259 of 24 November 2011 and present in VMMaker versions 4.7.16 through 4.10.3 in which the exports table in the generated Squeak3D.c has nil module name.


More information about the Squeak-dev mailing list