VM Maker: VMMaker.oscog-eem.2829.mcz

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

VM Maker: VMMaker.oscog-eem.2829.mcz

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

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

Name: VMMaker.oscog-eem.2829
Author: eem
Time: 27 September 2020, 4:12:26.359235 pm
UUID: c7c0e1c1-5042-4a9f-b76b-6410d8465651
Ancestors: VMMaker.oscog-eem.2828

Alien/IA32ABIPlugin: Fix a slip in primAlienCopyInto.  myLenght can be egative; compare against its abs.

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

Item was changed:
  ----- Method: IA32ABIPlugin>>primAlienCopyInto (in category 'primitives-accessing') -----
  primAlienCopyInto
  "Copy some number of bytes from the receiver starting at the first index into some destination
  object starting at the second index.  The  destination may be an Aliens or a bit-indexable object.
  The primitive will have the following signature:
  <Alien>
  primCopyFrom: start <Integer>
  to: stop <Integer>
  into: destination <Alien | indexableByteSubclass et al>
  startingAt: destStart <Integer> ^<self>
  <primitive: 'primitiveAlienReplace' error: errorCode module: 'IA32ABI'>
  "
  <export: true>
  | alien start stop dest destStart src totalLength destAddr myLength |
  alien := interpreterProxy stackValue: 4.  "Unchecked!!"
  start := interpreterProxy stackIntegerValue: 3.
  stop := interpreterProxy stackIntegerValue: 2.
  dest := interpreterProxy stackValue: 1.
  destStart := interpreterProxy stackIntegerValue: 0.
 
  (interpreterProxy failed
  or: [(interpreterProxy isWordsOrBytes: dest) not]) ifTrue:
  [^interpreterProxy primitiveFailFor: PrimErrBadArgument].
 
  myLength := self sizeField: alien.
  src := (self startOfData: dest withSize: myLength) + start - 1.
 
  (self isAlien: dest)
  ifTrue:
  [totalLength := self sizeField: dest.
  destAddr := (self startOfData: dest withSize: totalLength) + start - 1.
  totalLength = 0 "no bounds checks for zero-sized (pointer) Aliens"
  ifTrue: [totalLength := stop]
  ifFalse: [totalLength := totalLength abs]]
  ifFalse:
  [totalLength := interpreterProxy byteSizeOf: dest.
  destAddr := (self startOfByteData: dest) + start - 1].
 
+ ((start >= 1 and: [start - 1 <= stop and: [stop <= myLength abs]])
- ((start >= 1 and: [start - 1 <= stop and: [stop <= myLength]])
  and: [stop - start + 1 <= totalLength]) ifFalse:
  [^interpreterProxy primitiveFailFor: PrimErrBadIndex].
 
  (interpreterProxy isOopImmutable: dest) ifTrue:
  [^interpreterProxy primitiveFailFor: PrimErrNoModification].
 
  "Use memmove to allow source and desition to overlap"
  self memmove: destAddr asVoidPointer _: src asVoidPointer _: stop - start + 1.
 
  interpreterProxy methodReturnReceiver!