[Vm-dev] Re: Uploaded squeak-vm 3.11.3

Eliot Miranda eliot.miranda at gmail.com
Wed Jan 27 17:28:42 UTC 2010


On Wed, Jan 27, 2010 at 7:26 AM, Bert Freudenberg <bert at 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 ***/
#if SQ_USE_GLOBAL_STRUCT
# define _iss /* define in-struct static as void */
struct foo {
#else
# define _iss static
#endif
_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
#if SQ_USE_GLOBAL_STRUCT
 } 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)
#else
# 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
#endif
#if SQ_USE_GLOBAL_STRUCT
static struct foo * foo = &fum;
#endif

and then a function that uses global variables looks like

EXPORT(sqInt)
addGCRoot(sqInt *varLoc) {
DECL_MAYBE_SQ_GLOBAL_STRUCT
    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 -
>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20100127/a2510099/attachment-0001.htm


More information about the Vm-dev mailing list