Hello, I am working on removing most of windowing code from the VM, and in trying to unify the platform specific code of the VM. In the MinimalistHeadless branch of https://github.com/ronsaldo/opensmalltalk-vm I made the following changes:I am also planning on making a standard interface for embedding the VM in an application, at least as a static library. With this new building system, this seems to be easy to do. BTW. When I tried the minimalistic Pharo image, in a completely headless VM, I got the following error: [ "Ugh .... now this is a biggie - a system that does not support any of the display depths at all." Smalltalk logError: 'Fatal error: This system has no support for any display depth at all.' inContext: thisContext. Smalltalk quitPrimitive "There is no way to continue from here" ] in DisplayScreen>>findAnyDisplayDepth DisplayScreen>>findAnyDisplayDepthIfNone: DisplayScreen>>findAnyDisplayDepth DisplayScreen>>setExtent:depth: DisplayScreen class>>startUp As a workaround, I am doing the following for ioHasDisplayDepth with the null driver: sqInt ioHasDisplayDepth(sqInt depth) { return true; } In DisplayScreen class >> startUp we have the following: startUp "DisplayScreen startUp" Display setExtent: self actualScreenSize depth: Display nativeDepth. Display beDisplay Does it make sense, to always trying to create a display in startup time? Best regards, Ronie |
Hi Ronie, First, this is super cool! I want this to happen since a lot of time :) Second, observation below
you cannot unilaterally do this. I hate autoconf too, but in VM list we have a general agreement on how to manage the VM build process, and unless you manage to convince the rest of people working there (and specially Eliot, who works there more than the rest), you have literally zero chance this will be adopted (and then, your work will be a general lose of time…). In any case, you have my vote :)
this is sooo super :)
even more super :) where can I see the code? Esteban
|
forget it, I was so overblown with your ANN that I just skip the link to your branch :P Esteban
|
In reply to this post by Ronie Salgado
Hi 2016-11-24 8:12 GMT+01:00 Ronie Salgado <[hidden email]>:
This is super cool. With Pavel we just tried open oswindow based world from headless image and it work almost perfect. No problems with keyboard and scrolling anymore. And it already provides very good approach for deploying desktop app.
Could you explain more what traditional display backend means? Because I am probably out of domain but want to know more.
I guess it is temp solution? Because no DisplayScreen should exist in headless mode. |
In reply to this post by Ronie Salgado
2016-11-24 8:12 GMT+01:00 Ronie Salgado <[hidden email]>: So far I managed to run a standard Pharo 6 image using this custom VM in Linux. How much VM size it reduced? |
In reply to this post by Ronie Salgado
On Thu, Nov 24, 2016 at 9:12 AM Ronie Salgado <[hidden email]> wrote: . This negative energy surrounding you right now is me hating you Sith Lord style. How dare you ? Yesterday 03:00 am I finally managed to make my shared memory bridge between Pharo and C++ to work also on Windows after a ton of debugging and here comes you telling me that all my effort was for nothing. It now works and is tested on MacOS 10.12 , Ubuntu 15.04 and Windows 10 (all of them 64 bit). Have you got no mercy ? Suffice to say I am super interested in both Non GUI Pharo because I use Unreal Game Engine and embedding Pharo because I use Unreal Game Engine. Embedding Pharo is a must have for me because my shared memory solution would not be acceptable by Apple on iOS since it forbids an app from running two executable at the same time which is basic requirement for shared memory. Stupid Apple :/ . Android seems to be fine with this. For now my game will target only PC where my shared memory solution works fine but sooner or later I will have to port to iOS and Android. If there is anything I can do to help you out, dont hesitate to ask. I am going to give your build a try now :) |
In reply to this post by Ronie Salgado
2016-11-24 8:12 GMT+01:00 Ronie Salgado <[hidden email]>:
Ronie, do you already have code to restore windows after image save? Any issue opened? |
In reply to this post by Denis Kudriashov
This was something that I did for quickly testing and trying to remove the windowing code. I also did this, because the building system is not working all of the time in my linux machine. The scripts for loading the VMMaker image are most of the time not working at all in Linux. I got frustrated by not being able on keep working on Lowcode for supporting the 64 bits version, because of these problems. Anyway, I do not care if this part gets integrated or not, as long as I can keep working on my stuff, and I don't have a bunch of manully written scripts in build.*/* . As long as there is a single script that can be configured for each target or flavour of the VM I am okay with it. Now I will document these scripts: For setting the flavour of the VM, there are the following options - SPUR_OBJECT_MODEL (On by default) - SISTA_OPTIMIZER (Off by default) - PHARO_BRANDING (On by default) - COG_JIT(On by default. If off, it will build a stack interpreter only VM) There are platform specific check for choosing whether to build a 64 bits VM or not. When building in a x86_64 systems, there is the BUILD_I386_VERSION option (Off by default) which will set the appropiate flags for building a 32 bits VM in a 64 bits system (-m32) These options are used for making a string with the vm sources direction(src ,stacksrc, spursrc, etc) and for selecting the sources of the vm. In this experimental branch I am moving some of the sources at platform/<platform_name/vm into the minheadless/source, for including the barest minimum code for compiling the VM. By the end of this, I should probably move back the platform specific sources into their original locations. The plugins to build with the VM are defined in Plugins.cmake (https://github.com/ronsaldo/opensmalltalk-vm/blob/MinimalisticHeadless/Plugins.cmake) Most of the time, adding a plugin is just a matter calling a macro: # Basic internal plugins add_vm_plugin_sources(SqueakFFIPrims EXTERNAL ${SqueakFFIPrims_Sources}) Later I will add another macro for linking a library with a plugin, which will perform the correct action depending whether the Plugin is internal or external. The macros for building a plugin add an option for specifying whether to build or not a plugin (e.g: BUILD_PLUGIN_FilePlugin, BUILD_PLUGIN_FT2Plugin). For building the a default VM using cmake, the only commands are required in the top level source directory:
For choosing interactively which options to enable or not, it is possible to use cmake-gui instead of cmake in the above sequence of commands. The built VM will be placed at build_dir/dist Currently, I am not using the cmake configure capabilties for generating config.h and generating the HAVE_*_H defines. Later I will implement this, but taking special care in supporting the cross compilation scenario, where it is not possible to execute compiled program for probing the system for things such as sizeof(void*).
If the SUPPORT_TRADITIONAL_DISPLAY cmake option is enabled, and cmake finds SDL2 (it will look for the SDL2 libraries using the names SDL2-2.0 SDL2), then a non-headless VM will be built using sqPlatformSpecific-SDL2Window.c ( https://github.com/ronsaldo/opensmalltalk-vm/blob/MinimalisticHeadless/minheadless/source/sqPlatformSpecific-SDL2Window.c ) instead of sqPlatformSpecific-NullWindow.c ( https://github.com/ronsaldo/opensmalltalk-vm/blob/MinimalisticHeadless/minheadless/source/sqPlatformSpecific-NullWindow.c ). This non-headless VM using SDL2 instead of the platform specific API, which should help in avoiding conflicts between the OSWindow event loop and the VM event loop. This works with a normal Pharo 6 image. This SDL2 based backend creates a window for the VM, only when asked by the image and process events sent to the VM window in the traditional way of translating the events into squeak events; placing the translated event in a queue, and then signaling a semaphore. SDL2 events that are not related to the VM window are placed untranslated in a separate queue, and there are used signal a separate semaphore for allowing OSWindow to process the event. I have already implemented the required primitives and updated OSWindow for using them, when they exist. I still have to update the OSWindow configuration. This approach allows preventing conflicts between the events for the VM window and OSWindow. Ronie, do you already have code to restore windows after image save? Any issue opened? Not yet for the extra morphic Worlds. How much VM size it reduced? I have not checked yet, but this is about reducing some complexity.
That is not worthless at all. That is still an excellent mechanism for fast IPC. Have you got no mercy ? No :) . Ask Thibault about the OpenGL bindings for the UFFI. That time I was cleaning OSWindow dependencies.
It is still needed to define a proper interface for embedding the VM. This interface should be a single .h file, with the highest level of abstraction possible. There are some other issues such as potential name clashes, and the fact that the VM symbols are public by default. At the bare minimum, it has to provide functions for initializing the VM, passing command line arguments, loading an image, running the image, and shutting down. So far I managed to reduce main source code a lot in sqMain.c (https://github.com/ronsaldo/opensmalltalk-vm/blob/MinimalisticHeadless/minheadless/source/sqMain.c ) . I am probably moving most of that into a separate source code file that will be always linked with VM core library, and keeping the source file with main function only couple of lines long (Init vm, load image, interpret and shutdown ) BTW, now I am working for a chilean video game company using Unreal. I do not like Unreal because it takes a very long time to compile, even with a 44 cores machine (88 threads) that we have in the company for rendering and compiling. I am wondering how that integration is going to end. The embedding interface is not in my priority list. My priority is getting OSWindow working well in Windows (required by the Bloc and Roassal people). My second priority is getting Lowcode working on Linux, Mac and Windows in both, 32-bits and 64 bits mode. Best regards, Ronie 2016-11-24 5:59 GMT-03:00 Denis Kudriashov <[hidden email]>:
|
Indeed it is, and it works now, so no complains, plus I learned a ton in the process about UFFI, C++, Pharo and much more.
Will give it a look and send you pull requests
Yeah why people do that ? It took me a day to find a way to reduce compile times down to zero seconds and basically turn C++ to a live coding language following the advice of this brilliant C coder here https://www.youtube.com/watch?v=WMSBRk5WG58 The idea is simple , generate an executable with a basic loop that the only things it does is just gives access to its memory via pointers, detects changes in code and auto compiles it to dynamically linked libraries that loads of course dynamically. Because it compiles only the dynamic library , compile times are close to zero seconds and also compiles happen in the background so you dont have to even wait for the compile to finish if a couple seconds compile times is too much. The executable never stops executing , its just the dynamic libraries that modify and recompile. This is very similar to what Unreal editor uses for hot reloading. So its pretty easy to do this with your own unreal projects and eliminate the need for dealing with compile time and even avoid using a scripting language like pharo altogether if you prefer working only on C++. I am going to use this technique because live coding in pharo for unreal wont be enough I will need to live code also in C++ because some of the code will have to be written on C++ for performance reason and compile times for than 2-3 seconds are unacceptable for my standards. Worked like a charm. But have not tested with Unreal yet because I was focused on my shared memory bridge. However I see no reason why this would not work well. It should work even for static compiles because you can static compile dynamic libraries. which takes live coding C++ to a whole new level that I may integrate or at least use as inspiration. I am not giving up on live coding any time soon this millennium :D. |
In reply to this post by EstebanLM
+10000000000000000000000000000000 amen to that. especially this: >I am also planning on making a standard interface for embedding the VM in an application, at least as a static library. With this new building system, this seems to be easy to do. This is a holy grail!!! Go, Ronie, Go!!! On 24 November 2016 at 09:24, Esteban Lorenzano <[hidden email]> wrote:
Best regards,
Igor Stasenko. |
In reply to this post by Ronie Salgado
> On 23-11-2016, at 11:12 PM, Ronie Salgado <[hidden email]> wrote: > > In DisplayScreen class >> startUp we have the following: > startUp "DisplayScreen startUp" > Display setExtent: self actualScreenSize depth: Display nativeDepth. > Display beDisplay > > Does it make sense, to always trying to create a display in startup time? No, it doesn’t. Ideally no resource should be started up/connected/created/tweaked until and unless it is actually needed by the running system. Obviously, the default setup for a Smalltalk tends to be the GUI IDE and it’s so very easy to slide into the assumption that graphics and sounds and windows must be started up no matter what. We all do that kind of thing, even when we know we shouldn’t. You can make some reasonable arguments that an image configured to be an IDE ought to open a window or two during start up since that is kind of its raison d’etre. My small protest against this is/was the RISC OS VM not creating a UI window until the first display update was made. At least that meant that an image with no need of a graphical UI never needed to do anything other than not display anything on the Display. I’d say that all the host window IO related stuff ought to go into an extend HostWindowPlugin and be removed from the core. I’d also prefer all the plugins to be external, even though I know there can be a tiny performance hit, depending upon the details of how the OS does late binding. The unix VM kinda-sorta does some of this with the C++ usage and vm-display-xxxxx modules etc, but I think a lot more needs doing. And of course, the image needs lots of work to make good use of it. Until you have images that don’t need display/sound/sockets/whatever, there isn’t a lot of point worrying about the vm side. tim -- tim Rowledge; [hidden email]; http://www.rowledge.org/tim Strange OpCodes: LA: Lockout Access |
In reply to this post by Ronie Salgado
This is super coooooool Embedding the Vm as a static lib is a kind of dream becoming true. Stef
-- Using Opera's mail client: http://www.opera.com/mail/ |
+100. Great job! Doru > On Nov 26, 2016, at 9:44 AM, stepharo <[hidden email]> wrote: > > This is super coooooool > Embedding the Vm as a static lib is a kind of dream becoming true. > > Stef > > > Hello, > > I am working on removing most of windowing code from the VM, and in trying to unify the platform specific code of the VM. In the MinimalistHeadless branch of https://github.com/ronsaldo/opensmalltalk-vm I made the following changes: > > - Unified standard CMake building scripts for Unixes. I hate autoconf. I want to use them in Windows too. > - Refactoring the Unix entry points. I am trying to remove a lot of code for simplfying stuff. > - Null window driver for true headless. > - Optional SDL2 based traditional display backend for compatibility reasons, and because the extra Morphic worlds using OSWindow are a bit unstable. > > So far I managed to run a standard Pharo 6 image using this custom VM in Linux. Windows and Mac are coming next. Hopefully this is going to fix the problems with duplicated events when using OSWindow in Windows. > > I am also planning on making a standard interface for embedding the VM in an application, at least as a static library. With this new building system, this seems to be easy to do. > > BTW. When I tried the minimalistic Pharo image, in a completely headless VM, I got the following error: > > [ "Ugh .... now this is a biggie - a system that does not support > any of the display depths at all." > Smalltalk > logError: > 'Fatal error: This system has no support for any display depth at all.' > inContext: thisContext. > Smalltalk quitPrimitive "There is no way to continue from here" ] in DisplayScreen>>findAnyDisplayDepth > DisplayScreen>>findAnyDisplayDepthIfNone: > DisplayScreen>>findAnyDisplayDepth > DisplayScreen>>setExtent:depth: > DisplayScreen class>>startUp > > As a workaround, I am doing the following for ioHasDisplayDepth with the null driver: > > sqInt ioHasDisplayDepth(sqInt depth) > { > return true; > } > > In DisplayScreen class >> startUp we have the following: > startUp "DisplayScreen startUp" > Display setExtent: self actualScreenSize depth: Display nativeDepth. > Display beDisplay > > Does it make sense, to always trying to create a display in startup time? > > Best regards, > Ronie > > > > -- > Using Opera's mail client: http://www.opera.com/mail/ -- www.tudorgirba.com www.feenk.com "Be rather willing to give than demanding to get." |
In reply to this post by Ronie Salgado
Hi Roni,
... [goodness deleted]
|
Hi, I am fighting Window VM compilation issues (e.g. Cairo with GCC5.x under Mingw). Now I am building in Windows using both, MinGW version 4.9.3, and Visual Studio 2015 Community Edition. I got working pharo,exe -headless Pharo-minimal.image eval "1+1" (the -headless parameter is for the image to quit after finishing). When running a normal Pharo.image, I am getting a FFI related crash (with Visual Studio and MinGW), when the image tries to read the APPDATA environment variable. Right now I am using the same main function for both, the Unix and Win32 VM. This means, that we are close of having the embedded version. In windows I am build two variants of the VM, pharo.exe (or squeak.exe) and pharow.exe (or squeakw.exe). The executable without the w is a console program, so it can use stdin, stdout and stderr. The executable with the w is a windows program that does not create a console window on startup, but it cannot use stdout, stderr, or stdin. This is the standard workaround for an annoying limitation of Windows itself (Python does the same in windows, with the same nomenclature). Visual Studio is unstable than MinGW, but it has an excellent debugger. With Visual Studio, I am getting some false positives for an assertion because they get miscompiled. For some reason, the assert(GIV(remapBufferCount) == 0) gets compiled into the same as assert(GIV(remapBufferCount)). Apart from this assertion, these two versions of the VM are crashing in the same place.
I cannot just use makefile, because I am also compiling in Windows using Visual Studio 2015 Community Edition, by generating the visual studio projects with CMake. I looked for the older discussions on the mailing lists, I could not find, a long discussion on the mailing list, except for several short ones. I have also seen some projects(LLVM, Boost) that have more than one build system, an official based on autoconf(or something else), and an alternative based on CMake. As for the config.h, I can also generate it using CMake, and I will start doing it now because I think that it is related to the FFI crashing issues that I am experimenting on Windows. Currently I am already using CMake for generating the git version string. As long as git is in the path and cmake founds it, the header with the version string is generated correctly, even when using the Visual Studio projects. Anyway, I am not using the old CMakeVMMaker that Igor did(and I just learned about Ian CMake work by finding in the mailing list). I just adapted the plain CMake scripts that I normally use for building my own projects to build the VM. Are you on board? Would you like to discuss this on skype or somewhere? Sure we can discuss it, I am on chile so we are not far apart in time zones. As long as building the VM can be done automatically in Unixes by running a short number of commands, that work most of the time, I am OK with it. As for Windows, it has to be possible to use Visual Studio in addition to MinGW or Cygwin. Visual Studio is required to be able to build for the Universal Windows Platform, and getting the VM working in a retail XBox One ( https://msdn.microsoft.com/en-us/windows/uwp/xbox-apps/index ). Best regards, Ronie 2016-11-26 14:09 GMT-03:00 Eliot Miranda <[hidden email]>:
|
H Roniei, great work. I am mot sure if it can help but there is a decent free IDE for Windows called Codeblocks which can be configured to use (IIRC) various compilers and debuggers. Since you're into it maybe it worths paying a visit to their website to figure out its potential. Cheers, vagy
|
In reply to this post by Ronie Salgado
Ronie, Is all of this in a branch somewhere so that I can have a look? For cairo, I think that I can build it with another compiler than MinGW, it doesn't really matter as it just makes a dll (or well, I can just skip that and reuse an already built one). -ltro is the flag that makes the whole thing trips up in GCC5 and requires additional flags, but adding them just kicked the can down the road a bit further as they were still unresolved symbols. Need to see why cairo build gives that but seems a cairo issue that others are facing as well. May end up building cairo with the old compiler but this defeats the purpose. For VS2015, I've got it too and yes, the debugging facilities are much better, not to mention that the compilation times are much nicer. GCC is just dog slow on Windows compared to Linux. I read that it was because of sub-bar fork support in Windows. Nice to give me an excuse to get an XBox One for XMas in order to try Pharo on it. Best, Phil On Sat, Nov 26, 2016 at 11:16 PM, Ronie Salgado <[hidden email]> wrote:
|
Hi Phil, It is on the MinimalisticHeadless branch of ( https://github.com/ronsaldo/opensmalltalk-vm/tree/MinimalisticHeadless ).GIV(remapBufferCount) == 0 55758 These are false positives due to the macro expansion bug.
For me it is also an excuse for XMas ;) . Best regards, Ronie 2016-11-27 18:01 GMT-03:00 [hidden email] <[hidden email]>:
|
In reply to this post by philippeback
On Mon, Nov 28, 2016 at 5:01 AM, [hidden email] <[hidden email]> wrote: > > Ronie, > > Is all of this in a branch somewhere so that I can have a look? > > For cairo, I think that I can build it with another compiler than MinGW, it doesn't really matter as it just makes a dll (or well, I can just skip that and reuse an already built one). > > -ltro is the flag that makes the whole thing trips up in GCC5 and requires additional flags, but adding them just kicked the can down the road a bit further as they were still unresolved symbols. Need to see why cairo build gives that but seems a cairo issue that others are facing as well. May end up building cairo with the old compiler but this defeats the purpose. > > For VS2015, I've got it too and yes, the debugging facilities are much better, not to mention that the compilation times are much nicer. GCC is just dog slow on Windows compared to Linux. I read that it was because of sub-bar fork support in Windows. Interesting to note Microsoft is moving to Clang [1] to replace their C1 front-end, which should(?) make cross-platform with OSX and Linux a bit easier. Anyone know if that means MVSC might be better to use on its own than using MinGW/Cygwin? [1] http://www.theregister.co.uk/2015/10/21/microsoft_promises_clang_for_windows_in_november_visual_c_update/ cheers -ben |
Now I found the FFI problem with MinGW , I was missing some old compilation flags on my CMake scripts. I still have to fix this same bug with MSVC, but at least normal Pharo image can eval "1+1" without crashing, and stdout is working properly now in Windows. During the rest of the week I will make this VM variant working completely on Linux, Windows and OS X, with SDL2 and hopefully we will get OSWindow working alot better in Windows and Mac. (In Linux it was already working pretty well, probably because each X connection has its own event queue). Interesting to note Microsoft is moving to Clang [1] to replace their In Windows the standard compiler is MSVC, despite it has a poorer quality than gcc/clang. The movement to the clang front-end is something where it is not possible to rely until it becomes stable. It is quite clear that the VM is not meant to be used with MSVC, because it is not being built and tested with it all of the time. However, in some platforms, the only alternative is MSVC. Best regards, Ronie 2016-11-28 0:46 GMT-03:00 Ben Coman <[hidden email]>:
|
Free forum by Nabble | Edit this page |