VM Maker: VMMaker.oscog-eem.2797.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.2797.mcz

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

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

Name: VMMaker.oscog-eem.2797
Author: eem
Time: 30 August 2020, 6:17:59.909283 pm
UUID: 84f54ca7-0a17-408a-9fc5-fb30a1ac6c6f
Ancestors: VMMaker.oscog-eem.2796

Plugins: Squash a few C compiler warnings

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

Item was changed:
  ----- Method: DeflatePlugin>>sendBlock:with:with:with: (in category 'encoding') -----
  sendBlock: literalStream with: distanceStream with: litTree with: distTree
  "Require:
  zipCollection, zipCollectionSize, zipPosition,
  zipBitBuf, zipBitPos.
  "
  | oop litPos litLimit litArray distArray lit dist sum llBitLengths llCodes distBitLengths distCodes code extra litBlCount distBlCount |
+ <var: #dist type: #sqInt> "must be signed"
  <var: #litArray type: #'unsigned char *'>
  <var: #distArray type: #'unsigned int *'>
  <var: #llBitLengths type: #'unsigned int *'>
  <var: #llCodes type: #'unsigned int *'>
  <var: #distBitLengths type: #'unsigned int *'>
  <var: #distCodes type: #'unsigned int *'>
  oop := interpreterProxy fetchPointer: 0 ofObject: literalStream.
  litPos := interpreterProxy fetchInteger: 1 ofObject: literalStream.
  litLimit := interpreterProxy fetchInteger: 2 ofObject: literalStream.
  (litPos <= litLimit
  and: [(interpreterProxy isBytes: oop)
  and: [litLimit <= (interpreterProxy byteSizeOf: oop)]]) ifFalse:
  [^interpreterProxy primitiveFail].
  litArray := interpreterProxy firstIndexableField: oop.
 
  oop := interpreterProxy fetchPointer: 0 ofObject: distanceStream.
  ((interpreterProxy isWords: oop)
  and: [litLimit <= (interpreterProxy slotSizeOf: oop)
  and: [(interpreterProxy fetchInteger: 1 ofObject: distanceStream) = litPos
  and: [(interpreterProxy fetchInteger: 2 ofObject: distanceStream) = litLimit]]]) ifFalse:
  [^interpreterProxy primitiveFail].
  distArray := interpreterProxy firstIndexableField: oop.
 
  oop := interpreterProxy fetchPointer: 0 ofObject: litTree.
  (interpreterProxy isWords: oop) ifFalse:
  [^interpreterProxy primitiveFail].
  litBlCount := interpreterProxy slotSizeOf: oop.
  llBitLengths := interpreterProxy firstIndexableField: oop.
 
  oop := interpreterProxy fetchPointer: 1 ofObject: litTree.
  ((interpreterProxy isWords: oop)
  and: [litBlCount = (interpreterProxy slotSizeOf: oop)]) ifFalse:
  [^interpreterProxy primitiveFail].
  llCodes := interpreterProxy firstIndexableField: oop.
 
  oop := interpreterProxy fetchPointer: 0 ofObject: distTree.
  (interpreterProxy isWords: oop) ifFalse:
  [^interpreterProxy primitiveFail].
  distBlCount := interpreterProxy slotSizeOf: oop.
  distBitLengths := interpreterProxy firstIndexableField: oop.
 
  oop := interpreterProxy fetchPointer: 1 ofObject: distTree.
  ((interpreterProxy isWords: oop)
  and: [distBlCount = (interpreterProxy slotSizeOf: oop)]) ifFalse:
  [^interpreterProxy primitiveFail].
  distCodes := interpreterProxy firstIndexableField: oop.
 
  self nextZipBits: 0 put: 0. "Flush pending bits if necessary"
  sum := 0.
  [litPos < litLimit and:[zipPosition + 4 < zipCollectionSize]] whileTrue:[
  lit := litArray at: litPos.
  dist := distArray at: litPos.
  litPos := litPos + 1.
  dist = 0 ifTrue:["literal"
  sum := sum + 1.
  lit < litBlCount ifFalse:[^interpreterProxy primitiveFail].
  self nextZipBits: (llBitLengths at: lit) put: (llCodes at: lit).
  ] ifFalse:["match"
  sum := sum + lit + DeflateMinMatch.
+ "eem 8/30/2020 Can't happen; litArray has type unsigned char *, lit unsigned char. Leaving this in causes a C compiler warning."
+ false ifTrue: [lit < 256 ifFalse:[^interpreterProxy primitiveFail]].
- lit < 256 ifFalse:[^interpreterProxy primitiveFail].
  code := zipMatchLengthCodes at: lit.
  code < litBlCount ifFalse:[^interpreterProxy primitiveFail].
  self nextZipBits: (llBitLengths at: code) put: (llCodes at: code).
  extra := zipExtraLengthBits at: code - 257.
  extra = 0 ifFalse:[
  lit := lit - (zipBaseLength at: code - 257).
  self nextZipBits: extra put: lit].
  dist := dist - 1.
  dist < 16r8000 ifFalse:[^interpreterProxy primitiveFail].
  dist < 256
  ifTrue:[code := zipDistanceCodes at: dist]
  ifFalse:[code := zipDistanceCodes at: 256 + (dist >> 7)].
  code < distBlCount ifFalse:[^interpreterProxy primitiveFail].
  self nextZipBits: (distBitLengths at: code) put: (distCodes at: code).
  extra := zipExtraDistanceBits at: code.
  extra = 0 ifFalse:[
  dist := dist - (zipBaseDistance at: code).
  self nextZipBits: extra put: dist].
  ].
  ].
  interpreterProxy failed ifTrue:[^nil].
  interpreterProxy storeInteger: 1 ofObject: literalStream withValue: litPos.
  interpreterProxy storeInteger: 1 ofObject: distanceStream withValue: litPos.
  ^sum!

Item was changed:
  ----- Method: SocketPlugin>>netAddressToInt: (in category 'primitives') -----
  netAddressToInt: ptrToByteArray
  "Convert the given internet network address (represented as a four-byte ByteArray) into a 32-bit integer. Fail if the given ptrToByteArray does not appear to point to a four-byte ByteArray."
 
+ <var: #ptrToByteArray type: #'unsigned char *'>
  | sz |
+ <inline: #always>
- <var: #ptrToByteArray type: 'unsigned char * '>
  sz := interpreterProxy byteSizeOf: ptrToByteArray cPtrAsOop.
+ sz = 4 ifFalse: [^interpreterProxy primitiveFail].
- sz = 4 ifFalse: [^ interpreterProxy primitiveFail].
  ^ (ptrToByteArray at: 3 ) +
  ((ptrToByteArray at: 2) <<8) +
  ((ptrToByteArray at: 1) <<16) +
  ((ptrToByteArray at: 0) <<24)!

Item was changed:
  ----- Method: SocketPlugin>>socketRecordSize (in category 'primitives') -----
  socketRecordSize
+ "Answer the size of a Smalltalk socket record in bytes."
+ <inline: #always>
+ ^self sizeof: #SQSocket!
- "Return the size of a Smalltalk socket record in bytes."
- <inline: true>
- ^ self sizeof: #SQSocket!

Item was changed:
  ----- Method: SocketPlugin>>socketValueOf: (in category 'primitives') -----
  socketValueOf: socketOop
  "Answer a pointer to the first byte of of the socket record within the  
  given Smalltalk object, or nil if socketOop is not a socket record."
  <returnTypeC: #SocketPtr>
+ <inline: #always>
  ^((interpreterProxy isBytes: socketOop)
    and: [(interpreterProxy byteSizeOf: socketOop) = self socketRecordSize])
  ifTrue: [self cCoerce: (interpreterProxy firstIndexableField: socketOop) to: #SocketPtr]
  ifFalse: [interpreterProxy primitiveFailFor: PrimErrBadArgument. nil]!