Re: Porting to Darwin

talksmall <[email protected]> Tue, 17 Jun 2008 12:30:47 -0700 (PDT)
Newsgroups gmane.comp.lang.smalltalk.strongtalk
Message-ID <343e5dd8-7942-489d-8dcb-c9fbeb4a4be1@z72g2000hsb.googlegroups.com>
Brian,
Excellent. Good find. It looks like you are actually executing
Smalltalk code!

The particular error you are seeing is due to a DLL lookup failure
which is called from the DLL lookup primitives from Smalltalk.

Which image are you using? If it is just the image checked out of SVN,
that would explain why you are trying to load "KERNEL32.DLL" which is
a Windows DLL that is, unsurprisingly, not on your system. You should
download the image and sources zip file from the downloads page on the
WIKI and unzip them into your strongtalk installation directory.

You should also make sure that os::platform_class_name() looks like
the following in your os_darwin.cpp.

char* os::platform_class_name() { return "UnixPlatform"; }

This class is looked up in Smalltalk system dictionary on start-up and
installed as the alias Platform, allowing the same image file to be
shared across different OSes, which is a real boon when editing
Smalltalk code for the image, as you can edit it on Windows where
there is a UI, until we port the UI code for other OSes.

Another thing to look out for is the fact that the UnixPlatform code
assumes that if you are looking for libc, then the file name should be
libc.so.6. This is to work around a problem with Linux linker scripts.
Unfortunately dlopen does not process these, it only deals with proper
shared object files. If you have a different version of libc, you may
need to create a link named libc.so.6 somewhere in your
LD_LIBRARY_PATH in order for dlopen to find the libc shared object
file.

At the moment, about all you can do on non-Windows platforms is to run
a script to execute Smalltalk code from the command line. That said,
that is quite a lot and you should still be able to use most non-UI
functionality. As an exercise in masochism I developed most of the
ANSI exception handling code on Linux just using a text editor and
then filing in from the command line. So you can do useful stuff even
without the UI, though of course a UI will make things much more
productive.

To use the command line script you pass an argument like "-script
tools/test.dlt" at the end of the command that you use to start
Strongtalk. This tells the image to load and run a script file named
test.dlt in directory tools and exit when complete. If an error occurs
during execution then the command line evaluator should kick in and
display a trace of the top 20 frames from the process that was
executing at the time.

I'll be interested to see how you get on. At some stage we will want
to do something about 16-byte alignment, since from the looks of it
you may see a significant hit on performance with the extended
prologue and epilogue which rather defeats the purpose of a high
performance VM, but we've got to start somewhere and this seems like a
big step forward.

Regards, Steve

On Jun 17, 6:46 pm, Brian de Alwis <[email protected]> wrote:
> On Jun 17, 3:41 am, Hyungjip Kim <[email protected]> wrote:
>
> > The whole problem is that strongtalk implementation has too many
> > clever tricks, and the assembly code and C++ functions are really
> > interleaved. I tried to make a simple stub that align stack. But there
> > are too much code (assembly) that simply jump to C/C++ function
> > address, often indirectly.
>
> > Another problem is that the VM use system stack pointer (ESP) for VM
> > operand stack and even put bytecodes to system stack, making the
> > alignment hard to keep.
>
> I just discovered gcc's -mstackalign option.  Compiling strongtalk
> with that flag certainly lets it get further:
>
> ===========================
> - VM is in debug mode
> [Reading in ../strongtalk.bst, n, 0.389 secs]
>
> [A Runtime Error Occurred]
> assert(handle != __null, "could not find library: dlopen(KERNEL32.DLL,
> 1): image not found")
> os_darwin.cpp, 301
> Last 10 internal VM events:
> - creating process 0x500870
> - creating process 0x500980
> DLL lookup GetCommandLineA in kernel failed.
>
> [A Runtime Error Occurred]
> assert(!is_scheduler(), "active must be other than scheduler")
> process.cpp, 289
> Last 10 internal VM events:
> - creating process 0x500870
> - creating process 0x500980
> Bus Error
> ===========================
>
> Credit to: <http://0xced.blogspot.com/2006/06/using-gnu-lightning-on-
> intel-mac.html>.  I came across that blog while looking at using a
> different machine language backend like GNU Lightning or even building
> on the LLVM JIT framework.
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Strongtalk-general" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [email protected]
For more options, visit this group at http://groups.google.com/group/strongtalk-general?hl=en
-~----------~----~----~----~------~----~------~--~---