#128 Fan launcher

brian Thu 28 Dec 2006

I've checked in the first pass of the Fan launcher exectuables - right now they just support Windows and the JVM. The launcher is written in C++ and compiled into fan.exe, fant.exe, fanp.exe, etc.

The basic design for the launcher includes these concepts:

  • Use executable location to auto-magically figure out fan.home
  • Use sys.props to control whether we launch Java, CLR, Mono, whatever the future might hold
  • Dynamically load and use VM libraries based on environment's configuration
  • One Fan image supports binaries for Windows, Mac OS X, Linux (all x86)

The Fan runtime directory structure:

{fanHome}/
   bin/
     win/
        fan.exe
        fant.exe
      mac/
      linux/
   lib/
     sys.props
     java/
       sys.jar       
     fan/
     net/

So the launcher knows that fan home is basically two directories up from where the executable lives. From there the launcher can figure out where sys.props lives. The runtime to use is selected by sys.props "fan.runtime", or if not specified we default to Java.

The Java runtime is booted as follows:

  • If "fan.java.jvm" is specified in sys.props we use that jvm.dll to boot
  • Otherwise we query the registry: \HEKY_LOCAL_MACHINE\Software\JavaSoft\JavaRuntimeEnvironment.CurrentVersion
  • Users can define options to pass to the JVM in sys.props using "fan.java.options"
  • We check that the JVM is 1.5 or greater

You can turn on launcher tracing by setting the environment variable "fan_launcher_debug" to non-null.

brian Thu 4 Jan 2007

I added support to the launcher to override sys.props via the command line:

  • --v launcher debug (alternate to setting fan_debug_launcher)
  • --Dname=val override sys.prop

So for example launch a Fan program and force it to use Java:

fan --Dfan.runtime=java foo::Bar.main

katox Thu 4 Mar 2010

I've been reading about mono vs. hotspot performance in Android context lately. Mono (judging from website only) looks complete enough to be able to run Fantom. Did someone try to actually run it?

I've been looking into launcher C code but having no experience with .NET I don'ลง really know what to change there for mono. It might be useful as mono seems to run some ARM devices where java exists only under commercial lincence. And maybe in linux environment too - mono seems to start much quicker than hotspot.

brian Thu 4 Mar 2010

I don't think you would need any of that C code to test on Mono - that code just does Window's specific stuff liking checking the registry for your JVM installation.

Probably the first step would be to recompile the sys\dotnet code using Mono's C# compiler and then trying to run Fanx.Tools.Fan.

casperbang Thu 4 Mar 2010

Unofficial confirmations from Miguel seems to suggest they will be turning towards Android, given their success of MonoTouch for the iPhoney stuff. Unlike on the iPhone/iTouch, a full JIT'er is allowed on Android and that obviously makes Mono even more interesting. Android + Mono + Fan would be quite a sweet stack.

Login or Signup to reply.