[Vm-dev] Running Alien on Windows

Igor Stasenko siguctua at gmail.com
Tue May 4 01:45:37 UTC 2010


On 4 May 2010 03:46, David T. Lewis <lewis at mail.msen.com> wrote:
>
> On Mon, May 03, 2010 at 08:32:19PM +0200, Torsten Bergmann wrote:
>>
>> David wrote in [1]
>> >I added Alien functions to VMMaker on SqueakSource:
>>
>> Thanks for the integration. So what is the next logical step
>> to get Alien for Windows?
>> Does it just mean Andreas has to build a new VM version?
>
> I did not try building on Windows, but IIUC the answer is yes. If any
> intrepid VM builders with a Windows PC and a Pharo image can build the
> plugin and confirm that it works, that would be helpful :)
>
> I would note also that the plugin builds on Unix/Linux but it is not
> clear if the resulting plugin actually works correctly. Confirmation
> would be helpful (probably this needs a Pharo person to check).
>

Just tried to build it with VMMaker.dtl.170
with SVN revision 2205

gcc -o ../.././obj/IA32ABI/ia32abicc.o -g -mpentium -mwindows
-fomit-frame-pointer -funroll-loops -fschedule-insns2 -O2 -I.
-Ic:/dx7sdk/include -I../.././src/vm -I../../../platforms/Win32/vm
-I../../../platforms/Cross/vm -I../.././src/IA32ABI
-I../../../platforms/Win32/plugins/IA32ABI
-I../../../platforms/Cross/plugins/IA32ABI -DVM_VERSION=\""3.10.6
(release)"\" -DWIN32_FILE_SUPPORT -DNO_SERVICE -DNO_STD_FILE_SUPPORT
-DNDEBUG -DLSB_FIRST -DVM_NAME=\"\" -DX86  -c
../../../platforms/Cross/plugins/IA32ABI/ia32abicc.c
../../../platforms/Cross/plugins/IA32ABI/ia32abicc.c: In function
`allocateExecutablePage':
../../../platforms/Cross/plugins/IA32ABI/ia32abicc.c:293:
`MEM_TOP_DOWN' undeclared (first use in this function)
../../../platforms/Cross/plugins/IA32ABI/ia32abicc.c:293: (Each
undeclared identifier is reported only once
../../../platforms/Cross/plugins/IA32ABI/ia32abicc.c:293: for each
function it appears in.)
make[1]: *** [ia32abicc.o] Error 1


MEM_TOP_DOWN
0x100000 Allocates memory at the highest possible address.
Windows Me/98/95:   This flag is not supported.

i defined this flag (using #ifndef)
and got to the linking stage.
First, i had to remove
platforms/Cross/plugins/IA32ABI/sqVirtualMachince.c
platforms/Cross/plugins/IA32ABI/sqVirtualMachince.h

otherwise they interfere with ones, which lying in Cross/vm directory.

And so, there is only one undefined reference left:

//F/projects/squeak/!trunk/src/winbuild/obj/IA32ABI/../../../platforms/Cross/plugins/IA32ABI/ia32abicc.c:213:
undefined reference to `inIoProcessEvents'

Which seems like should be defined externally by win32 platform-specific files:

extern int inIoProcessEvents;
# define noteEnterCallback() (++inIoProcessEvents)
# define noteExitCallback()  do { if (inIoProcessEvents)
--inIoProcessEvents; } while (0)


This cames from newspeak sources:

/* - Vassili, May 2008:
 *
 * The following is significantly revised compared to the original
Squeak implementation.
 * The ioProcessEvent() function called from inside the interpreter
loop is now guarded
 * with a lock called inIoProcessEvents. When the lock is > 0 the
function is effectively
 * disabled. The lock is incremented on entering a callback and
decremented on returning
 * from a callback. The lock is also accessible at the image level,
and Smalltalk code
 * in the image can turn off this asynchronous event delivery. In that
case it should
 * make its own arrangements to pick up and deliver events. For that,
an unguarded version
 * of the same function is provided called primDrainEventQueue() which
is accessible
 * as a primitive from inside the image.
 */

/* This counter prevents reentering the ioProcessEvents message pump.  It is
 * also incremented in the callback machinery (in thunkEntry) since the image
 * may be running its own message pump for the native GUI.
 */
int inIoProcessEvents = 0;

int ioProcessEvents(void)
{
  int result;

  if (inIoProcessEvents)
    return 1;
  if (fRunService && !fWindows95)
    return 1;

  ++inIoProcessEvents;
  result = primDrainEventQueue();
  if (inIoProcessEvents > 0)
    --inIoProcessEvents;

  return result;
}
> Dave
>
>

So, since it may require more patching in order to support this flag, i just
 commented its use by alien plugin and finally were able to
successfully build it.

I am not sure if it in working state or not.
For those who wanna test it, you can get it here:
http://nativeboost.googlecode.com/files/IA32ABI.dll
(i placed it there temporarily, so please, pick it up  because i will
remove it in a few days)

-- 
Best regards,
Igor Stasenko AKA sig.


More information about the Vm-dev mailing list