discuss-gnustep
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Additional languages in GNUstep Make


From: David Chisnall
Subject: Re: Additional languages in GNUstep Make
Date: Mon, 10 Nov 2008 14:01:33 +0000

On 10 Nov 2008, at 13:54, Nicola Pero wrote:


On 10 Nov 2008, at 13:18, David Chisnall wrote:

Hi,

I'm just about to commit static compilation support to LanguageKit and edlc, and I'd like to be able to support this cleanly from GNUstep Make.

To compile a Smalltalk file to LLVM bitcode, you need to run:

edlc -c -f {smalltalk file name}

This will give you a .bc file. All of these should then be linked together, along with the MsgSendSmallInt.bc file, with llvm-ld, which will run link-time optimisations and then emit object code, which should be linked with the program. Optionally, llvm-ld should be used twice, once to combine all of the bitcode files, then opt should run some additional optimisations, and then llvm-ld should be run again. I will play a bit with the optimiser and see if I can find a sensible set of optimisations to run each time.

My question is, what is the best way of adding support for this to GNUstep Make?

If you send me an example compilation with a couple of files (ie, the whole list of commands you'd execute, and the files that get generated at each step) I can easily write the rules for gnustep-make to compile/link your xxx_SMALLTALK_FILES into the executable. I can then send them to you and you experiment with them until you're happy, or we just add them to gnustep-make straight away but tell everyone they're experimental in case we later
want to change them a bit (which usually naturally happens). ;-)

Excellent!  I'll try to send you some later today.

I would like to be able to have a line in my GNUmakefiles like:

PROJECT_SMALLTALK_FILES = foo.st bar.st

Since there are some situations where JIT compilation is preferable, it would also be nice if this could either copy the files to the resources folder in the bundle, or statically compile and link them, depending on the value of some other macro, although that's not essential.

Interesting :-)

How would they files be loaded when JIT is used ?

The LKCompiler class has methods for loading individual scripts or all of them from the application bundle. Typically you'd just do:

[LKCompiler loadAllScriptsForApplication];

If you did instead:

[NSClassFromString(@"LKCompiler") loadAllScriptsForApplication];

Then this would be a message sent to the Nil object when LanguageKit was not linked to the application, so for static compilation you would just not link to LanguageKit and the JIT would not run.


What if the executable does not have an associated bundle (eg, a tool with no associated bundle) ? Anyway, we can certainly work something out, but simpler is better. ;-)

For a tool, you can put edlc on the #! line. It has command-line options for loading frameworks at run time and will JIT all of the source in the file then call [[[SmalltalkTool alloc] init] run] (or a different class if the -C option is provided).

Thanks





reply via email to

[Prev in Thread] Current Thread [Next in Thread]