<div dir="ltr">I went one step further and simply pass Errors and letting default handler resume them if they are resumable.<div><br></div><div>Since the code is now so explicit about quitting or passing, it seems a comment is not needed.</div></div><div class="gmail_extra"><br><div class="gmail_quote">On Sat, Jan 17, 2015 at 7:00 PM, <span dir="ltr"><<a href="mailto:commits@source.squeak.org" target="_blank">commits@source.squeak.org</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Chris Muller uploaded a new version of System to project The Trunk:<br>
<a href="http://source.squeak.org/trunk/System-cmm.696.mcz" target="_blank">http://source.squeak.org/trunk/System-cmm.696.mcz</a><br>
<br>
==================== Summary ====================<br>
<br>
Name: System-cmm.696<br>
Author: cmm<br>
Time: 17 January 2015, 7:00:32.693 pm<br>
UUID: e13e847b-b9e1-4068-bb77-48d54a9cd005<br>
Ancestors: System-kfr.695, System-cmm.694<br>
<br>
- Remove the crazy check for MessageNotUnderstood in Smalltalk #run:.. Headless mode should always exit on any Error.<br>
- In fact, even when not in headless mode, we don't need to halt but simply #pass the Error to the default handler for Errors do what it does, whether that's popping a debugger which could be resumed (if the Error isResumable) or something else.<br>
<br>
=============== Diff against System-kfr.695 ===============<br>
<br>
Item was removed:<br>
- ----- Method: SmalltalkImage>>haltOrQuit (in category 'command line') -----<br>
- haltOrQuit<br>
- self isHeadless<br>
- ifTrue:<br>
- [ self<br>
- snapshot: false<br>
- andQuit: true ]<br>
- ifFalse: [ self halt ]!<br>
<br>
Item was changed:<br>
----- Method: SmalltalkImage>>run: (in category 'command line') -----<br>
+ run: aBlock<br>
- run: aBlock<br>
[ [ (aBlock numArgs = 1 and: [ self arguments size > 1 ])<br>
+ ifTrue: [ "Allow a large, variable number of arguments to be passed as an Array to aBlock."<br>
- ifTrue:<br>
- [ "Allow a large, variable number of arguments to be passed as an Array to aBlock."<br>
aBlock value: self arguments ]<br>
ifFalse: [ aBlock valueWithEnoughArguments: self arguments ] ]<br>
on: ProgressInitiationException<br>
do:<br>
[ : pie | "Don't want to log this notification."<br>
pie defaultAction ] ]<br>
on: Notification , Warning<br>
do:<br>
[ : noti | FileStream stdout<br>
nextPutAll: DateAndTime now asString ;<br>
space ;<br>
nextPutAll: noti description ;<br>
cr.<br>
noti resume ]<br>
on: SyntaxErrorNotification<br>
do:<br>
[ : err | FileStream stdout<br>
nextPutAll: err errorCode ;<br>
+ cr; flush.<br>
+ self isHeadless<br>
+ ifTrue: [ self snapshot: false andQuit: true ]<br>
+ ifFalse: [ err pass ] ]<br>
- cr.<br>
- self haltOrQuit ]<br>
on: Error<br>
do:<br>
[ : err | err printVerboseOn: FileStream stderr.<br>
+ FileStream stderr flush.<br>
+ self isHeadless<br>
+ ifTrue: [ self snapshot: false andQuit: true ]<br>
+ ifFalse: [ err pass ] ]!<br>
- self haltOrQuit.<br>
- err isResumable ifTrue: [ err resume ] ]!<br>
<br>
Item was changed:<br>
----- Method: SmalltalkImage>>vmStatisticsReportString (in category 'vm statistics') -----<br>
vmStatisticsReportString<br>
"(Workspace new contents: Smalltalk vmStatisticsReportString)<br>
openLabel: 'VM Statistics'"<br>
"StringHolderView<br>
open: (StringHolder new contents: Smalltalk vmStatisticsReportString)<br>
label: 'VM Statistics'"<br>
<br>
| params onSpur oldSpaceEnd youngSpaceEnd memorySize fullGCs fullGCTime incrGCs incrGCTime tenureCount upTime upTime2 fullGCs2 fullGCTime2 incrGCs2 incrGCTime2 tenureCount2 str freeSize youngSize used |<br>
params := self getVMParameters.<br>
+ onSpur := (params at: 41 ifAbsent: [ 0 ]) anyMask: 16.<br>
- onSpur := (params at: 41) anyMask: 16.<br>
oldSpaceEnd := params at: 1.<br>
youngSpaceEnd := params at: 2.<br>
memorySize := params at: 3.<br>
fullGCs := params at: 7.<br>
fullGCTime := params at: 8.<br>
incrGCs := params at: 9.<br>
incrGCTime := params at: 10.<br>
tenureCount := params at: 11.<br>
upTime := Time millisecondClockValue.<br>
<br>
str := WriteStream on: (String new: 700).<br>
str nextPutAll: 'uptime ';<br>
print: (upTime / 1000 / 60 // 60); nextPut: $h;<br>
print: (upTime / 1000 / 60 \\ 60) asInteger; nextPut: $m;<br>
print: (upTime / 1000 \\ 60) asInteger; nextPut: $s; cr.<br>
<br>
str nextPutAll: 'memory ';<br>
nextPutAll: memorySize asStringWithCommas; nextPutAll: ' bytes'; cr.<br>
str nextPutAll: ' old ';<br>
nextPutAll: oldSpaceEnd asStringWithCommas; nextPutAll: ' bytes (';<br>
print: (oldSpaceEnd / memorySize * 100) maxDecimalPlaces: 1; nextPutAll: '%)'; cr.<br>
youngSize := onSpur<br>
ifTrue: [params at: 44 "eden size"] "Spur"<br>
ifFalse: [youngSpaceEnd - oldSpaceEnd]. "Squeak V3"<br>
str nextPutAll: ' young ';<br>
nextPutAll: youngSize asStringWithCommas; nextPutAll: ' bytes (';<br>
print: youngSize / memorySize * 100 maxDecimalPlaces: 1; nextPutAll: '%)'; cr.<br>
onSpur ifTrue: [youngSize := youngSpaceEnd "used eden"].<br>
freeSize := onSpur<br>
ifTrue: [(params at: 54) + (params at: 44) - youngSize] "Spur"<br>
ifFalse: [memorySize - youngSpaceEnd] "Squeak V3".<br>
used := onSpur<br>
ifTrue: [youngSize + oldSpaceEnd - freeSize] "Spur"<br>
ifFalse: [youngSpaceEnd]. "Squeak V3"<br>
str nextPutAll: ' used ';<br>
nextPutAll: used asStringWithCommas; nextPutAll: ' bytes (';<br>
print: used / memorySize * 100 maxDecimalPlaces: 1; nextPutAll: '%)'; cr.<br>
str nextPutAll: ' free ';<br>
nextPutAll: freeSize asStringWithCommas; nextPutAll: ' bytes (';<br>
print: freeSize / memorySize * 100 maxDecimalPlaces: 1; nextPutAll: '%)'; cr.<br>
<br>
str nextPutAll: 'GCs ';<br>
nextPutAll: (fullGCs + incrGCs) asStringWithCommas.<br>
fullGCs + incrGCs > 0 ifTrue: [<br>
str<br>
nextPutAll: ' (';<br>
print: (upTime / (fullGCs + incrGCs)) maxDecimalPlaces: 1;<br>
nextPutAll: ' ms between GCs)'<br>
].<br>
str cr.<br>
str nextPutAll: ' full ';<br>
nextPutAll: fullGCs asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: fullGCTime asStringWithCommas; nextPutAll: ' ms (';<br>
print: (fullGCTime / upTime * 100) maxDecimalPlaces: 1;<br>
nextPutAll: '% uptime)'.<br>
fullGCs = 0 ifFalse:<br>
[str nextPutAll: ', avg '; print: (fullGCTime / fullGCs) maxDecimalPlaces: 1; nextPutAll: ' ms'].<br>
str cr.<br>
str nextPutAll: ' incr ';<br>
nextPutAll: incrGCs asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: incrGCTime asStringWithCommas; nextPutAll: ' ms (';<br>
print: (incrGCTime / upTime * 100) maxDecimalPlaces: 1;<br>
nextPutAll: '% uptime), avg '; print: (incrGCTime / incrGCs) maxDecimalPlaces: 1; nextPutAll: ' ms'; cr.<br>
str nextPutAll: ' tenures ';<br>
nextPutAll: tenureCount asStringWithCommas.<br>
tenureCount = 0 ifFalse:<br>
[str nextPutAll: ' (avg '; print: incrGCs // tenureCount; nextPutAll: ' GCs/tenure)'].<br>
str cr.<br>
<br>
LastStats ifNil: [LastStats := Array new: 6]<br>
ifNotNil: [<br>
upTime2 := upTime - (LastStats at: 1).<br>
fullGCs2 := fullGCs - (LastStats at: 2).<br>
fullGCTime2 := fullGCTime - (LastStats at: 3).<br>
incrGCs2 := incrGCs - (LastStats at: 4).<br>
incrGCTime2 := incrGCTime - (LastStats at: 5).<br>
tenureCount2 := tenureCount - (LastStats at: 6).<br>
<br>
str nextPutAll: self textMarkerForShortReport ;<br>
nextPutAll: (fullGCs2 + incrGCs2) asStringWithCommas.<br>
fullGCs2 + incrGCs2 > 0 ifTrue: [<br>
str<br>
nextPutAll: ' (';<br>
print: upTime2 // (fullGCs2 + incrGCs2);<br>
nextPutAll: ' ms between GCs)'.<br>
].<br>
str cr.<br>
str nextPutAll: ' uptime '; print: (upTime2 / 1000.0) maxDecimalPlaces: 1; nextPutAll: ' s'; cr.<br>
str nextPutAll: ' full ';<br>
nextPutAll: fullGCs2 asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: fullGCTime2 asStringWithCommas; nextPutAll: ' ms (';<br>
print: (fullGCTime2 / upTime2 * 100) maxDecimalPlaces: 1;<br>
nextPutAll: '% uptime)'.<br>
fullGCs2 = 0 ifFalse:<br>
[str nextPutAll: ', avg '; print: (fullGCTime2 / fullGCs2) maxDecimalPlaces: 1; nextPutAll: ' ms'].<br>
str cr.<br>
str nextPutAll: ' incr ';<br>
nextPutAll: incrGCs2 asStringWithCommas; nextPutAll: ' totalling '; nextPutAll: incrGCTime2 asStringWithCommas; nextPutAll: ' ms (';<br>
print: (incrGCTime2 / upTime2 * 100) maxDecimalPlaces: 1;<br>
nextPutAll: '% uptime), avg '.<br>
incrGCs2 > 0 ifTrue: [<br>
str print: (incrGCTime2 / incrGCs2) maxDecimalPlaces: 1; nextPutAll: ' ms'<br>
].<br>
str cr.<br>
str nextPutAll: ' tenures ';<br>
nextPutAll: tenureCount2 asStringWithCommas.<br>
tenureCount2 = 0 ifFalse:<br>
[str nextPutAll: ' (avg '; print: incrGCs2 // tenureCount2; nextPutAll: ' GCs/tenure)'].<br>
str cr.<br>
].<br>
LastStats at: 1 put: upTime.<br>
LastStats at: 2 put: fullGCs.<br>
LastStats at: 3 put: fullGCTime.<br>
LastStats at: 4 put: incrGCs.<br>
LastStats at: 5 put: incrGCTime.<br>
LastStats at: 6 put: tenureCount.<br>
<br>
^ str contents<br>
!<br>
<br>
<br>
</blockquote></div><br></div>