[Vm-dev] VM Maker: VMMaker.oscog-eem.319.mcz
commits at source.squeak.org
commits at source.squeak.org
Wed Aug 14 18:45:30 UTC 2013
Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.319.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.319
Author: eem
Time: 14 August 2013, 11:42:37.906 am
UUID: 2f166f6b-54bc-4eba-b688-182c0d0fff11
Ancestors: VMMaker.oscog-eem.318
Avoid compiling frameless methods with stack depth > 1. This is a
crude way of avoiding the spilling issues in e.g.
TextColor>>#dominates: other
^ other class == self class
Better way to follow.
=============== Diff against VMMaker.oscog-eem.318 ===============
Item was changed:
----- Method: SistaStackToRegisterMappingCogit>>scanMethod (in category 'compile abstract instructions') -----
scanMethod
"Scan the method to determine
- what the last bytecode is; extra bytes at the end of a method are used to encode things like source pointers or temp names
- if the method needs a frame or not
- what are the targets of any backward branches.
- how many blocks it creates
- how many counters it needs/conditional branches it contains
Answer the block count or on error a negative error code"
+ | latestContinuation nExts descriptor pc numBlocks distance targetPC stackDelta |
- | latestContinuation nExts descriptor pc numBlocks distance targetPC |
<var: #descriptor type: #'BytecodeDescriptor *'>
needsFrame := false.
numCounters := 0.
(primitiveIndex > 0
and: [coInterpreter isQuickPrimitiveIndex: primitiveIndex]) ifTrue:
[^0].
numBlocks := 0.
pc := latestContinuation := initialPC.
nExts := 0.
+ stackDelta := 0.
[pc <= endPC] whileTrue:
[byte0 := (objectMemory fetchByte: pc ofObject: methodObj) + bytecodeSetOffset.
descriptor := self generatorAt: byte0.
(descriptor isReturn
and: [pc >= latestContinuation]) ifTrue:
[endPC := pc].
+ needsFrame ifFalse:
+ [(descriptor needsFrameFunction isNil
+ or: [self perform: descriptor needsFrameFunction with: true])
+ ifTrue:
+ [needsFrame := true]
+ ifFalse: "avoid spilling in frameless methods by not compiling frameless
+ anything with a stack deeper than a single push."
+ [needsFrame := (stackDelta := stackDelta + descriptor stackDelta) > 1]].
- (needsFrame not
- and: [descriptor needsFrameFunction isNil
- or: [self perform: descriptor needsFrameFunction with: false]]) ifTrue:
- [needsFrame := true].
descriptor isBranch ifTrue:
[distance := self spanFor: descriptor at: pc exts: nExts in: methodObj.
targetPC := pc + descriptor numBytes + distance.
(self isBackwardBranch: descriptor at: pc exts: nExts in: methodObj)
ifTrue: [self initializeFixupAt: targetPC - initialPC]
ifFalse:
[latestContinuation := latestContinuation max: targetPC.
(descriptor isBranchTrue or: [descriptor isBranchFalse]) ifTrue:
[numCounters := numCounters + 1]]].
descriptor isBlockCreation ifTrue:
[numBlocks := numBlocks + 1.
distance := self spanFor: descriptor at: pc exts: nExts in: methodObj.
targetPC := pc + descriptor numBytes + distance.
latestContinuation := latestContinuation max: targetPC].
pc := pc + descriptor numBytes.
nExts := descriptor isExtension ifTrue: [nExts + 1] ifFalse: [0]].
^numBlocks!
Item was added:
+ ----- Method: StackToRegisterMappingCogit>>scanMethod (in category 'compile abstract instructions') -----
+ scanMethod
+ "Scan the method to determine
+ - what the last bytecode is; extra bytes at the end of a method are used to encode things like source pointers or temp names
+ - if the method needs a frame or not
+ - what are the targets of any backward branches.
+ - how many blocks it creates
+ Answer the block count or on error a negative error code"
+ | latestContinuation nExts descriptor pc numBlocks distance targetPC stackDelta |
+ <var: #descriptor type: #'BytecodeDescriptor *'>
+ needsFrame := false.
+ (primitiveIndex > 0
+ and: [coInterpreter isQuickPrimitiveIndex: primitiveIndex]) ifTrue:
+ [^0].
+ numBlocks := 0.
+ pc := latestContinuation := initialPC.
+ nExts := 0.
+ stackDelta := 0.
+ [pc <= endPC] whileTrue:
+ [byte0 := (objectMemory fetchByte: pc ofObject: methodObj) + bytecodeSetOffset.
+ descriptor := self generatorAt: byte0.
+ (descriptor isReturn
+ and: [pc >= latestContinuation]) ifTrue:
+ [endPC := pc].
+ needsFrame ifFalse:
+ [(descriptor needsFrameFunction isNil
+ or: [self perform: descriptor needsFrameFunction with: true])
+ ifTrue:
+ [needsFrame := true]
+ ifFalse: "avoid spilling in frameless methods by not compiling frameless
+ anything with a stack deeper than a single push."
+ [needsFrame := (stackDelta := stackDelta + descriptor stackDelta) > 1]].
+ descriptor isBranch ifTrue:
+ [distance := self spanFor: descriptor at: pc exts: nExts in: methodObj.
+ targetPC := pc + descriptor numBytes + distance.
+ (self isBackwardBranch: descriptor at: pc exts: nExts in: methodObj)
+ ifTrue: [self initializeFixupAt: targetPC - initialPC]
+ ifFalse: [latestContinuation := latestContinuation max: targetPC]].
+ descriptor isBlockCreation ifTrue:
+ [numBlocks := numBlocks + 1.
+ distance := self spanFor: descriptor at: pc exts: nExts in: methodObj.
+ targetPC := pc + descriptor numBytes + distance.
+ latestContinuation := latestContinuation max: targetPC].
+ pc := pc + descriptor numBytes.
+ nExts := descriptor isExtension ifTrue: [nExts + 1] ifFalse: [0]].
+ ^numBlocks!
Item was added:
+ ----- Method: VMMaker class>>generateNewSqueakCogVM (in category 'configurations') -----
+ generateNewSqueakCogVM
+ "VMMaker generateNewSqueakCogVM"
+ ^VMMaker
+ generate: (Smalltalk at: ([:choices| choices at: (UIManager default chooseFrom: choices) ifAbsent: [^self]]
+ value: #(CoInterpreter CoInterpreterMT)))
+ and: StackToRegisterMappingCogit
+ with: #( MULTIPLEBYTECODESETS false
+ NewspeakVM false
+ bytecodeTableInitializer newInitializeBytecodeTableForSqueakV3PlusClosures)
+ to: (FileDirectory default pathFromURI: 'oscogvm/src')
+ platformDir: (FileDirectory default pathFromURI: 'oscogvm/platforms')
+ including:#( ADPCMCodecPlugin AsynchFilePlugin BalloonEnginePlugin B3DAcceleratorPlugin
+ BMPReadWriterPlugin BitBltSimulation BochsIA32Plugin CroquetPlugin DSAPlugin
+ DeflatePlugin DropPlugin FT2Plugin FFTPlugin FileCopyPlugin FilePlugin FloatArrayPlugin
+ FloatMathPlugin GeniePlugin HostWindowPlugin IA32ABIPlugin InternetConfigPlugin
+ JPEGReadWriter2Plugin JPEGReaderPlugin JoystickTabletPlugin KlattSynthesizerPlugin
+ LargeIntegersPlugin LocalePlugin MIDIPlugin MacMenubarPlugin Matrix2x3Plugin
+ MiscPrimitivePlugin Mpeg3Plugin QuicktimePlugin RePlugin SecurityPlugin SerialPlugin
+ SocketPlugin SoundCodecPlugin SoundGenerationPlugin SoundPlugin SqueakSSLPlugin StarSqueakPlugin
+ ThreadedIA32FFIPlugin UnixAioPlugin UUIDPlugin UnixOSProcessPlugin
+ Win32OSProcessPlugin VMProfileLinuxSupportPlugin VMProfileMacSupportPlugin)!
More information about the Vm-dev
mailing list