[Vm-dev] VM Maker: VMMaker.oscog-AlistairGrant.2426.mcz
commits at source.squeak.org
commits at source.squeak.org
Mon Aug 13 09:42:18 UTC 2018
Alistair Grant uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-AlistairGrant.2426.mcz
==================== Summary ====================
Name: VMMaker.oscog-AlistairGrant.2426
Author: AlistairGrant
Time: 9 August 2018, 11:19:34.875976 pm
UUID: f47080d3-d374-4ae7-a639-8eb41af95f0e
Ancestors: VMMaker.oscog-cb.2425
274: primitiveFileStdioHandles() fails to return nil if stdio file is not available
Modify FilePlugin>>primitiveFileStdioHandles to treat validMask = 0 as successfully determining that no stdio streams are available.
Previously validMask = 0 would result in the primitive failing with Unsupported. However having no stdio streams available is normal on Windows, and so shouldn't signal an error.
sqFileStdioHandlesInto() can either return -1 to signal an unspecified error or use primitiveFailFor() or primitiveFailForOSError() to specify an error.
=============== Diff against VMMaker.oscog-cb.2425 ===============
Item was changed:
----- Method: FilePlugin>>primitiveFileStdioHandles (in category 'file primitives') -----
primitiveFileStdioHandles
"Answer an Array of file handles for standard in, standard out and standard error,
with nil in entries that are unvailable, e.g. because the platform does not provide
standard error, etc. Fail if there are no standard i/o facilities on the platform or
if the security plugin denies access or if memory runs out."
| fileRecords result validMask |
<export: true>
<var: 'fileRecords' declareC: 'SQFile fileRecords[3]'>
sHFAfn ~= 0 ifTrue:
[(self cCode: ' ((sqInt (*)(void))sHFAfn)()' inSmalltalk: [true]) ifFalse:
[^interpreterProxy primitiveFailFor: PrimErrUnsupported]].
self cCode: '' inSmalltalk: [fileRecords := Array new: 3].
validMask := self sqFileStdioHandlesInto: fileRecords.
+ validMask = -1 ifTrue:
+ [^interpreterProxy primitiveFail].
- validMask = 0 ifTrue:
- [^interpreterProxy primitiveFailFor: PrimErrUnsupported].
result := interpreterProxy instantiateClass: interpreterProxy classArray indexableSize: 3.
result = nil ifTrue:
[^interpreterProxy primitiveFailFor: PrimErrNoMemory].
interpreterProxy pushRemappableOop: result.
0 to: 2 do:
[:index|
(validMask bitAnd: (1 << index)) ~= 0 ifTrue:
[result := interpreterProxy instantiateClass: interpreterProxy classByteArray indexableSize: self fileRecordSize.
result = nil ifTrue:
[interpreterProxy popRemappableOop.
^interpreterProxy primitiveFailFor: PrimErrNoMemory].
interpreterProxy storePointer: index ofObject: interpreterProxy topRemappableOop withValue: result.
self
cCode:
[self mem: (interpreterProxy firstIndexableField: result)
cp: (self addressOf: (fileRecords at: index))
y: self fileRecordSize]
inSmalltalk:
[(interpreterProxy firstIndexableField: result)
unitSize: interpreterProxy wordSize;
at: 0 put: (fileRecords at: index + 1)]]].
"In the non-Spur threaded VM ensure the handles are old, so that sqFileReadIntoAt is unaffected
by incremental GCs. See platforms/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c. The Spur
VM uses pinning, so it doesn't need the GC."
self cppIf: COGMTVM
ifTrue: [self cppIf: SPURVM
ifTrue: []
ifFalse: [interpreterProxy fullGC]].
result := interpreterProxy popRemappableOop.
interpreterProxy methodReturnValue: result!
More information about the Vm-dev
mailing list