VM Maker: VMMaker.oscog-nice.2732.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-nice.2732.mcz

Nicolas Cellier uploaded a new version of VMMaker to project VM Maker:

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

Name: VMMaker.oscog-nice.2732
Author: nice
Time: 24 March 2020, 12:40:36.561235 am
UUID: e0800e83-2731-9a4c-89f8-b7444f5e05d5
Ancestors: VMMaker.oscog-eem.2731

Fix bad bad copy/past error in generateSignedShiftRight:on:indent:

This broke B2DPlugin and probably other things (see senders of signedBitShift: and >>>)

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

Item was changed:
  ----- Method: CCodeGenerator>>generateSignedShiftRight:on:indent: (in category 'C translation') -----
  generateSignedShiftRight: msgNode on: aStream indent: level
  "Generate the C code for >>> onto the given stream."
  | type typeIsUnsigned mustCastToSigned signedType |
  type := self typeFor: msgNode receiver in: currentMethod.
  typeIsUnsigned := type first = $u.
  mustCastToSigned := typeIsUnsigned or:
  ["cast to sqInt if the int is shorter: we want to avoid UB related to a shift exceeeding bit width"
  (self sizeOfIntegralCType: type) < (self sizeOfIntegralCType: #usqInt)].
  ["If the variable is a 64-bit type then don't cast it to usqInt (typically a 32-bit type)"
  signedType := (self sizeOfIntegralCType: type) < (self sizeOfIntegralCType: #usqLong)
+ ifTrue: [#sqInt]
- ifTrue: [#usqInt]
  ifFalse: [self signedTypeForIntegralType: type].
  aStream nextPutAll: '(('; nextPutAll: signedType; nextPutAll: ')('.
  self emitCExpression: msgNode receiver on: aStream indent: level.
  aStream nextPutAll: '))']
  [aStream nextPutAll: '('.
  self emitCExpression: msgNode receiver on: aStream indent: level.
  aStream nextPut: $)].
  aStream nextPutAll: ' >> '.
  self emitCExpression: msgNode args first on: aStream!