Eliot Miranda uploaded a new version of VMMaker to project VM Maker: http://source.squeak.org/VMMaker/VMMaker.oscog-eem.3366.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.3366 Author: eem Time: 18 April 2024, 11:18:57.12491 am UUID: 791f24bd-c2cf-4601-b1a7-3fae30ee6c9b Ancestors: VMMaker.oscog-eem.3365
More concise implementation of FloatMathPlugin>>#primitiveLog10 (& nicer simulation).
Simulation fixes (from simulating a Cuis 5.0 image).
a) fix the simulation of setting primitiveDoMixedArithmetic & upscaleDisplayIfHighDPI, which can now be overridden on the command line. b) provide a default implementation of ioEventThreadAffinity for the threaded VM c) fix disassembly of jitted V3 methods d) fix simulation of the log: (log: 3) method; it forgot to return a result e) fix simulation of the JPEGReadWriter2Plugin, and the infinite recursion in its #sizeof: method (!!)
=============== Diff against VMMaker.oscog-eem.3365 ===============
Item was changed: ----- Method: CoInterpreter>>setImageHeaderFlagsFrom: (in category 'image save/restore') ----- setImageHeaderFlagsFrom: headerFlags "Set the flags that are contained in the 7th long of the image header. This is sent at image load time." imageHeaderFlags := headerFlags. "so as to preserve unrecognised flags." fullScreenFlag := headerFlags bitAnd: 1. imageFloatsBigEndian := (headerFlags noMask: 2) ifTrue: [1] ifFalse: [0]. "processHasThreadAffinity := headerFlags anyMask: 4. specific to CoInterpreterMT" flagInterpretedMethods := headerFlags anyMask: 8. preemptionYields := headerFlags noMask: 16. "noThreadingOfGUIThread := headerFlags anyMask: 32. specific to CoInterpreterMT" newFinalization := headerFlags anyMask: 64. sendWheelEvents := headerFlags anyMask: 128. + (self cCode: [primitiveDoMixedArithmetic < 0] + inSmalltalk: [primitiveDoMixedArithmetic isInteger and: [primitiveDoMixedArithmetic < 0]]) ifTrue: "i.e. has it not been set on the command line?" - primitiveDoMixedArithmetic < 0 ifTrue: "i.e. has it not been set on the command line?" [primitiveDoMixedArithmetic := headerFlags noMask: 256]. "N.B. flag mask 512 is responded to by the FilePlugin & FileAttributesPlugin" + (self cCode: [upscaleDisplayIfHighDPI < 0] + inSmalltalk: [upscaleDisplayIfHighDPI isInteger and: [upscaleDisplayIfHighDPI < 0]]) ifTrue: "i.e. has it not been set on the command line?" - upscaleDisplayIfHighDPI < 0 ifTrue: "i.e. has it not been set on the command line?" [upscaleDisplayIfHighDPI := headerFlags noMask: 1024]!
Item was added: + ----- Method: CoInterpreterMT>>ioEventThreadAffinity (in category 'threading support') ----- + ioEventThreadAffinity + "Default" + ^-1!
Item was changed: ----- Method: Cogit>>methodSelectorStringFor: (in category 'disassembly') ----- methodSelectorStringFor: cogMethod "Answer either the hex string or the selector for a method, if it has a valid selector. For full blocks, prepend ``[full address] '' to the selector." <doNotGenerate> + (cogMethod cmType > CMOpenPIC + and: [cogMethod cmIsFullBlock]) ifTrue: - cogMethod cmIsFullBlock ifTrue: [| rawString | rawString := String streamContents: [:s| s nextPutAll: '[full '. cogMethod asInteger printOn: s base: 16. "omits 16r prefix". s nextPut: $]]. (coInterpreter maybeSelectorOfMethod: cogMethod methodObject) ifNotNil: [:selector| (objectRepresentation couldBeObject: selector) ifTrue: [^rawString, ' ', (coInterpreter stringOf: selector)]]. ^rawString].
cogMethod selector = objectMemory nilObject ifTrue: [^cogMethod asInteger hex,'(nil sel)'].
(objectRepresentation couldBeObject: cogMethod selector) ifTrue: [^coInterpreter stringOf: cogMethod selector].
^cogMethod asInteger hex!
Item was changed: ----- Method: FloatMathPlugin>>primitiveLog10 (in category 'float primitives') ----- primitiveLog10 "Computes log10(receiver)" <export: true> <primitiveMetadata: #(FastCPrimitiveFlag FastCPrimitiveAlignForFloatsFlag)> | rcvr result | <var: #rcvr type: #double> <var: #result type: #double> rcvr := interpreterProxy stackFloatValue: 0. + interpreterProxy failed ifFalse: + [rcvr >= 0.0 ifTrue: + [result := self __ieee754_log10: rcvr. + (self isnan: result) ifFalse: + [^interpreterProxy methodReturnFloat: result]]]. + ^interpreterProxy primitiveFail! - interpreterProxy failed ifTrue:[^nil]. - rcvr < 0.0 ifTrue:[^interpreterProxy primitiveFail]. - result := self cCode: '__ieee754_log10(rcvr)' inSmalltalk: [rcvr log: 10]. - (self isnan: result) ifTrue:[^interpreterProxy primitiveFail]. - ^interpreterProxy methodReturnFloat: result!
Item was added: + ----- Method: FloatMathPluginSimulator>>__ieee754_log10: (in category 'float primitives') ----- + __ieee754_log10: aFloat + ^aFloat log: 10!
Item was changed: ----- Method: Integer>>coerceTo:sim: (in category '*VMMaker-interpreter simulator') ----- coerceTo: cTypeString sim: interpreter
| bits unitSize | cTypeString last == $* ifTrue: "C pointer" [unitSize := cTypeString caseOf: { [#'char *'] -> [1]. [#'short *'] -> [2]. [#'int *'] -> [4]. [#'long long *'] -> [8]. [#'float *'] -> [^CFloatArray basicNew interpreter: interpreter address: self unitSize: 4; yourself]. [#'double *'] -> [^CFloatArray basicNew interpreter: interpreter address: self unitSize: 8; yourself]. [#'unsigned *'] -> [4]. [#'unsigned int *'] -> [4]. [#'unsigned char *'] -> [1]. [#'signed char *'] -> [1]. [#'unsigned short *'] -> [2]. [#'unsigned long long *'] -> [8]. [#'oop *'] -> [interpreter objectMemory bytesPerOop]. } otherwise: [interpreter objectMemory wordSize]. ^CArray basicNew interpreter: interpreter address: self unitSize: unitSize; yourself]. cTypeString first == $u ifTrue: [bits := cTypeString caseOf: { [#usqInt] -> [interpreter objectMemory wordSize * 8]. [#usqLong] -> [64]. [#unsigned] -> [32]. [#'unsigned char'] -> [8]. [#'unsigned int'] -> [8]. [#'unsigned long'] -> [48]. "LLP64 on Windows :-(" [#'unsigned long long'] -> [64]. [#'unsigned short'] -> [16]. } otherwise: [self error: 'unknown unsigned integer type name']. ^self bitAnd: 1 << bits - 1]. bits := cTypeString caseOf: { [#sqInt] -> [interpreter objectMemory wordSize * 8]. [#'sqIntptr_t'] -> [interpreter objectMemory wordSize * 8]. [#sqLong] -> [64]. [#char] -> [^self bitAnd: 255]. "char may be signed, may be unsigned; interpret as unsigned by default" [#'signed char'] -> [8]. [#'short'] -> [16]. [#int] -> [32]. [#long] -> [48]. "LLP64 on Windows :-(" [#'long long'] -> [64]. [#'wint_t'] -> [24]. "unsigned short on Windows; int elsewhere" [#double] -> [^self asFloat]. } + otherwise: + ["exceptions for unusual cases..." + cTypeString == #'j_decompress_ptr' ifTrue: + [^self coerceTo: 'j_decompress *' sim: interpreter]. + "abort..." + self error: 'unknown signed integer type name']. - otherwise: [self error: 'unknown signed integer type name']. ^(self bitAnd: (1 bitShift: bits) - 1) - ((self bitAnd: (1 bitShift: bits - 1)) bitShift: 1)!
Item was changed: ----- Method: InterpreterPrimitives>>log: (in category 'primitive support') ----- log: aFloat "Simulate the C library log:(3) function." <doNotGenerate> + ^aFloat = aFloat - aFloat = aFloat ifTrue: [aFloat ln] ifFalse: [Float nan]!
Item was changed: ----- Method: JPEGReadWriter2Plugin>>sizeof: (in category 'simulation') ----- sizeof: aSymbol <doNotGenerate> ^aSymbol caseOf: { + [#'struct jpeg_compress_struct'] -> [JPEGReadWriter2 new primJPEGCompressStructSize]. + [#'struct jpeg_decompress_struct'] -> [JPEGReadWriter2 new primJPEGDecompressStructSize]. + [#'struct error_mgr2'] -> [JPEGReadWriter2 new primJPEGErrorMgr2StructSize] } - [self sizeof: #'struct jpeg_compress_struct'] -> [JPEGReadWriter2 new primJPEGCompressStructSize]. - [self sizeof: #'struct jpeg_decompress_struct'] -> [JPEGReadWriter2 new primJPEGDecompressStructSize]. - [self sizeof: #'struct error_mgr2'] -> [JPEGReadWriter2 new primJPEGErrorMgr2StructSize] } otherwise: [super sizeof: aSymbol]!
vm-dev@lists.squeakfoundation.org