[Vm-dev] VM Maker: VMMaker.oscog-eem.2529.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Mar 13 18:54:43 UTC 2019
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.2529.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.2529
Author: eem
Time: 13 March 2019, 11:54:28.516707 am
UUID: 0f0801c0-ef39-4573-ad13-b3e08bc86f12
Ancestors: VMMaker.oscog-eem.2528
Slang: Fix bug in dead-code elimination. In checking whether a name is defined at compile-time or not we have to deal with both TDefineNode and TVarableNode, and so must use nameOrValue, not just value. This affects finalizeReference: which was having variables used in a "cppIf: PharoVM ifTrue: ..." arm deleted since the code generator incorresctly assessed the arm as dead code.
=============== Diff against VMMaker.oscog-eem.2527 ===============
Item was changed:
----- Method: CCodeGenerator>>nilOrBooleanConditionFor: (in category 'utilities') -----
nilOrBooleanConditionFor: nodeOrNil
"If nodeOrNil is one of the conditional sends for which we do translation-time dead code elimination
(i.e. cppIf:ifTrue: et al or ifTrue: et al) and the conditional does evaluate to a translation-time
boolean constant, answer that constant, otherwise answer nil. Used to prune dead code,
either for code generaton or dead variable elimination."
generateDeadCode ifTrue: [^nil].
nodeOrNil ifNil:
[^nil].
nodeOrNil isSend ifFalse:
[^nil].
(#(ifTrue: ifFalse: ifTrue:ifFalse: ifFalse:ifTrue:) includes: nodeOrNil selector) ifTrue:
[^self nilOrBooleanConstantReceiverOf: nodeOrNil receiver].
(#(and: or:) includes: nodeOrNil selector) ifTrue:
[^self nilOrBooleanConstantReceiverOf: nodeOrNil].
(#(cppIf:ifTrue: cppIf:ifTrue:ifFalse:) includes: nodeOrNil selector) ifTrue:
+ [| maybeName |
+ maybeName := nodeOrNil args first isConstant ifTrue:
+ [nodeOrNil args first nameOrValue].
+ (vmClass notNil
- [(vmClass notNil
and: [nodeOrNil args first isConstant
+ and: [maybeName isSymbol
+ and: [(vmClass defineAtCompileTime: maybeName) not
+ and: [(vmClass bindingOf: maybeName) notNil]]]]) ifTrue:
- and: [nodeOrNil args first value isSymbol
- and: [((vmClass ifNil: [VMBasicConstants]) defineAtCompileTime: nodeOrNil args first value) not
- and: [(vmClass bindingOf: nodeOrNil args first value) notNil]]]]) ifTrue:
[self logger
nextPutAll: 'Warning: cppIf: reference to ';
+ store: maybeName;
- store: nodeOrNil args first value;
nextPutAll: ' when variable of same name exists.'; cr].
+ (optionsDictionary notNil
- ^(optionsDictionary notNil
and: [nodeOrNil args first isConstant
+ and: [(#(true false) includes: (optionsDictionary at: maybeName ifAbsent: [nil]))
+ and: [((vmClass ifNil: [VMBasicConstants]) defineAtCompileTime: maybeName) not]]]) ifTrue:
+ [^optionsDictionary at: maybeName]].
- and: [#(true false) includes: (optionsDictionary at: nodeOrNil args first name ifAbsent: [nil])]]) ifTrue:
- [optionsDictionary at: nodeOrNil args first name]].
^nil!
Item was changed:
----- Method: InterpreterPrimitives>>primitiveSmallFloatTruncated (in category 'arithmetic float primitives') -----
primitiveSmallFloatTruncated
<option: #Spur64BitMemoryManager>
| rcvr trunc |
<var: #rcvr type: #double>
<var: #trunc type: #double>
rcvr := objectMemory smallFloatValueOf: self stackTop.
self cCode: [self mod: rcvr f: (self addressOf: trunc)]
inSmalltalk: [trunc := rcvr truncated].
+ ((trunc between: objectMemory minSmallInteger asFloat and: objectMemory maxSmallInteger asFloat)
+ and: [objectMemory isIntegerValue: trunc asInteger])
- (trunc between: objectMemory minSmallInteger asFloat and: objectMemory maxSmallInteger asFloat)
ifTrue: [self stackTopPut: (objectMemory integerObjectOf: trunc asInteger)]
ifFalse: [self primitiveFail]!
More information about the Vm-dev
mailing list