On Wed, Jan 27, 2010 at 7:26 AM, Bert Freudenberg <bert@freudenbergs.de> wrote:

On 27.01.2010, at 05:37, K. K. Subramaniam wrote:
> On Tuesday 26 January 2010 11:09:26 pm Bert Freudenberg wrote:
>> Well, there is a source for this of course (in the VMMaker Squeak package).
>> Generating the C code is a manual, interactive process and requires a
>> running Squeak installation. Making that scriptable is possible, but so
>> far nobody has done it AFAIK
> That is because most of the builds so far have been one target (which is also
> the host). Batch builds are needed for multiple variants (e.g debug/release)
> or when cross-compiling (say to ARM targets).

Ian does batched cross-builds. But the source is still only generated once. All targets use the same generated sources.

Ditto.  We changed to a single src tree for Mac OS, win32 & linux very recently.  The VMMaker per platform strikes me as absurd.  All Microsoft and Mac compilers I've ever used are happy with LF line endings.  The only significant difference between the platforms is whether to use the struct for interpreter variables and with a little macrology the choice can be left up to the platform's makefiles. In the Teleplace VMs the structure declaration looks like:

/*** Variables ***/
# define _iss /* define in-struct static as void */
struct foo {
# define _iss static
_iss char * stackPointer;
_iss sqInt primFailCode;
_iss sqInt specialObjectsOop;
_iss char * framePointer;
_iss StackPage * stackPage;
_iss sqInt nilObj;


_iss char * stackMemory;
_iss sqInt theUnknownShort;
#undef _iss
 } fum;
# define DECL_MAYBE_SQ_GLOBAL_STRUCT register struct foo * foo = &fum;
# define DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT volatile register struct foo * foo = &fum;
# define GIV(interpreterInstVar) (foo->interpreterInstVar)
# define DECL_MAYBE_SQ_GLOBAL_STRUCT /* oh, no mr bill! */
# define DECL_MAYBE_VOLATILE_SQ_GLOBAL_STRUCT /* oh no, mr bill! */
# define GIV(interpreterInstVar) interpreterInstVar
static struct foo * foo = &fum;

and then a function that uses global variables looks like

addGCRoot(sqInt *varLoc) {
    if (GIV(extraRootCount) >= ExtraRootSize) {
        return 0;
    GIV(extraRoots)[GIV(extraRootCount) += 1] = varLoc;
    return 1;

And for us whether to use the global struct or not on Mac OS depends on whether we're using the Intel compiler or gcc.  The Intel compiler produces an interpreter (not a JIT) that is 10% faster if it uses the global struct, whereas gcc produces one that is slightly slower.  So making the choice depend on platform is a mistake anyway.  It depends on platform and compiler.

- Bert -