[squeak-dev] The Trunk: Compiler-nice.89.mcz
commits at source.squeak.org
commits at source.squeak.org
Tue Oct 20 19:27:22 UTC 2009
Nicolas Cellier uploaded a new version of Compiler to project The Trunk:
http://source.squeak.org/trunk/Compiler-nice.89.mcz
==================== Summary ====================
Name: Compiler-nice.89
Author: nice
Time: 20 October 2009, 9:27:04 am
UUID: 97fdcb43-1596-49f7-bf95-1c048cafd2b7
Ancestors: Compiler-nice.88
use keys asSet where due
=============== Diff against Compiler-nice.88 ===============
Item was changed:
----- Method: ClosureCompilerTest>>testBlockNumberingForInjectInto (in category 'tests') -----
testBlockNumberingForInjectInto
"Test that the compiler and CompiledMethod agree on the block numbering of Collection>>inject:into:
and that temp names for inject:into: are recorded."
"self new testBlockNumberingForInjectInto"
| methodNode method tempRefs |
methodNode := Parser new
encoderClass: EncoderForV3PlusClosures;
parse: (Collection sourceCodeAt: #inject:into:)
class: Collection.
method := methodNode generate: #(0 0 0 0).
tempRefs := methodNode encoder blockExtentsToTempsMap.
+ self assert: tempRefs keys asSet = method startpcsToBlockExtents values asSet.
- self assert: tempRefs keys = method startpcsToBlockExtents values asSet.
self assert: ((tempRefs includesKey: (0 to: 6))
and: [(tempRefs at: (0 to: 6)) hasEqualElements: #(('thisValue' 1) ('binaryBlock' 2) ('nextValue' (3 1)))]).
self assert: ((tempRefs includesKey: (2 to: 4))
and: [(tempRefs at: (2 to: 4)) hasEqualElements: #(('each' 1) ('binaryBlock' 2) ('nextValue' (3 1)))])!
Item was changed:
----- Method: Decompiler class>>recompileAllTest (in category 'testing') -----
recompileAllTest
"[Decompiler recompileAllTest]"
"decompile every method and compile it back; if the decompiler is correct then the system should keep running. :)"
- | decompiled ast compiled |
SystemNavigation default allBehaviorsDo: [ :behavior |
Utilities informUser: (behavior printString) during: [
behavior selectors do: [ :sel |
+ | decompiled ast compiled |
decompiled := Decompiler new decompile: sel in: behavior.
ast := Compiler new compile: decompiled in: behavior notifying: nil ifFail: [ self error: 'failed' ].
compiled := ast generate: (behavior compiledMethodAt: sel) trailer.
behavior addSelector: sel withMethod: compiled. ] ] ]!
Item was changed:
----- Method: ClosureCompilerTest>>testBlockNumbering (in category 'tests') -----
testBlockNumbering
"Test that the compiler and CompiledMethod agree on the block numbering of a substantial doit."
"self new testBlockNumbering"
| methodNode method tempRefs |
methodNode :=
Parser new
encoderClass: EncoderForV3PlusClosures;
parse: 'foo
| numCopiedValuesCounts |
numCopiedValuesCounts := Dictionary new.
0 to: 32 do: [:i| numCopiedValuesCounts at: i put: 0].
Transcript clear.
Smalltalk allClasses remove: GeniePlugin; do:
[:c|
{c. c class} do:
[:b|
Transcript nextPut: b name first; endEntry.
b selectorsAndMethodsDo:
[:s :m| | pn |
m isQuick not ifTrue:
[pn := b parserClass new
encoderClass: EncoderForV3PlusClosures;
parse: (b sourceCodeAt: s)
class: b.
pn generate: #(0 0 0 0).
[pn accept: nil]
on: MessageNotUnderstood
do: [:ex| | msg numCopied |
msg := ex message.
(msg selector == #visitBlockNode:
and: [(msg argument instVarNamed: ''optimized'') not]) ifTrue:
[numCopied := (msg argument computeCopiedValues: pn) size.
numCopiedValuesCounts
at: numCopied
put: (numCopiedValuesCounts at: numCopied) + 1].
msg setSelector: #==.
ex resume: nil]]]]].
numCopiedValuesCounts'
class: Object.
method := methodNode generate: #(0 0 0 0).
tempRefs := methodNode encoder blockExtentsToTempsMap.
+ self assert: tempRefs keys asSet = method startpcsToBlockExtents values asSet!
- self assert: tempRefs keys = method startpcsToBlockExtents values asSet!
More information about the Squeak-dev
mailing list
|