VM Maker: VMMaker-dtl.354.mcz

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

VM Maker: VMMaker-dtl.354.mcz

commits-2
 
David T. Lewis uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker-dtl.354.mcz

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

Name: VMMaker-dtl.354
Author: dtl
Time: 24 October 2014, 8:35:45.512 am
UUID: a38a877b-1f44-40b9-9ee8-c812a471808c
Ancestors: VMMaker-bf.353

VMMaker 4.13.7

Fix bug in primitiveChangeClass exposed in the 64 bit 68002 image format.
Corrects failure in evaluating:

   Inspector new primitiveChangeClassTo: CompiledMethodInspector new

=============== Diff against VMMaker-bf.353 ===============

Item was changed:
  ----- Method: Interpreter>>changeClassOf:to: (in category 'object access primitives') -----
  changeClassOf: rcvr to: argClass
  "Change the class of the receiver into the class specified by the argument given that the format of the receiver matches the format of the argument. Fail if receiver or argument are SmallIntegers, or the receiver is an instance of a compact class and the argument isn't, or when the argument's class is compact and the receiver isn't, or when the format of the receiver is different from the format of the argument's class, or when the arguments class is fixed and the receiver's size differs from the size that an instance of the argument's class should have."
  | classHdr sizeHiBits byteSize argFormat rcvrFormat ccIndex |
  "Check what the format of the class says"
  classHdr := objectMemory formatOfClass: argClass. "Low 2 bits are 0"
 
  "Compute the size of instances of the class (used for fixed field classes only)"
  sizeHiBits := (classHdr bitAnd: 16r60000) >> 9.
  classHdr := classHdr bitAnd: 16r1FFFF.
  byteSize := (classHdr bitAnd: objectMemory sizeMask) + sizeHiBits. "size in bytes -- low 2 bits are 0"
 
  "Check the receiver's format against that of the class"
  argFormat := (classHdr >> 8) bitAnd: 16rF.
  rcvrFormat := objectMemory formatOf: rcvr.
  argFormat = rcvrFormat ifFalse:[^self primitiveFail]. "no way"
 
  "For fixed field classes, the sizes must match.
  Note: byteSize-4 because base header is included in class size."
+ argFormat < 2 ifTrue:[(byteSize - 4) = (objectMemory byteSizeOf: rcvr) ifFalse:[^self primitiveFail]].
- argFormat < 2 ifTrue:[(byteSize - objectMemory baseHeaderSize) = (objectMemory byteSizeOf: rcvr) ifFalse:[^self primitiveFail]].
 
  (objectMemory headerType: rcvr) = HeaderTypeShort
  ifTrue:[ "Compact classes. Check if the arg's class is compact and exchange ccIndex"
  ccIndex := classHdr bitAnd: CompactClassMask.
  ccIndex = 0 ifTrue:[^self primitiveFail]. "class is not compact"
  objectMemory longAt: rcvr put:
  (((objectMemory longAt: rcvr) bitAnd: CompactClassMask bitInvert32)
  bitOr: ccIndex)]
  ifFalse:["Exchange the class pointer, which could make rcvr a root for argClass"
  objectMemory longAt: rcvr - objectMemory baseHeaderSize put: (argClass bitOr: (objectMemory headerType: rcvr)).
  (objectMemory oop: rcvr isLessThan: objectMemory getYoungStart)
  ifTrue: [objectMemory possibleRootStoreInto: rcvr value: argClass]]!

Item was changed:
  ----- Method: VMMaker class>>versionString (in category 'version testing') -----
  versionString
 
  "VMMaker versionString"
 
+ ^'4.13.7'!
- ^'4.13.6'!

Reply | Threaded
Open this post in threaded view
|

Re: VM Maker: VMMaker-dtl.354.mcz

David T. Lewis
 
@Eliot,

This fix will not be relevant to Spur, so you may safely ignore it except
as an FYI.

Dave

>
> David T. Lewis uploaded a new version of VMMaker to project VM Maker:
> http://source.squeak.org/VMMaker/VMMaker-dtl.354.mcz
>
> ==================== Summary ====================
>
> Name: VMMaker-dtl.354
> Author: dtl
> Time: 24 October 2014, 8:35:45.512 am
> UUID: a38a877b-1f44-40b9-9ee8-c812a471808c
> Ancestors: VMMaker-bf.353
>
> VMMaker 4.13.7
>
> Fix bug in primitiveChangeClass exposed in the 64 bit 68002 image format.
> Corrects failure in evaluating:
>
>    Inspector new primitiveChangeClassTo: CompiledMethodInspector new
>
> =============== Diff against VMMaker-bf.353 ===============
>
> Item was changed:
>   ----- Method: Interpreter>>changeClassOf:to: (in category 'object access
> primitives') -----
>   changeClassOf: rcvr to: argClass
>   "Change the class of the receiver into the class specified by the
> argument given that the format of the receiver matches the format of
> the argument. Fail if receiver or argument are SmallIntegers, or the
> receiver is an instance of a compact class and the argument isn't, or
> when the argument's class is compact and the receiver isn't, or when
> the format of the receiver is different from the format of the
> argument's class, or when the arguments class is fixed and the
> receiver's size differs from the size that an instance of the
> argument's class should have."
>   | classHdr sizeHiBits byteSize argFormat rcvrFormat ccIndex |
>   "Check what the format of the class says"
>   classHdr := objectMemory formatOfClass: argClass. "Low 2 bits are 0"
>
>   "Compute the size of instances of the class (used for fixed field
> classes only)"
>   sizeHiBits := (classHdr bitAnd: 16r60000) >> 9.
>   classHdr := classHdr bitAnd: 16r1FFFF.
>   byteSize := (classHdr bitAnd: objectMemory sizeMask) + sizeHiBits.
> "size in bytes -- low 2 bits are 0"
>
>   "Check the receiver's format against that of the class"
>   argFormat := (classHdr >> 8) bitAnd: 16rF.
>   rcvrFormat := objectMemory formatOf: rcvr.
>   argFormat = rcvrFormat ifFalse:[^self primitiveFail]. "no way"
>
>   "For fixed field classes, the sizes must match.
>   Note: byteSize-4 because base header is included in class size."
> + argFormat < 2 ifTrue:[(byteSize - 4) = (objectMemory byteSizeOf: rcvr)
> ifFalse:[^self primitiveFail]].
> - argFormat < 2 ifTrue:[(byteSize - objectMemory baseHeaderSize) =
> (objectMemory byteSizeOf: rcvr) ifFalse:[^self primitiveFail]].
>
>   (objectMemory headerType: rcvr) = HeaderTypeShort
>   ifTrue:[ "Compact classes. Check if the arg's class is compact and
> exchange ccIndex"
>   ccIndex := classHdr bitAnd: CompactClassMask.
>   ccIndex = 0 ifTrue:[^self primitiveFail]. "class is not compact"
>   objectMemory longAt: rcvr put:
>   (((objectMemory longAt: rcvr) bitAnd: CompactClassMask bitInvert32)
>   bitOr: ccIndex)]
>   ifFalse:["Exchange the class pointer, which could make rcvr a root for
> argClass"
>   objectMemory longAt: rcvr - objectMemory baseHeaderSize put:
> (argClass bitOr: (objectMemory headerType: rcvr)).
>   (objectMemory oop: rcvr isLessThan: objectMemory getYoungStart)
>   ifTrue: [objectMemory possibleRootStoreInto: rcvr value: argClass]]!
>
> Item was changed:
>   ----- Method: VMMaker class>>versionString (in category 'version
> testing') -----
>   versionString
>
>   "VMMaker versionString"
>
> + ^'4.13.7'!
> - ^'4.13.6'!
>