Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: 2e24d6feac3644f476b6e50a44001663e71fbb8f
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/2e24d6feac3644f476…
Author: Eliot Miranda <eliot.miranda(a)gmail.com>
Date: 2017-08-09 (Wed, 09 Aug 2017)
Changed paths:
M nsspur64src/vm/cogit.h
M nsspur64src/vm/cointerp.c
M nsspur64src/vm/cointerp.h
M nsspur64src/vm/gcc3x-cointerp.c
M nsspursrc/vm/cogit.h
M nsspursrc/vm/cointerp.c
M nsspursrc/vm/cointerp.h
M nsspursrc/vm/gcc3x-cointerp.c
M nsspurstacksrc/vm/gcc3x-interp.c
M nsspurstacksrc/vm/interp.c
M spur64src/vm/cogit.h
M spur64src/vm/cointerp.c
M spur64src/vm/cointerp.h
M spur64src/vm/gcc3x-cointerp.c
M spurlowcode64src/vm/cogit.h
M spurlowcode64src/vm/cointerp.c
M spurlowcode64src/vm/cointerp.h
M spurlowcode64src/vm/gcc3x-cointerp.c
M spurlowcodesrc/vm/cogit.h
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/cointerp.c
M spursista64src/vm/cointerp.h
M spursista64src/vm/gcc3x-cointerp.c
M spursistasrc/vm/cogit.h
M spursistasrc/vm/cointerp.c
M spursistasrc/vm/cointerp.h
M spursistasrc/vm/gcc3x-cointerp.c
M spursrc/vm/cogit.h
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
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.2260
Fix Spur instantiateClass:indexableSize: for non-indexaqble objects. Old code
would allocate if num indexable slots was 0, but would zero-fill. New code
always fails.
Branch: refs/heads/Cog
Home: https://github.com/OpenSmalltalk/opensmalltalk-vm
Commit: fe0afe985ff50f537834149aedaebe97d0ee290c
https://github.com/OpenSmalltalk/opensmalltalk-vm/commit/fe0afe985ff50f5378…
Author: Eliot Miranda <eliot.miranda(a)gmail.com>
Date: 2017-08-08 (Tue, 08 Aug 2017)
Changed paths:
M src/plugins/HostWindowPlugin/HostWindowPlugin.c
M src/plugins/SerialPlugin/SerialPlugin.c
Log Message:
-----------
CogVM source as per VMMaker.oscog-eem.2259
Plugin Slang
Have the accessor depths of optional primitives emitted as conditionals.
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2259.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.2259
Author: eem
Time: 8 August 2017, 12:37:11.878857 pm
UUID: 2f1fc238-68f1-4f4c-96c6-ed2af969b6d2
Ancestors: VMMaker.oscog-eem.2258
Plugin Slang
Make sure the accessor depths of optional primitives are emitted as conditionals.
=============== Diff against VMMaker.oscog-eem.2257 ===============
Item was changed:
----- Method: CCodeGenerator>>emitExportsNamed:pluginName:on: (in category 'C code generator') -----
emitExportsNamed: exportsNamePrefix pluginName: pluginName on: aStream
"Store all the exported primitives in the form used by the internal named prim system."
| nilVMClass excludeDepth |
(nilVMClass := vmClass isNil) ifTrue: "We need a vmClass temporarily to compute accessor depths."
[vmClass := StackInterpreter].
"Don't include the depth in the vm's named primitives if the vm is non-Spur."
excludeDepth := exportsNamePrefix = 'vm'
and: [pluginName isEmpty
and: [vmClass objectMemoryClass hasSpurMemoryManagerAPI not]].
aStream cr; cr; nextPutAll: 'static char _m[] = "'; nextPutAll: pluginName; nextPutAll: '";'.
aStream cr; nextPutAll: 'void* '; nextPutAll: exportsNamePrefix; nextPutAll: '_exports[][3] = {'; cr.
+ self sortedExportMethods do:
+ [:method|
+ self withOptionalConditionalDefineFor: method
+ on: aStream
+ do: [| primName |
+ primName := self cFunctionNameFor: method selector.
+ aStream tab; nextPutAll: '{(void*)_m, "'; nextPutAll: primName.
+ excludeDepth ifFalse:
+ [(self accessorDepthForSelector: primName asSymbol) ifNotNil:
+ [:depth| "store the accessor depth in a hidden byte immediately after the primName"
+ self assert: depth < 128.
+ aStream
+ nextPutAll: '\000\';
+ nextPutAll: ((depth bitAnd: 255) printStringBase: 8 nDigits: 3)]].
+ aStream nextPutAll: '", (void*)'; nextPutAll: primName; nextPutAll: '},'; cr]].
- ((methods select: [:m| m export]) asSortedCollection: [:a :b| a selector caseSensitiveLessOrEqual: b selector]) do:
- [:method| | compileTimeOptionPragmas primName |
- (compileTimeOptionPragmas := method compileTimeOptionPragmas) notEmpty ifTrue:
- [method outputConditionalDefineFor: compileTimeOptionPragmas on: aStream].
- primName := self cFunctionNameFor: method selector.
- aStream tab; nextPutAll: '{(void*)_m, "'; nextPutAll: primName.
- excludeDepth ifFalse:
- [(self accessorDepthForSelector: primName asSymbol) ifNotNil:
- [:depth| "store the accessor depth in a hidden byte immediately after the primName"
- self assert: depth < 128.
- aStream
- nextPutAll: '\000\';
- nextPutAll: ((depth bitAnd: 255) printStringBase: 8 nDigits: 3)]].
- aStream nextPutAll: '", (void*)'; nextPutAll: primName; nextPutAll: '},'; cr.
- method terminateConditionalDefineFor: compileTimeOptionPragmas on: aStream].
aStream tab; nextPutAll: '{NULL, NULL, NULL}'; cr; nextPutAll: '};'; cr.
nilVMClass ifTrue:
[vmClass := nil]!
Item was changed:
----- Method: CCodeGenerator>>promoteIntegerArithmeticTypes:and: (in category 'type inference') -----
promoteIntegerArithmeticTypes: firstType and: secondType
"Answer the return type for an arithmetic send.
Deal with integer promotion rules of C99.
See section 6.3 Conversions of the standard.
6.3.1.1 ...snip...
If an int can represent all values of the original type, the value is converted to an int;
otherwise, it is converted to an unsigned int. These are called the integer promotions.
+ All other types are unchanged by the integer promotions
- All other types are unchanged by the inte ger promotions
6.3.1.8 ...snip...
Otherwise, the integer promotions are performed on both operands
Then the following rules are applied to the promoted operands:
If both operands have the same type, then no further conversion is needed.
Otherwise, if both operands have signed integer types or both have unsigned integer
types, the operand with the type of lesser integer conversion rank is converted to the
type of the operand with greater rank.
Otherwise, if the operand that has unsigned integer type has rank greater or equal to
the rank of the type of the other operand, then the operand with signed integer type
is converted to the type of the operand with unsigned integer type.
Otherwise, if the type of the operand with signed integer type can represent all of the
values of the type of the operand with unsigned integer type, then the operand with
unsigned integer type is converted to the type of the operand with signed integer type.
Otherwise, both operands are converted to the unsigned integer type corresponding to
the type of the operand with signed integer type.
+ This is so that the generated code behaviour is insensitive to inlining."
- This is so that the generated code behaviour is unsensitive to inlining."
| length1 length2 intSize |
length1 := self sizeOfIntegralCType: firstType.
length2 := self sizeOfIntegralCType: secondType.
intSize := self sizeOfIntegralCType: #int.
(length1 < intSize and: [length2 < intSize]) ifTrue: [^#int]. "Integer promotion"
length1 > length2 ifTrue: [^firstType].
length2 > length1 ifTrue: [^secondType].
firstType first = $u ifTrue: [^firstType].
secondType first = $u ifTrue: [^secondType].
^firstType!
Item was added:
+ ----- Method: CCodeGenerator>>sortedExportMethods (in category 'public') -----
+ sortedExportMethods
+ "Answer a suitably-sorted array of all exported TMethods"
+ ^(methods select: [:m| m export]) asSortedCollection: [:a :b| a selector caseSensitiveLessOrEqual: b selector]!
Item was added:
+ ----- Method: CCodeGenerator>>withOptionalConditionalDefineFor:on:do: (in category 'C code generator') -----
+ withOptionalConditionalDefineFor: aTMethod on: aStream do: aBlock
+ "Evaluate aBlock, surrounded by an appropriate conditional define added to the stream if required."
+ | compileTimeOptionPragmas |
+ (compileTimeOptionPragmas := aTMethod compileTimeOptionPragmas) notEmpty ifTrue:
+ [aTMethod outputConditionalDefineFor: compileTimeOptionPragmas on: aStream].
+ aBlock value.
+ aTMethod terminateConditionalDefineFor: compileTimeOptionPragmas on: aStream!
Item was changed:
----- Method: VMMaker class>>makerFor:and:with:to:platformDir: (in category 'utilities') -----
makerFor: interpreterClass and: cogitClassOrNil with: optionsPairsArrayArg to: srcDirName platformDir: platDirName
"Initialize a VMMaker to generate the VM to the given target directory. Include plugins in pluginList.
Example:
(VMMaker
generate: NewspeakInterpreter
to: (FileDirectory default pathFromURI: 'cogvm/newspeaksrc')
platformDir: (FileDirectory default pathFromURI: 'cogvm/platforms')
including:#( AsynchFilePlugin FloatArrayPlugin RePlugin B2DPlugin FloatMathPlugin SecurityPlugin
BMPReadWriterPlugin IA32ABI SocketPlugin BitBltPlugin JPEGReadWriter2Plugin SurfacePlugin
DSAPrims JPEGReaderPlugin UUIDPlugin DropPlugin LargeIntegers UnixOSProcessPlugin
FileCopyPlugin Matrix2x3Plugin Win32OSProcessPlugin FilePlugin MiscPrimitivePlugin ZipPlugin))"
| maker optionsPairsArray |
maker := self forPlatform: 'Cross'.
maker sourceDirectoryName: srcDirName.
maker platformRootDirectoryName: platDirName.
maker interpreterClass: interpreterClass.
optionsPairsArray := (cogitClassOrNil isNil or: [optionsPairsArrayArg includes: #Cogit])
+ ifTrue: [optionsPairsArrayArg]
+ ifFalse: [optionsPairsArrayArg, { #Cogit. cogitClassOrNil name }].
- ifNil: [optionsPairsArrayArg]
- ifNotNil: [optionsPairsArrayArg, { #Cogit. cogitClassOrNil name }].
maker options: optionsPairsArray.
^maker
!
Item was changed:
----- Method: VMPluginCodeGenerator>>emitAccessorDepthsOn: (in category 'C code generator') -----
emitAccessorDepthsOn: aStream
"Output accessor depth bytes for all primitives in the plugin.
This is for external primitives in Spur."
+ self sortedExportMethods do:
+ [:method| | primName |
+ primName := self cFunctionNameFor: method selector.
- (self sortStrings: self exportedPrimitiveNames) do:
- [:primName|
(self accessorDepthForSelector: primName asSymbol) ifNotNil:
[:depth|
"store the accessor depth in a byte variable; save a little space
by omitting depths < 0; support code supplies the default."
self assert: depth < 128.
depth >= 0 ifTrue:
+ [self withOptionalConditionalDefineFor: method
+ on: aStream
+ do: [aStream
+ nextPutAll: 'signed char ';
+ nextPutAll: primName;
+ nextPutAll: 'AccessorDepth = ';
+ nextPutAll: (self cLiteralFor: depth);
+ nextPut: $;;
+ cr]]]]!
- [aStream
- nextPutAll: 'signed char ';
- nextPutAll: primName;
- nextPutAll: 'AccessorDepth = ';
- nextPutAll: (self cLiteralFor: depth);
- nextPut: $;;
- cr]]]!
Item was changed:
----- Method: VMPluginCodeGenerator>>emitExportsOn: (in category 'C code generator') -----
emitExportsOn: aStream
"Store all the exported primitives in the form used by the internal named prim system."
+ | nilVMClass |
+ (nilVMClass := vmClass isNil) ifTrue: "We need a vmClass temporarily to compute accessor depths."
+ [vmClass := StackInterpreter].
aStream cr; cr; nextPutAll:'#ifdef SQUEAK_BUILTIN_PLUGIN'.
self emitExportsNamed: pluginClass moduleName
pluginName: pluginClass moduleExportsName
on: aStream.
aStream cr; nextPutAll: '#else /* ifdef SQ_BUILTIN_PLUGIN */'; cr; cr.
self emitAccessorDepthsOn: aStream.
+ aStream cr; nextPutAll: '#endif /* ifdef SQ_BUILTIN_PLUGIN */'; cr.
+ nilVMClass ifTrue:
+ [vmClass := nil]!
- aStream cr; nextPutAll: '#endif /* ifdef SQ_BUILTIN_PLUGIN */'; cr!
Item was added:
+ ----- Method: VMPluginCodeGenerator>>sizeOfIntegralCType: (in category 'inlining') -----
+ sizeOfIntegralCType: anIntegralCType "<String>"
+ "Hack; because the plugin sources are compiled either as 32 or 64 bit
+ size those types which are either 32 or 64 bits in size as 48 bits.
+ This happens to produce sane results for integer promotion."
+ "N.B. Only works for values for which isIntegralCType: answers true."
+ | prunedCType index |
+ (anIntegralCType beginsWith: 'register ') ifTrue:
+ [^self sizeOfIntegralCType: (anIntegralCType allButFirst: 9)].
+ prunedCType := (anIntegralCType beginsWith: 'unsigned ')
+ ifTrue: [(anIntegralCType allButFirst: 9) withBlanksTrimmed]
+ ifFalse: [(anIntegralCType beginsWith: 'signed ')
+ ifTrue: [(anIntegralCType allButFirst: 7) withBlanksTrimmed]
+ ifFalse: [anIntegralCType]].
+
+ ^prunedCType asString caseOf: {
+ ['sqLong'] -> [8].
+ ['usqLong'] -> [8].
+ ['long long'] -> [8].
+ ['sqInt'] -> [6].
+ ['usqInt'] -> [6].
+ ['sqIntptr_t'] -> [6].
+ ['usqIntptr_t'] -> [6].
+ ['int'] -> [4].
+ ['short'] -> [2].
+ ['short int'] -> [2].
+ ['char'] -> [1].
+ ['long'] -> [BytesPerWord]. "It's ambiguous on LLP64 and we'll later remove it"
+ ['size_t'] -> [6].
+ ['pid_t'] -> [6].
+ }
+ otherwise:
+ [((anIntegralCType beginsWith: 'unsigned') "e.g. 'unsigned : 8'"
+ and: [(anIntegralCType includesAnyOf: '[*]') not
+ and: [(index := anIntegralCType indexOf: $:) > 0]])
+ ifTrue: [(Integer readFrom: (anIntegralCType copyFrom: index + 1 to: anIntegralCType size) withBlanksTrimmed readStream) + 7 // 8]
+ ifFalse: [self error: 'unrecognized integral type']]!
We managed to figure out that OSProcess works when we use gcc <= 4.8 on Debian. We are happy to use 4.8 for now, so we're good. It would of course be super cool if we could use the series 6 gcc as that will soon ship with Debian 9 (stretch) but it's probably not trivial to just move to a new compiler version (as seems evident from the fact that a minor version change can mess up compilation).
Thanks for your help Alistair and Eliot.
Cheers,
Max
> On 18 May 2017, at 11:00, vm-dev-request(a)lists.squeakfoundation.org wrote:
>
>> On 18 May 2017, at 00:50, vm-dev-request(a)lists.squeakfoundation.org <mailto:vm-dev-request@lists.squeakfoundation.org> wrote:
>>
>> Hi Max, Hi Alistair,
>>
>> On Wed, May 17, 2017 at 1:06 AM, Alistair Grant <akgrant0710(a)gmail.com <mailto:akgrant0710@gmail.com> <mailto:akgrant0710@gmail.com <mailto:akgrant0710@gmail.com>>>
>> wrote:
>>
>>>
>>> On Tue, May 16, 2017 at 04:59:24PM +0200, Alistair Grant wrote:
>>>> Hi Max,
>>>>
>>>> On 16 May 2017 15:40, "Max Leske" <maxleske(a)gmail.com <mailto:maxleske@gmail.com> <mailto:maxleske@gmail.com <mailto:maxleske@gmail.com>>> wrote:
>>>>
>>>> Hi Alistair,
>>>>
>>>> On 16 May 2017, at 15:32, vm-dev-request@lists.
>>> squeakfoundation.org <http://squeakfoundation.org/> <http://squeakfoundation.org/ <http://squeakfoundation.org/>>
>>>> wrote:
>>>>
>>>> Hi Max,
>>>>
>>>> I can't answer your question directly, but just wondering why
>>> you are
>>>> using
>>>> the itimer VM when the are known issues with external calls, and
>>> not
>>>> the
>>>> heartbeat VM?
>>>>
>>>> Because of the root user issue, and also because I don't care about
>>> that
>>>> much at the moment. I'm still experimenting and for those
>>> experiments it
>>>> doesn't matter which VM I use. Thirdly, the itimer VM is the one I
>>> get when
>>>> I use 'curl get.pharo.org/60+vmLatest <http://get.pharo.org/60+vmLatest> <http://get.pharo.org/60+vmLatest <http://get.pharo.org/60+vmLatest>> | bash', which is convenient
>>> to get
>>>> the latest VM, and to minimise differences between the VM's we built
>>> the
>>>> same one. I will definitely consider using the threaded VM for
>>> production.
>>>>
>>>> P.S. I would love to see OSProcess working in 32 bit mode.
>>>>
>>>> Well, it does work already, just not when we build the VM ourselves
>>> :/
>>>>
>>>> Interesting, I had the impression that for Pharo 6 OSProcess didn't work
>>> in
>>>> 32bits, only 64, but I'm also building my own VM. I'm away from my PC,
>>> but
>>>> I'll try and take a look.
>>>
>>> I'm seeing the same behaviour as you, i.e. OSProcess works in a VM
>>> downloaded from get.pharo.org <http://get.pharo.org/> <http://get.pharo.org/ <http://get.pharo.org/>>, but locks up when using the VM I
>>> compiled.
>>>
>>
>> Have you looked at the build logs and eliminated compiler version, command
>> line flags, etc? One important file is the config.h that is produced in
>> the build directory. It might be informative to compare the one configure
>> is producing on your systems and the one that the binary builds creates.
>
> Thanks for the pointer. I'll look into it.
>
>>
>>
>>>
>>> Both VMs (threaded heartbeat) are based on the same source code, i.e.:
>>>
>>> VM: 201705022326 https://github.com/OpenSmalltalk/opensmalltalk-vm.git <https://github.com/OpenSmalltalk/opensmalltalk-vm.git> <https://github.com/OpenSmalltalk/opensmalltalk-vm.git <https://github.com/OpenSmalltalk/opensmalltalk-vm.git>> $
>>> Date: Tue May 2 16:26:41 2017 -0700 $
>>>
>>> I'll try and take a look at this eventually, but I'm not sure how long
>>> that will be (several weeks away, at least).
>>>
>>> If you figure it out, please let me know.
>>>
>>> Thanks!
>>> Alistair
>>>
>>
>>
>>
>> --
>> _,,,^..^,,,_
>> best, Eliot
>
Hi Helge,
we are targeting it to ICSE 2018. With crossed fingers it will happen :-)
Cheers,
Juraj
> El 03-08-2017, a las 10:30, Nowak, Helge <HNowak(a)cincom.com> escribió:
>
> Dear Juraj, Romain and Alexandre, <>
>
> this is indeed an interesting piece of research! Where will you publish the results with detailed analysis?
>
> Cheers
> Helge
>
> Helge Nowak
> Cincom Smalltalk Technical Account Manager EMEA
> <image001.png> <http://www.cincomsmalltalk.com/>
> Cincom Systems GmbH & Co. oHG
> Am Kronberger Hang 4
> 65824 Schwalbach/Ts.
> GERMANY
> office
> mobile
> fax
>
> website
> email
> +49 89 89 66 44 94
> +49 172 74 00 402
> +49 89 89 66 44 95
>
> http://www.cincomsmalltalk.com <http://www.cincomsmalltalk.com/>
> hnowak(a)cincom.com <mailto:hnowak@cincom.com>
> A standpoint is an intellectual horizon of radius zero. -- Albert Einstein
>
> Geschäftsführer/Managing Directors: Thomas M. Nies, Donald E. Vick
> oHG mit Sitz/based in Schwalbach/Ts. (Amtsgericht Königstein/Ts. HRA 2653)
> Pers. haftender Gesellschafter/Partner liable to unlimited extent:
> Cincom Systems Verwaltungsgesellschaft mbH (Amtsgericht Königstein/Ts. HRB 5069)
>
> --- CONFIDENTIALITY STATEMENT ---
> This e-mail transmission contains information that is intended to be privileged and confidential. It is intended only for the addressee named above. If you receive this e-mail in error, please do not read, copy or disseminate it in any manner. If you are not the intended recipient, any disclosure, copying, distribution or use of the contents of this information is prohibited, please reply to the message immediately by informing the sender that the message was misdirected. After replying, please erase it from your computer system. Your assistance in correcting this error is appreciated.
>
>
> Von: Juraj Kubelka [mailto:juraj.kubelka@icloud.com]
> Gesendet: Donnerstag, 3. August 2017 09:31
> An: Any question about pharo is welcome <pharo-users(a)lists.pharo.org>; Pharo Development List <pharo-dev(a)lists.pharo.org>; Squeak Virtual Machine Development Discussion <vm-dev(a)lists.squeakfoundation.org>; squeak-dev(a)lists.squeakfoundation.org; vwnc(a)lists.cs.illinois.edu
> Betreff: [vwnc] Live Programming in Smalltalk development environments survey + raffle
>
> — “We are apologize for multiple copies.” —
>
> Dear Smalltalker,
>
> Live programming frees developers from the "edit-compile-run" loop and allows people to interact with running programs very easily. Live programming is getting popular, but many of its features have
> been present in Smalltalk for a very long time.
>
> We want to understand how Smalltalk software developers use live programming features in practice. We would be grateful if you could participate in our 10-minute survey on this subject:
> http://bit.ly/2ufcg2D <http://bit.ly/2ufcg2D>
>
> As a thank you for your participation, you will be able to participate in a raffle to win a Smalltalk book of your choice. If you wish to participate, you will need to share your email with us, so
> that we can contact you.
> We will appreciate if you share the survey
> - Twitter post: https://twitter.com/JurajKubelka/status/893006267085709312 <https://twitter.com/JurajKubelka/status/893006267085709312>
> - Facebook post: https://www.facebook.com/juraj.kubelka/posts/10212505941300008 <https://www.facebook.com/juraj.kubelka/posts/10212505941300008>
>
> By participating in the survey you will:
> - help me to successfully finish my PhD,
> - push Smalltalk awareness in Live Programming research community,
> - bring new integrated electronic communication ideas, and
> - bring new ideas to improve our Smalltalk Live Programming experience :-)
>
> We will close the survey on Wednesday, August 9, 2017 AoE.
>
> Thank you and we really hope you enjoy participating in our survey!
>
> Juraj Kubelka, PhD Student at the University of Chile
>
> Romain Robbes, Professor at Free University of Bozen-Bolzano
>
> Alexandre Bergel, Professor at the University of Chile