> On 24 Oct 2014, at 10:48 , Hilaire <[email protected]> wrote:
>
> Le 24/10/2014 10:35, Sven Van Caekenberghe a écrit :
>> I have to add that NativeBoost based code (like accessing environment
>> variables for certain FileLocator places) breaks down when you have no
>> sources ...
>
> Even with a fake .sources file?
>
> --
> Dr. Geo - http://drgeo.eu
> iStoa - http://istoa.drgeo.eu <http://istoa.drgeo.eu/>
Few NB-FFI methods will work without sources, as many rely on the automatic
argument name -> signature mapping.
This happens the first time a method is called after startup, and
platform-specific recompilation occurs. When the argument names are decompiled
as arg1, arg2, the mapping will fail.
(Other NB methods that generate machine code without using NB-FFI, will still
work though)
Theoretically, one could solve this by internalizing the source of all NB-FFI
calling method in the method trailer* at the end of deployment preparation
process. (so no NB methods have a chance to trigger before image save)
NB puts native code into the same trailer space, and combing different method
trailer types is currently unsupported (AFAIK), but the transition
TrailerWithEmbeddedSource** -> TrailerWithNBCode should happen only once.
Cheers,
Henry
* something along the lines of:
| nativeMethods |
nativeMethods := (Pragma allInstances select: [ :each | each arguments =
#(#primitiveNativeCall #NativeBoostPlugin) ]) collect: #method.
nativeMethods do: [ :nativeMethod |
nativeMethod methodClass methodDict at: nativeMethod selector put:
(nativeMethod copyWithTrailerBytes:
(CompiledMethodTrailer new sourceCode: nativeMethod
sourceCode))]
** TrailerWithEmbeddedTemps would probably be sufficient, but other than a
reserved type, I can't see there's working code for it