[Vm-dev] Re: Vm-dev Digest, Vol 102, Issue 47

Kruck, Bastian Bastian.Kruck at student.hpi.uni-potsdam.de
Fri Dec 12 13:25:49 UTC 2014


Oh Mann, das ist spannend, die  vm-dev List zu verfolgen!

Danke Tobi für die Aufforderung, mich da einzischreiben,

Danke Bert für die Diskussionen

:=]]

Basti

Am 12.12.2014 13:01 schrieb "vm-dev-request at lists.squeakfoundation.org" <vm-dev-request at lists.squeakfoundation.org>:
Send Vm-dev mailing list submissions to
        vm-dev at lists.squeakfoundation.org

To subscribe or unsubscribe via the World Wide Web, visit
        http://lists.squeakfoundation.org/mailman/listinfo/vm-dev
or, via email, send a message with subject or body 'help' to
        vm-dev-request at lists.squeakfoundation.org

You can reach the person managing the list at
        vm-dev-owner at lists.squeakfoundation.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Vm-dev digest..."


Today's Topics:

   1. Re: Re: Pharo/Squeak versions (using CogVM?) fail immediately
      when executed on AMD Athlon XP (Steve Rees)
   2. VM Maker: VMMaker.oscog-eem.978.mcz (commits at source.squeak.org)
   3. VM Maker: VMMaker.oscog-eem.979.mcz (commits at source.squeak.org)
   4. VM Maker: VMMaker.oscog-eem.980.mcz (commits at source.squeak.org)
   5. 32/64 bit VM and image combinations (was: egg sucking     alert)
      (David T. Lewis)
   6. 64-bit FFI (was: egg sucking alert) (David T. Lewis)
   7. Re: egg sucking alert (Stefan Marr)


----------------------------------------------------------------------

Message: 1
Date: Thu, 11 Dec 2014 22:50:53 +0000
From: Steve Rees <squeak-vm-dev at vimes.worldonline.co.uk>
Subject: Re: [Vm-dev] Re: Pharo/Squeak versions (using CogVM?) fail
        immediately     when executed on AMD Athlon XP
To: vm-dev at lists.squeakfoundation.org
Message-ID: <548A1FCD.4010406 at vimes.worldonline.co.uk>
Content-Type: text/plain; charset=UTF-8; format=flowed


On 11/12/2014 19:29, osl wrote:
> Eliot Miranda-2 wrote
>> But an Athlon is 15 years old now and very sloooooow.  You could pick up a
>> modern machine very cheaply. Can you not upgrade your hardware?
> I guess it's a mix of nostalgia and an "if it ain't broke don't upgrade it"
> mindset. :)
Well, in this context at least, you could class it as "broke" in that it
won't run the stuff you want, if you are looking for an excuse to upgrade :D

Steve

--
You can follow me on twitter at http://twitter.com/smalltalkhacker




------------------------------

Message: 2
Date: Thu, 11 Dec 2014 22:58:04.522 0000
From: commits at source.squeak.org
Subject: [Vm-dev] VM Maker: VMMaker.oscog-eem.978.mcz
To: vm-dev at lists.squeakfoundation.org
Message-ID:
        <mailman.0.1418385633.10973.vm-dev at lists.squeakfoundation.org>

Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.978.mcz

==================== Summary ====================

Name: VMMaker.oscog-eem.978
Author: eem
Time: 11 December 2014, 2:56:59.634 pm
UUID: 1af5bc4f-0f74-4dcb-bebb-24e2d2265a05
Ancestors: VMMaker.oscog-eem.977

Generate the right casts for left shift beyond the int
range.
Generate the right error code for negative arguments
to primitiveSizeInBytesOfInstance

=============== Diff against VMMaker.oscog-eem.977 ===============

Item was changed:
  ----- Method: CCodeGenerator>>generateShiftLeft:on:indent: (in category 'C translation') -----
  generateShiftLeft: msgNode on: aStream indent: level
         "Generate a C bitShift.  If we can determine the result
          would overflow the word size, cast to a long integer."
+        | rcvr arg valueBeyondInt castToLong |
-        | rcvr arg bitSizeOfInt |
-        bitSizeOfInt := 1 bitShift: BytesPerWord * 4. "The default type of const << N is int."
         rcvr := msgNode receiver.
         arg := msgNode args first.
+        valueBeyondInt := 1 bitShift: BytesPerWord * 4. "The default type of const << N is int."
+        castToLong := false.
+        rcvr constantNumbericValueOrNil ifNotNil:
+                [:rcvrVal|
+                arg constantNumbericValueOrNil ifNotNil:
+                        [:argVal|
+                         castToLong := rcvrVal < valueBeyondInt
+                                                          and: [(rcvrVal bitShift: argVal) >= valueBeyondInt]]].
+        castToLong
+                ifTrue:
+                        [rcvr isConstant
+                                ifTrue:
+                                        [self emitCExpression: rcvr on: aStream.
+                                         aStream nextPutAll: 'LL']
+                                ifFalse:
+                                        [aStream nextPutAll: '((unsigned long)'.
+                                         self emitCExpression: rcvr on: aStream.
+                                         aStream nextPut: $)]]
+                ifFalse:
+                        [self emitCExpression: rcvr on: aStream].
-        self emitCExpression: rcvr on: aStream.
-        (rcvr isConstant and: [arg isConstant
-         and: [rcvr value isInteger and: [arg value isInteger
-         and: [rcvr value < (1 bitShift: BytesPerWord * 8)
-         and: [(rcvr value bitShift: arg value) >= bitSizeOfInt]]]]]) ifTrue:
-                [aStream nextPutAll: 'LL'].
         aStream nextPutAll: ' << '.
         self emitCExpression: arg on: aStream!

Item was changed:
  ----- Method: SpurMemoryManager>>byteSizeOfInstanceOf:withIndexableSlots:errInto: (in category 'indexing primitive support') -----
  byteSizeOfInstanceOf: classObj withIndexableSlots: nElements errInto: errorBlock
         | instSpec classFormat numSlots |
         <var: 'numSlots' type: #usqInt>
         classFormat := self formatOfClass: classObj.
         instSpec := self instSpecOfClassFormat: classFormat.
         instSpec caseOf: {
                 [self arrayFormat]      ->
                         [numSlots := nElements].
                 [self indexablePointersFormat]  ->
                         [numSlots := (self fixedFieldsOfClassFormat: classFormat) + nElements].
                 [self weakArrayFormat]  ->
                         [numSlots := (self fixedFieldsOfClassFormat: classFormat) + nElements].
                 [self sixtyFourBitIndexableFormat]      ->
                         [numSlots := self bytesPerOop = 4 ifTrue: [nElements * 2] ifFalse: [nElements]].
                 [self firstLongFormat]  ->
                         [numSlots := self bytesPerOop = 4 ifTrue: [nElements] ifFalse: [nElements + 1 // 2]].
                 [self firstShortFormat] ->
                         [numSlots := self bytesPerOop = 4 ifTrue: [nElements + 1 // 2] ifFalse: [nElements + 3 // 4]].
                 [self firstByteFormat]  ->
                         [numSlots := nElements + (self bytesPerOop - 1) // self bytesPerOop].
                 [self firstCompiledMethodFormat]        -> "Assume nElements is derived from CompiledMethod>>basicSize."
                         [numSlots := nElements + (self bytesPerOop - 1) // self bytesPerOop] }
                 otherwise: [^errorBlock value: PrimErrBadReceiver negated]. "non-indexable"
+        numSlots >= (1 asLong << (self bytesPerOop * 8 - self logBytesPerOop)) ifTrue:
+                [^errorBlock value: (nElements < 0 ifTrue: [PrimErrBadArgument] ifFalse: [PrimErrLimitExceeded])].
-        numSlots >= (1 << (self bytesPerOop * 8 - self logBytesPerOop)) ifTrue:
-                [^errorBlock value: PrimErrLimitExceeded].
         ^self objectBytesForSlots: numSlots!



------------------------------

Message: 3
Date: Fri, 12 Dec 2014 01:15:09.064 0000
From: commits at source.squeak.org
Subject: [Vm-dev] VM Maker: VMMaker.oscog-eem.979.mcz
To: vm-dev at lists.squeakfoundation.org
Message-ID:
        <mailman.1.1418385633.10973.vm-dev at lists.squeakfoundation.org>

Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.979.mcz

==================== Summary ====================

Name: VMMaker.oscog-eem.979
Author: eem
Time: 11 December 2014, 5:14:05.949 pm
UUID: 6e5d060a-75ea-42ab-8dd3-ac3d7a550ed9
Ancestors: VMMaker.oscog-eem.978

Handle not in nilOrBooleanConstantReceiverOf:

Don't do the 32-bit swap in a 32-bit words object in
64-bit Spur.  May have to do it in a 64-bit word obj
in 64-bit Spur, but it can wait.

=============== Diff against VMMaker.oscog-eem.978 ===============

Item was changed:
  ----- Method: CCodeGenerator>>nilOrBooleanConstantReceiverOf: (in category 'utilities') -----
  nilOrBooleanConstantReceiverOf: aNode
         "Answer nil or the boolean constant that is the receiver of the given message send.
          Used to suppress conditional code when the condition is a translation-time constant."

         | val receiver argument |
         generateDeadCode ifTrue:[^nil].
         ((self isConstantNode: aNode valueInto: [:v| val := v])
          and: [#(true false) includes: val]) ifTrue:
                 [^val].
         aNode isSend ifTrue:
+                [aNode selector == #not ifTrue:
+                        [(self nilOrBooleanConstantReceiverOf: aNode receiver) ifNotNil:
+                                [:bool| ^bool not]].
+                 ((#(or: and:) includes: aNode selector)
-                [((#(or: and:) includes: aNode selector)
                  and: [aNode args last isStmtList
                  and: [aNode args last statements size = 1]]) ifTrue:
                         [(self nilOrBooleanConstantReceiverOf: aNode receiver) ifNotNil:
                                 [:rcvr|
                                 ((rcvr == false and: [aNode selector == #and:])
                                  or: [rcvr == true and: [aNode selector == #or:]]) ifTrue:
                                         [^rcvr].
                                 (self nilOrBooleanConstantReceiverOf: aNode args last statements first) ifNotNil:
                                         [:arg|
                                         ^rcvr perform: aNode selector with: [arg]]]].
                  ((#(= ~= < > <= >=) includes: aNode selector)
                   and: [(self isConstantNode: aNode receiver valueInto: [:v| receiver := v])
                   and: [receiver isInteger
                   and: [(self isConstantNode: aNode args first valueInto: [:v| argument := v])
                   and: [argument isInteger]]]]) ifTrue:
                         [^receiver perform: aNode selector with: argument]].
         ^nil!

Item was changed:
  ----- Method: StackInterpreter>>updateObjectsPostByteSwap (in category 'image save/restore') -----
  updateObjectsPostByteSwap
         "Byte-swap the words of all bytes objects in the image, including Strings, ByteArrays,
          and CompiledMethods. This returns these objects to their original byte ordering
          after blindly byte-swapping the entire image. For compiled  methods, byte-swap
          only their bytecodes part. Ensure floats are in platform-order."
         | swapFloatWords |
         swapFloatWords := objectMemory vmEndianness ~= imageFloatsBigEndian.
         self assert: ClassFloatCompactIndex ~= 0.
         objectMemory allObjectsDo:
                 [:oop| | fmt wordAddr methodHeader temp |
                 fmt := objectMemory formatOf: oop.
                  fmt >= self firstByteFormat ifTrue: "oop contains bytes"
                         [wordAddr := oop + objectMemory baseHeaderSize.
                         fmt >= self firstCompiledMethodFormat ifTrue: "compiled method; start after methodHeader and literals"
                                 [methodHeader := self longAt: oop + objectMemory baseHeaderSize.
                                  wordAddr := wordAddr + (((objectMemory literalCountOfMethodHeader: methodHeader) + LiteralStart) * objectMemory bytesPerOop)].
                         objectMemory reverseBytesFrom: wordAddr to: oop + (objectMemory sizeBitsOf: oop)].
                  fmt = self firstLongFormat ifTrue: "Bitmap, Float etc"
                         [(swapFloatWords
                           and: [(objectMemory compactClassIndexOf: oop) = ClassFloatCompactIndex])
                                 ifTrue:
                                         [temp := self longAt: oop + objectMemory baseHeaderSize.
                                          self longAt: oop + objectMemory baseHeaderSize put: (self longAt: oop + objectMemory baseHeaderSize + 4).
                                          self longAt: oop + objectMemory baseHeaderSize + 4 put: temp]
                                 ifFalse:
+                                        [(objectMemory hasSpurMemoryManagerAPI not
+                                          and: [objectMemory wordSize = 8]) ifTrue: "Object contains 32-bit half-words packed into 64-bit machine words."
-                                        [objectMemory wordSize = 8 ifTrue: "Object contains 32-bit half-words packed into 64-bit machine words."
                                                 [wordAddr := oop + objectMemory baseHeaderSize.
                                                  objectMemory reverseWordsFrom: wordAddr to: oop + (objectMemory sizeBitsOf: oop)]]]]!



------------------------------

Message: 4
Date: Fri, 12 Dec 2014 01:26:36.921 0000
From: commits at source.squeak.org
Subject: [Vm-dev] VM Maker: VMMaker.oscog-eem.980.mcz
To: vm-dev at lists.squeakfoundation.org
Message-ID:
        <mailman.2.1418385633.10973.vm-dev at lists.squeakfoundation.org>

Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.980.mcz

==================== Summary ====================

Name: VMMaker.oscog-eem.980
Author: eem
Time: 11 December 2014, 5:25:43.82 pm
UUID: 3d7d339f-6a22-4bd1-b959-cddf9c41cc60
Ancestors: VMMaker.oscog-eem.979

And fix the regression in generateShiftLeft:on:indent:

=============== Diff against VMMaker.oscog-eem.979 ===============

Item was changed:
  ----- Method: CCodeGenerator>>generateShiftLeft:on:indent: (in category 'C translation') -----
  generateShiftLeft: msgNode on: aStream indent: level
         "Generate a C bitShift.  If we can determine the result
          would overflow the word size, cast to a long integer."
         | rcvr arg valueBeyondInt castToLong |
         rcvr := msgNode receiver.
         arg := msgNode args first.
+        valueBeyondInt := 1 bitShift: 32. "The default type of const << N is int."
-        valueBeyondInt := 1 bitShift: BytesPerWord * 4. "The default type of const << N is int."
         castToLong := false.
         rcvr constantNumbericValueOrNil ifNotNil:
                 [:rcvrVal|
                 arg constantNumbericValueOrNil ifNotNil:
                         [:argVal|
                          castToLong := rcvrVal < valueBeyondInt
                                                           and: [(rcvrVal bitShift: argVal) >= valueBeyondInt]]].
         castToLong
                 ifTrue:
                         [rcvr isConstant
                                 ifTrue:
                                         [self emitCExpression: rcvr on: aStream.
                                          aStream nextPutAll: 'LL']
                                 ifFalse:
                                         [aStream nextPutAll: '((unsigned long)'.
                                          self emitCExpression: rcvr on: aStream.
                                          aStream nextPut: $)]]
                 ifFalse:
                         [self emitCExpression: rcvr on: aStream].
         aStream nextPutAll: ' << '.
         self emitCExpression: arg on: aStream!



------------------------------

Message: 5
Date: Thu, 11 Dec 2014 23:25:06 -0500
From: "David T. Lewis" <lewis at mail.msen.com>
Subject: [Vm-dev] 32/64 bit VM and image combinations (was: egg
        sucking alert)
To: Squeak Virtual Machine Development Discussion
        <vm-dev at lists.squeakfoundation.org>
Message-ID: <20141212042506.GA3243 at shell.msen.com>
Content-Type: text/plain; charset=us-ascii

On Thu, Dec 11, 2014 at 10:30:41AM -0800, John McIntosh wrote:
>
> Recall at the time Apple didn't have 64bit support for a program to run
> under Cocoa, plus only a limited number of machines support 64 bit kernels.
> The fact you could go with a a 64 bit image on an 32bit machine allowed us
> to debug the base VM.
>
> I agree the 32/64 64/32 is nice and symmetric, but I'm afraid it's a nice
> to have versus need now. If it's not seamless to write software and plugins
> that honour that agreement, then it's a world of trouble and hassle that
> it's not worth pursuing further.

For the record, and possibly to offer some perspective:

Getting the VM to work for all combinations of 32/64 bit image and VM was
not any extra work at all. The hard part was getting the 64-bit VM with
32-bit image to work. Once the type declarations were cleaned up well enough
to support this, the rest came along for free.

The 64-bit VMs work fine, and I have been using them for a long time (several
years I guess). Linux users can find one at http://squeakvm.org/unix/.

The 64-bit VM with 32-bit image is a particularly important configuration,
because it involves 64-bit machine pointers and 32-bit ints. This combination
will quickly expose the majority of problems related to pointer and word sizes.
If you want to make a plugin 32/64 bit clean (and there are several remaining
to be tidied up), this configuration is essential.

Dave



------------------------------

Message: 6
Date: Thu, 11 Dec 2014 23:32:14 -0500
From: "David T. Lewis" <lewis at mail.msen.com>
Subject: [Vm-dev] 64-bit FFI (was: egg sucking alert)
To: Squeak Virtual Machine Development Discussion
        <vm-dev at lists.squeakfoundation.org>
Message-ID: <20141212043214.GB3243 at shell.msen.com>
Content-Type: text/plain; charset=us-ascii

On Thu, Dec 11, 2014 at 10:28:04AM -0800, Eliot Miranda wrote:
>
> On Thu, Dec 11, 2014 at 3:12 AM, Bert Freudenberg <bert at freudenbergs.de> wrote:
> >
> > On 11.12.2014, at 03:01, Eliot Miranda <eliot.miranda at gmail.com> wrote:
> >
> > There's an oddity of a 32-bit VM compiled in 64-bit mode on a 64-bit
> > machine.  I don't know of anyone using it.
> >
> Right.  But since the rationale for this VM is only to interface with
> 64-bit libraries, it depends on a 64-bit FFI, which we do not have.

I realize that this refers to the VMs and FFI implementations that are
actually available in released VMs, but just for the historical record:

A working 64-bit FFI has been available since 2008, but the patches were not
adopted. Source patches and issue status are here:

  http://bugs.squeak.org/view.php?id=7237

My intention had been to make this a top priority for the VM team circa 2009,
but other priorities took precedence.

Since then, the original FFI has been rendered obsolete by later development,
and as a practical matter there is no 64-bit FFI available today.

There were image side changes to the Mantis 7237 patches, and I'm not sure
if these will be relevant to Eliot's newer FFI implementation. I'll try
to look into this and report back if I find anything of interest.

Dave



------------------------------

Message: 7
Date: Fri, 12 Dec 2014 11:03:00 +0100
From: Stefan Marr <smalltalk at stefan-marr.de>
Subject: Re: [Vm-dev] egg sucking alert
To: Squeak Virtual Machine Development Discussion
        <vm-dev at lists.squeakfoundation.org>
Message-ID: <BEBAC3AD-5E96-4401-990F-D87B13699DD1 at stefan-marr.de>
Content-Type: text/plain; charset=us-ascii

Hi:

> On 11 Dec 2014, at 19:28, Eliot Miranda <eliot.miranda at gmail.com> wrote:
>
> Bollocks.  long is an integral type defined to be large enough to take a pointer.

Ignoring all the other issues in this thread, I would be very hesitant to take this statement as a general truth.
The last time I checked, the C standard defined only intptr_t and uintptr_t to be guaranteed to be a capable of holding pointers.

Best regards
Stefan

--
Stefan Marr
INRIA Lille - Nord Europe
http://stefan-marr.de/research/





------------------------------

_______________________________________________
Vm-dev mailing list
Vm-dev at lists.squeakfoundation.org
http://lists.squeakfoundation.org/mailman/listinfo/vm-dev


End of Vm-dev Digest, Vol 102, Issue 47
***************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.squeakfoundation.org/pipermail/vm-dev/attachments/20141212/f2b51d79/attachment-0001.htm


More information about the Vm-dev mailing list