Hi Andrei,
On Wed, Mar 29, 2017 at 10:40 AM, Andrei Chis <chisvasileandrei(a)gmail.com>
wrote:
> Hi,
>
> I have the following script that I run on mac:
>
> wget -O- get.pharo.org/vmLatest60 | bash
> wget -O- get.pharo.org/60 | bash
> ./pharo Pharo.image eval "Smalltalk snapshot: true andQuit: true"
> ./pharo-ui Pharo.image
>
> Initially I thought that it doesn't work but then I saw that it opens a
> very very small window with just a tiny scrollbar. Screenshot here:
> https://dl.dropboxusercontent.com/u/74244847/Data/Screen%
> 20Shot%202017-03-29%20at%207.38.48%20PM.png.
>
Find attached a script for unix/mac os that sets the size of the screen in
the image file.
Arguably the VM should use a window extent of 0@0 as a "start me headless"
flag. What do people think? It would complicate things. The image would
have to be located before any VM command line argument flags are processed,
and probably opened twice. Seems like a lot of effort for little gain.
Cheers,
> Andrei
>
_,,,^..^,,,_
best, Eliot
Hi all,
We are here with Olivier taking a loot at how serial ports work, because he
wants to use it to connect to arduino/raspberries.
We saw that the serial port works nice in unix, in windows we had a look
but we found some problems (and we do not have now a windows machine to
test well), and we found that in mac it does not work. We are seeing that
this behaviour is there since Pharo 3 (4 years ago).
We tried to see if it was a problem of the VM plugin (missing depenencies
using ld / otool) but everything seemed ok.
Finally, we took the vm from git and tried to compile it from scratch.
*Meta-question 1:* Is there a way to create an xcode project from the vm
sources? We would have lost less time if we used a graphical debugger to
take a look at this :).
There, we found that
- apparently the mac VM is using an empty implementation of the serial port
plugin:
https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/platforms/Mac%20…
We replaced the contents of that file by the one in the Unix plugin and it
worked *when the plugin was compiled as internal* (delta some differences
between the default values in mac and unix like uppercasing the 's' of ttyS
and ttys)
https://github.com/OpenSmalltalk/opensmalltalk-vm/blob/Cog/platforms/unix/p…
However, as soon as we retried to recompile the plugin as external it did
not work any more... The initializeModule function was never called, the
module was not loaded (from the system report) and the Serial port could
not be open. For this we would have liked a debugger. And I'm not a friend
of gdb on the terminal...
*Meta-question 2:* Is there any clean/make clean used to remove generated
files. We found ourselves a lot of times bitten by the fact that even
recompiling everything using `mvm -A` did not really recompile and we had
to remove files from here and there...
How should we propose a fix?
- do we duplicate the code of the plugin in the mac and unix platforms?
- or do we somehow tell the compilation process that for this plugin it
should use the sources in the unix platform code?
Thanks!
Guille and Olivier
Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: 4ceff23323bcd0f2d3d0a4a43c2995f43d09c98a
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/4ceff23323bcd0f2d3…
Author: Eliot Miranda <eliot.miranda(a)gmail.com>
Date: 2017-03-27 (Mon, 27 Mar 2017)
Changed paths:
M nsspur64src/vm/cogit.h
M nsspur64src/vm/cogitX64SysV.c
M nsspur64src/vm/cogitX64WIN64.c
M nsspur64src/vm/cointerp.c
M nsspur64src/vm/cointerp.h
M nsspur64src/vm/gcc3x-cointerp.c
M nsspursrc/vm/cogit.h
M nsspursrc/vm/cogitARMv5.c
M nsspursrc/vm/cogitIA32.c
M nsspursrc/vm/cogitMIPSEL.c
M nsspursrc/vm/cointerp.c
M nsspursrc/vm/cointerp.h
M nsspursrc/vm/gcc3x-cointerp.c
M nsspurstack64src/vm/gcc3x-interp.c
M nsspurstack64src/vm/interp.c
M nsspurstacksrc/vm/gcc3x-interp.c
M nsspurstacksrc/vm/interp.c
M scripts/gitrevert
M spur64src/vm/cogit.h
M spur64src/vm/cogitX64SysV.c
M spur64src/vm/cogitX64WIN64.c
M spur64src/vm/cointerp.c
M spur64src/vm/cointerp.h
M spur64src/vm/gcc3x-cointerp.c
M spurlowcode64src/vm/cogit.h
M spurlowcode64src/vm/cogitX64SysV.c
M spurlowcode64src/vm/cogitX64WIN64.c
M spurlowcode64src/vm/cointerp.c
M spurlowcode64src/vm/cointerp.h
M spurlowcode64src/vm/gcc3x-cointerp.c
M spurlowcodesrc/vm/cogit.h
M spurlowcodesrc/vm/cogitARMv5.c
M spurlowcodesrc/vm/cogitIA32.c
M spurlowcodesrc/vm/cogitMIPSEL.c
M spurlowcodesrc/vm/cointerp.c
M spurlowcodesrc/vm/cointerp.h
M spurlowcodesrc/vm/gcc3x-cointerp.c
M spurlowcodestack64src/vm/gcc3x-interp.c
M spurlowcodestack64src/vm/interp.c
M spurlowcodestacksrc/vm/gcc3x-interp.c
M spurlowcodestacksrc/vm/interp.c
M spursista64src/vm/cogit.h
M spursista64src/vm/cogitX64SysV.c
M spursista64src/vm/cogitX64WIN64.c
M spursista64src/vm/cointerp.c
M spursista64src/vm/cointerp.h
M spursista64src/vm/gcc3x-cointerp.c
M spursistasrc/vm/cogit.h
M spursistasrc/vm/cogitARMv5.c
M spursistasrc/vm/cogitIA32.c
M spursistasrc/vm/cogitMIPSEL.c
M spursistasrc/vm/cointerp.c
M spursistasrc/vm/cointerp.h
M spursistasrc/vm/gcc3x-cointerp.c
M spursrc/vm/cogit.h
M spursrc/vm/cogitARMv5.c
M spursrc/vm/cogitIA32.c
M spursrc/vm/cogitMIPSEL.c
M spursrc/vm/cointerp.c
M spursrc/vm/cointerp.h
M spursrc/vm/gcc3x-cointerp.c
M spurstack64src/vm/gcc3x-interp.c
M spurstack64src/vm/interp.c
M spurstacksrc/vm/gcc3x-interp.c
M spurstacksrc/vm/interp.c
M src/vm/cogit.h
M src/vm/cogitARMv5.c
M src/vm/cogitIA32.c
M src/vm/cogitMIPSEL.c
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.2188
SpurPlanningCompactor:
Fix a bug in resetting the free chunk used for the firstUnusedFieldsSpace after
non-final pasxses (i.e. on snapshot). The old code didn't check to see if a
free chunk was actually found(!!).
Lowcode:
Fixing the problem with the Lowcode register allocator.
Fixing the Lowcode compilation bug.
Git:
Have the gitrevert script print names of files it reverts. Avoid the annoying
message about 'M' not being versioned (fixed in a previous commit; noted here).
Commit: d8ab3d981f0fd2e95fe0247b4385faa8164b61f1
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/d8ab3d981f0fd2e95f…
Author: Eliot Miranda <eliot.miranda(a)gmail.com>
Date: 2017-03-27 (Mon, 27 Mar 2017)
Changed paths:
M .travis_test.sh
Log Message:
-----------
Merge remote-tracking branch 'refs/remotes/origin/Cog' into Cog
Compare: https://github.com/OpenSmalltalk/opensmalltalk-vm/compare/5418a415e929...d8…
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2188.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.2188
Author: eem
Time: 27 March 2017, 3:47:04.412629 pm
UUID: ff4ca601-cd05-4792-ab0d-dcdf19975239
Ancestors: VMMaker.oscog-eem.2187
Update the VMMaker class comment.
=============== Diff against VMMaker.oscog-eem.2187 ===============
Item was changed:
Object subclass: #VMMaker
instanceVariableNames: 'inline forBrowser allPlugins internalPlugins externalPlugins platformName sourceDirName platformRootDirName logger interpreterClassName is64BitVM optionsDictionary abortBlock'
classVariableNames: 'DirNames'
poolDictionaries: ''
category: 'VMMaker-Building'!
+ !VMMaker commentStamp: 'eem 3/27/2017 15:46' prior: 0!
+ This class coordinates generating sources for the various VMs and the set of plugins that comprise the Cog VM. See the class side for generating all or some configurations. The source is intended to be generated in the context of the opensmalltalk-vm source tree available via git from https://github.com/OpenSmalltalk/opensmalltalk-vm. See VMMaker class>>initialize for the relative locations of this image and the source tree (for example, in the image directory of the opensmalltalk-vm tree). Invoke a single configuration via e.g.
+ VMMaker generateSqueakSpurCog64VM
+ or a set via e.g.
+ VMMaker generateAllConfigurationsUnderVersionControl
+
+ The source tree on branch Cog at https://github.com/OpenSmalltalk/opensmalltalk-vm is generated via generateAllConfigurationsUnderVersionControl. Note that "Squeak" in these cofiguarations means virtual machines that support various versions of Squeak, Pharo and Cuis smalltalks. IIABDFI.
+
+
+ Words to the wise:
+ In the old days, VM sources would be generated per-platform. Now, all the source generated by the above generators and included in https://github.com/OpenSmalltalk/opensmalltalk-vm is separately versioned, and we use only CrossPlatformVMMaker to generate them. All platform-specific variations, such as whether to use a struct to hold the interpreter's global variables, which plugins to include in a VM, etc, are included in the generated osurce. All plugins are generated such that they can be compiled as either internal or external plugins. What specific variations to use are therefore controlled by the platform-specific makefiles, and the decision is deferred from source generation time to VM build time. The source is designed to be platform neutral. This form is chosen carefully to allow VMs to be built from fully checked-in, and hence fully versioned source.
+
+
+ Old commentary:
- !VMMaker commentStamp: 'tpr 5/5/2003 12:28' prior: 0!
This class builds a VM codebase from the in-image and on-file code.
The platforms file tree you need can be downloaded via cvs from http://squeak.Sourceforge.net. See also the swiki (http://minnow.cc.gatech.edu/squeak/2106) for instructions.
It is fairly configurable as to where directories live and can handle multiple platform's source trees at once. It's main purpose is to allow easy building of source trees with any combination of internal/external/unused plugins to suit your platform needs and capabilities. For example, the Acorn has no need of Sound or AsynchFile plugins since I haven't written any platform code for them.
There is a simple UI tool for this
VMMakerTool openInWorld
will open a reasonably self explanatory tool with balloon help to explain all the fields - and a help window on top of that.
There are some simple workspace & inspector commands, allowing scripted building:
VMMaker default initializeAllExternal generateEntire
for example will build sources for a system with all the plugins external whereas
VMMaker default initializeAllInternal generateEntire
would build all applicable plugins for internal compilation.
(VMMaker forPlatform: 'Mac OS') initializeAllExternal generateEntire
would build a source tree for a Mac even on a Windows machine (err, ignoring for now the irritation of lineends).
If you have a slightly more complex configuration you want to use, perhaps with Socket and Serial support external (because for your case they are rarely used and saving the space has some value) then you could try
(VMMaker default initializeAllInternalBut: #(SocketPlugin SerialPlugin) generateEntire
More complex still would be
(VMMaker default initializeInternal: #(BitBltPlugin MiscPrimsPlugin FilePlugin) external: #(SocketPlugin ZipPlugin B2DPlugin)
which allows you to precisely list all the plugins to use.
WARNING If you miss out a plugin you need, it won't be there. This message is really best suited to use by a UI like VMMakerTool.
To save a configuration for later use, you need to send #saveConfiguration to an active instance of VMMaker. Obviously you could simply use
(VMMaker default initializeAllInternalBut: #(SocketPlugin SerialPlugin) saveConfiguration
but inspecting
VMMaker default
and altering the internalPlugins and externalPlugins or the boolean flags for inline or forBrowser followed by saving the configuration allows ultimate power for now. To load a saved configuration file, use #loadConfigurationFrom: aFilename whilst inspecting a VMMaker. The loaded state will completely override any pre-existing state, so take care.
You can generate only parts of the source tree if you wish; as shown above #generateEntire will create the whole collection of internal and external plugins as well as the core VM. To create only the external plugins use #generateExternalPlugins, or create a single plugin with #generateExternalPlugin: name. To assemble the main VM including the internal plugins, use #generateMainVM. The interpreter 'interp.c' file is made with #generateInterpreterFile. You can generate a single internal plugin with #generateInternalPlugin: only if it has already been generated before; this interlocking is intended to make sure the named primitive table in the vm is correct.
There are some rules to observe in order to use this:-
- under the working directory (by default - you can configure it) you need a directory called 'platforms' (also configurable) with subdirectories named as the platform names returned by Smalltalk platformName (ie unix, RiscOS, Mac OS, etc - this isn't configurable). At the very least you need the one for your own platform and the pseudo-platform called 'Cross'. By adding a 'DirNames' entry for #machineType you can cross 'compile' for some other platform. Now all we need is a cross-compiler for the C code :-)
- under this directory you must have a simple structure of directories for each generated plugin that you support on the platform, plus 'vm'. In each directory you place any/all platform specific files (and subdirectories) for that plugin. In 'misc' you can place any miscellaneous files such as makefiles, resources etc. For example, for unix you have
platforms/
unix/
plugins/
AsynchFilePlugin /
sqUnixAsynchfile.c
vm/
sqGnu.h
Profile/
misc/
makefile.in
util/
...etc
Any plugins requiring platform files that you don't support shouldn't appear in the resulting code tree. If you try to include an unsupported plugin in the list to be made external, the VMMaker simply ignores it. However, if you include it in the list to be made internal you will get an error since that seems like a potentially serious source of confusion.
There are three lists of plugins maintained herein:-
1) the list of all known generatable plugins. We scan this list and compare with the supported plugins as indicated by the file tree.
2) the list of chosen internal plugins.
3) the list of chosen external plugins.
See initializeAllPlugins, initialiseAllExternal etc for fairly obvious usage.
There is also a short list of directory names in the class variable 'DirNames' that you can alter if needed.
Known problems:-
a) since Squeak has really poor filename handling, you can't simply change the directory names to '/foo/bar/myEvilCodeBase' and expect it to work. You fix file names and I'll fix VMMaker :-)
b) Squeak copying of a file loses the assorted permissions, filetype info and other useful bits. To workaround this problem, see the FileCopyPlugin, which provides the platform independent part of a simple access for the OS filecopy capability. So far there are functional plugins for unix, Mac and Acorn. DOS machines appear not to need one. This is less of a problem in practise now that unix, Acorn & Mac no longer copy files from /platforms to /src.
inline <Boolean> - is the generated code to be inlined or not
forBrowser <Boolean> - is this to be a build for in-Browser use? Only relevent to Macs
allPlugins <Collection> - all the known possible plugins
internalPlugins <Collection> - the plugins chosen to be generated for internal linking
externalPlugins <Collection> - the plugins intended to be external plugins
exportList <Collection> - a list of function names exported from plugins intended to be internal
platformName <String> - the name of the platform for which we are building a source tree. It is possible to do 'cross-compiles'
sourceDirName, platformRootDirName <String> - the name of the directory into which we write the generated sources and the name of the directory where we should find the platforms tree.!
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2187.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.2187
Author: eem
Time: 27 March 2017, 3:00:06.676146 pm
UUID: 2259d299-65a4-42d0-a01b-4b25f5a89745
Ancestors: VMMaker.oscog-rsf.2186
SpurPlanningCompactor:
Fix a big in resetting the free chunk used for the firstUnusedFieldsSpace after non-final pasxses (i.e. on snapshot). The old code didn't check to see if a free chunk was actually found(!!).
=============== Diff against VMMaker.oscog-rsf.2186 ===============
Item was added:
+ ----- Method: SpurMemoryManager>>validFreeTreeChunk: (in category 'free space') -----
+ validFreeTreeChunk: chunk
+ <inline: false>
+ (segmentManager segmentContainingObj: chunk) ifNil:
+ [^false].
+ ^(self validFreeTreeChunk: chunk parent: (self fetchPointer: self freeChunkParentIndex ofFreeChunk: chunk)) isNil!
Item was changed:
----- Method: SpurPlanningCompactor>>updateSavedFirstFieldsSpaceIfNecessary (in category 'space management') -----
updateSavedFirstFieldsSpaceIfNecessary
"If savedFirstFieldsSpace is a free chunk then it may need to be repositioned if there is more than one pass."
<inline: true>
+ (self savedFirstFieldsSpaceInFreeChunk
+ and: [savedFirstFieldsSpace start < lastMobileObject]) ifTrue:
+ [(self findHighestSuitableFreeBlock: savedFirstFieldsSpace limit - savedFirstFieldsSpace start)
+ ifNotNil:
+ [:largestFreeChunk|
+ self useFreeChunkForSavedFirstFieldsSpace: largestFreeChunk]
+ ifNil:
+ [self useEdenForSavedFirstFieldsSpace]].
- self savedFirstFieldsSpaceInFreeChunk ifTrue:
- [self useFreeChunkForSavedFirstFieldsSpace: manager findLargestFreeChunk].
savedFirstFieldsSpace top: savedFirstFieldsSpace start - manager bytesPerOop!
Item was changed:
----- Method: SpurPlanningCompactor>>useFreeChunkForSavedFirstFieldsSpace: (in category 'space management') -----
useFreeChunkForSavedFirstFieldsSpace: highestSuitableFreeBlock
"Use the supplied free chunk to hold the savedFirstFieldsSpace. Invoked when
eden is found not to be big enough for the job. Avoid the first few fields so as
not to destroy the free chunk and there by confuse object enumeration."
<inline: true>
+ self assert: (manager validFreeTreeChunk: highestSuitableFreeBlock).
savedFirstFieldsSpace
start: highestSuitableFreeBlock + (manager freeChunkLargerIndex * manager bytesPerOop);
limit: (manager addressAfter: highestSuitableFreeBlock).
savedFirstFieldsSpaceNotInOldSpace := false.
self deny: self savedFirstFieldsSpaceWasAllocated!