[Vm-dev] VM Maker: VMMaker-dtl.318.mcz
commits at source.squeak.org
commits at source.squeak.org
Sat Apr 13 17:08:36 UTC 2013
David T. Lewis uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker-dtl.318.mcz
==================== Summary ====================
Name: VMMaker-dtl.318
Author: dtl
Time: 13 April 2013, 1:07:29.739 pm
UUID: c46ff41d-870f-4bb1-b9b5-7b0064fc860c
Ancestors: VMMaker-dtl.317
VMMaker 4.12.2
SocketPlugin fixes from VMMaker.oscog-eem.284
=============== Diff against VMMaker-dtl.317 ===============
Item was changed:
----- Method: SocketPlugin>>primitiveSocket:getOptions: (in category 'primitives') -----
primitiveSocket: socket getOptions: optionName
| s optionNameStart optionNameSize returnedValue errorCode results |
+ <var: #s type: #SocketPtr>
+ <var: #optionNameStart type: #'char *'>
- <var: #s type: 'SocketPtr'>
- <var: #optionNameStart type: 'char *'>
self primitive: 'primitiveSocketGetOptions'
parameters: #(Oop Oop).
s := self socketValueOf: socket.
interpreterProxy success: (interpreterProxy isBytes: optionName).
+ optionNameStart := self cCoerce: (interpreterProxy firstIndexableField: optionName) to: #'char *'.
- optionNameStart := self cCoerce: (interpreterProxy firstIndexableField: optionName) to: 'char *'.
optionNameSize := interpreterProxy slotSizeOf: optionName.
interpreterProxy failed ifTrue: [^nil].
returnedValue := 0.
errorCode := self sqSocketGetOptions: s
+ optionNameStart: optionNameStart
+ optionNameSize: optionNameSize
+ returnedValue: (self addressOf: returnedValue).
- optionNameStart: optionNameStart
- optionNameSize: optionNameSize
- returnedValue: (self cCode: '&returnedValue').
+ results := interpreterProxy instantiateClass: interpreterProxy classArray indexableSize: 2.
+ interpreterProxy storePointer: 0 ofObject: results withValue: errorCode asSmallIntegerObj.
+ interpreterProxy storePointer: 1 ofObject: results withValue: returnedValue asSmallIntegerObj.
- interpreterProxy pushRemappableOop: returnedValue asSmallIntegerObj.
- interpreterProxy pushRemappableOop: errorCode asSmallIntegerObj.
- interpreterProxy pushRemappableOop: (interpreterProxy instantiateClass: (interpreterProxy classArray) indexableSize: 2).
- results := interpreterProxy popRemappableOop.
- interpreterProxy storePointer: 0 ofObject: results withValue: interpreterProxy popRemappableOop.
- interpreterProxy storePointer: 1 ofObject: results withValue: interpreterProxy popRemappableOop.
^ results!
Item was changed:
----- Method: SocketPlugin>>primitiveSocket:receiveUDPDataBuf:start:count: (in category 'primitives') -----
primitiveSocket: socket receiveUDPDataBuf: array start: startIndex count: count
+ | s elementSize arrayBase bufStart bytesReceived results address port moreFlag |
+ <var: #s type: #SocketPtr>
+ <var: #arrayBase type: #'char *'>
+ <var: #bufStart type: #'char *'>
- | s byteSize arrayBase bufStart bytesReceived results address port moreFlag |
- <var: #s type: 'SocketPtr'>
- <var: #arrayBase type: 'char *'>
- <var: #bufStart type: 'char *'>
self primitive: 'primitiveSocketReceiveUDPDataBufCount'
+ parameters: #(Oop Oop SmallInteger SmallInteger).
- parameters: #(Oop Oop SmallInteger SmallInteger ).
s := self socketValueOf: socket.
"buffer can be any indexable words or bytes object"
interpreterProxy success: (interpreterProxy isWordsOrBytes: array).
(interpreterProxy isWords: array)
+ ifTrue: [elementSize := 4]
+ ifFalse: [elementSize := 1].
- ifTrue: [byteSize := 4]
- ifFalse: [byteSize := 1].
interpreterProxy success: (startIndex >= 1
and: [count >= 0 and: [startIndex + count - 1 <= (interpreterProxy slotSizeOf: array)]]).
interpreterProxy failed
ifFalse: ["Note: adjust bufStart for zero-origin indexing"
+ arrayBase := self cCoerce: (interpreterProxy firstIndexableField: array) to: #'char *'.
+ bufStart := arrayBase + (startIndex - 1 * elementSize).
+ address := 0.
+ port := 0.
+ moreFlag := 0.
+ bytesReceived := self sqSocket: s
+ ReceiveUDPDataBuf: bufStart
+ Count: count * elementSize
+ address: (self addressOf: address)
+ port: (self addressOf: port)
+ moreFlag: (self addressOf: moreFlag).
+
- arrayBase := self cCoerce: (interpreterProxy firstIndexableField: array) to: 'char *'.
- bufStart := arrayBase + (startIndex - 1 * byteSize).
"allocate storage for results, remapping newly allocated
oops in case GC happens during allocation"
- address := 0.
- port := 0.
- moreFlag := 0.
- bytesReceived := self
- sqSocket: s
- ReceiveUDPDataBuf: bufStart
- Count: count * byteSize
- address: (self cCode: '&address')
- port: (self cCode: '&port')
- moreFlag: (self cCode: '&moreFlag').
-
- interpreterProxy pushRemappableOop: port asSmallIntegerObj.
interpreterProxy pushRemappableOop: (self intToNetAddress: address).
+ results := interpreterProxy instantiateClass: interpreterProxy classArray indexableSize: 4.
+ interpreterProxy storePointer: 0 ofObject: results withValue: (bytesReceived // elementSize) asSmallIntegerObj.
- interpreterProxy pushRemappableOop: (bytesReceived // byteSize) asSmallIntegerObj.
- interpreterProxy pushRemappableOop:
- (interpreterProxy instantiateClass: (interpreterProxy classArray) indexableSize: 4).
- results := interpreterProxy popRemappableOop.
- interpreterProxy storePointer: 0 ofObject: results withValue: interpreterProxy popRemappableOop.
interpreterProxy storePointer: 1 ofObject: results withValue: interpreterProxy popRemappableOop.
+ interpreterProxy storePointer: 2 ofObject: results withValue: port asSmallIntegerObj.
+ interpreterProxy storePointer: 3 ofObject: results withValue: (moreFlag
+ ifTrue: [interpreterProxy trueObject]
+ ifFalse: [interpreterProxy falseObject]).
- interpreterProxy storePointer: 2 ofObject: results withValue: interpreterProxy popRemappableOop.
- moreFlag
- ifTrue: [ interpreterProxy storePointer: 3 ofObject: results withValue: interpreterProxy trueObject ]
- ifFalse: [ interpreterProxy storePointer: 3 ofObject: results withValue: interpreterProxy falseObject ].
].
^ results!
Item was changed:
----- Method: SocketPlugin>>primitiveSocket:setOptions:value: (in category 'primitives') -----
primitiveSocket: socket setOptions: optionName value: optionValue
+ "THIS BADLY NEEDS TO BE REWRITTEN TO TAKE Booleans AND Integers AS WELL AS (OR INSTEAD OF) Strings.
+ It is only used with booleans and integers and parsing these back out of strings in
+ sqSocketSetOptions:optionNameStart:optionNameSize:optionValueStart:optionValueSize:returnedValue:
+ is STUPID."
-
| s optionNameStart optionNameSize optionValueStart optionValueSize returnedValue errorCode results |
+ <var: #s type: #SocketPtr>
+ <var: #optionNameStart type: #'char *'>
+ <var: #optionValueStart type: #'char *'>
- <var: #s type: 'SocketPtr'>
- <var: #optionNameStart type: 'char *'>
- <var: #optionValueStart type: 'char *'>
self primitive: 'primitiveSocketSetOptions'
parameters: #(Oop Oop Oop).
s := self socketValueOf: socket.
interpreterProxy success: (interpreterProxy isBytes: optionName).
+ optionNameStart := self cCoerce: (interpreterProxy firstIndexableField: optionName) to: #'char *'.
- optionNameStart := self cCoerce: (interpreterProxy firstIndexableField: optionName) to: 'char *'.
optionNameSize := interpreterProxy slotSizeOf: optionName.
interpreterProxy success: (interpreterProxy isBytes: optionValue).
+ optionValueStart:= self cCoerce: (interpreterProxy firstIndexableField: optionValue) to: #'char *'.
- optionValueStart:= self cCoerce: (interpreterProxy firstIndexableField: optionValue) to: 'char *'.
optionValueSize := interpreterProxy slotSizeOf: optionValue.
interpreterProxy failed ifTrue: [^nil].
returnedValue := 0.
errorCode := self sqSocketSetOptions: s
+ optionNameStart: optionNameStart
+ optionNameSize: optionNameSize
+ optionValueStart: optionValueStart
+ optionValueSize: optionValueSize
+ returnedValue: (self addressOf: returnedValue).
- optionNameStart: optionNameStart
- optionNameSize: optionNameSize
- optionValueStart: optionValueStart
- optionValueSize: optionValueSize
- returnedValue: (self cCode: '&returnedValue').
+ results := interpreterProxy instantiateClass: interpreterProxy classArray indexableSize: 2.
+ interpreterProxy storePointer: 0 ofObject: results withValue: errorCode asSmallIntegerObj.
+ interpreterProxy storePointer: 1 ofObject: results withValue: returnedValue asSmallIntegerObj.
- interpreterProxy pushRemappableOop: returnedValue asSmallIntegerObj.
- interpreterProxy pushRemappableOop: errorCode asSmallIntegerObj.
- interpreterProxy pushRemappableOop: (interpreterProxy instantiateClass: (interpreterProxy classArray) indexableSize: 2).
- results := interpreterProxy popRemappableOop.
- interpreterProxy storePointer: 0 ofObject: results withValue: interpreterProxy popRemappableOop.
- interpreterProxy storePointer: 1 ofObject: results withValue: interpreterProxy popRemappableOop.
^ results!
Item was changed:
----- Method: VMMaker class>>versionString (in category 'version testing') -----
versionString
"VMMaker versionString"
+ ^'4.12.2'!
- ^'4.12.1'!
More information about the Vm-dev
mailing list