Hi,
I uploaded Kernel-ul.522 to the Inbox for testing (see the commit message
for details). The tests are green, but you never know if it breaks
anything. Please check it out, thanks.
Cheers,
Levente
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.521.mcz
==================== Summary ====================
Name: Kernel-ul.521
Author: ul
Time: 8 December 2010, 3:42:40.757 am
UUID: 3b6f8cce-0310-2d4d-91aa-deab6d13bde9
Ancestors: Kernel-ul.520
Implemented CompiledMethod >> #asString the same way Object does.
Why?
Because it raised an error, which it shouldn't.
Why doesn't it return a string with the bytes as characters like ByteArray does it?
Because it's not very useful to get an unreadable string with random looking characters. Also CompiledMethod is a subclass of ByteArray only to avoid code duplication, it could be a variableByteSubclass of Object.
Why doesn't it return the source code like Pharo does it?
Because that requires several changes in the way the sources and changes files are used (concurrency issues). And it's a lot slower.
The related mantis issue is http://bugs.squeak.org/view.php?id=7570 .
=============== Diff against Kernel-ul.520 ===============
Item was added:
+ ----- Method: CompiledMethod>>asString (in category 'converting') -----
+ asString
+
+ ^self printString!
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.520.mcz
==================== Summary ====================
Name: Kernel-ul.520
Author: ul
Time: 8 December 2010, 3:19:51.682 am
UUID: da185163-27f6-6a47-8ecb-e00f9fd8dd3a
Ancestors: Kernel-ul.519
A few changes to Semaphore:
- save a block creation + activation + a possible context switch in #critical:ifCurtailed:
- save a block creation + activation in #critical:ifError:, this changes the behavior when mutuallyExcludedBlock doesn't understand #ifError:
- #critical:ifLocked: is guaranteed to not get locked. The earlier implementation sent #critical: which could cause a context switch, so another process could enter the critical section before the current. Also fixed the comments of this method.
=============== Diff against Kernel-ul.519 ===============
Item was changed:
----- Method: Semaphore>>critical:ifCurtailed: (in category 'mutual exclusion') -----
critical: mutuallyExcludedBlock ifCurtailed: terminationBlock
"Evaluate mutuallyExcludedBlock only if the receiver is not currently in
the process of running the critical: message. If the receiver is, evaluate
mutuallyExcludedBlock after the other critical: message is finished."
+ ^self critical: [ mutuallyExcludedBlock ifCurtailed: terminationBlock ]
- ^self critical:[[mutuallyExcludedBlock value] ifCurtailed: terminationBlock]
!
Item was changed:
----- Method: Semaphore>>critical:ifError: (in category 'mutual exclusion') -----
critical: mutuallyExcludedBlock ifError: errorBlock
"Evaluate mutuallyExcludedBlock only if the receiver is not currently in
the process of running the critical: message. If the receiver is, evaluate
mutuallyExcludedBlock after the other critical: message is finished."
| blockValue hasError errMsg errRcvr |
hasError := false.
blockValue := self critical:[
+ mutuallyExcludedBlock ifError: [ :msg :rcvr |
- [mutuallyExcludedBlock value] ifError:[:msg :rcvr|
hasError := true.
errMsg := msg.
errRcvr := rcvr
].
].
hasError ifTrue:[ ^errorBlock value: errMsg value: errRcvr].
^blockValue!
Item was changed:
----- Method: Semaphore>>critical:ifLocked: (in category 'mutual exclusion') -----
critical: mutuallyExcludedBlock ifLocked: alternativeBlock
"Evaluate mutuallyExcludedBlock only if the receiver is not currently in
+ the process of running the critical: message. If the receiver is, then evaluate
+ alternativeBlock and return."
+ "See the comment of #critical: for the explanation how this pattern works
+ before changing the code."
+
+ | caught |
+ caught := false.
+ ^[
+ "We're using #== here instead of #=, because it won't introduce a
+ suspension point, while #= may do that."
+ excessSignals == 0
+ ifTrue: [ alternativeBlock value ]
+ ifFalse: [
+ excessSignals := excessSignals - 1.
+ caught := true.
+ mutuallyExcludedBlock value ] ]
+ ensure: [ caught ifTrue: [ self signal ] ]!
- the process of running the critical: message. If the receiver is, evaluate
- mutuallyExcludedBlock after the other critical: message is finished."
-
- "Note: The following is tricky and depends on the fact that the VM will not switch between processes while executing byte codes (process switches happen only in real sends). The following test is written carefully so that it will result in bytecodes only.
- Do not change the following #== for #=, as #== is not a real message send, just a bytecode."
- excessSignals == 0 ifTrue: [
- "If we come here, then the semaphore was locked when the test executed.
- Evaluate the alternative block and answer its result."
- ^alternativeBlock value
- ].
- ^self critical: mutuallyExcludedBlock!
Levente Uzonyi uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-ul.519.mcz
==================== Summary ====================
Name: Kernel-ul.519
Author: ul
Time: 8 December 2010, 2:52:41.144 am
UUID: 630c1710-46b8-5248-bdb8-e08d99d6d9c0
Ancestors: Kernel-ul.518
- copied another two methods from BlockContext to BlockClosure. One of them fixes http://bugs.squeak.org/view.php?id=7579 .
=============== Diff against Kernel-ul.518 ===============
Item was added:
+ ----- Method: BlockClosure>>newProcessWith: (in category 'scheduling') -----
+ newProcessWith: anArray
+ "Answer a Process running the code in the receiver. The receiver's block
+ arguments are bound to the contents of the argument, anArray. The
+ process is not scheduled."
+ <primitive: 19> "Simulation guard"
+ ^Process
+ forContext:
+ [self valueWithArguments: anArray.
+ Processor terminateActive] asContext
+ priority: Processor activePriority!
Item was added:
+ ----- Method: BlockClosure>>valueWithExit (in category 'evaluating') -----
+ valueWithExit
+ self value: [ ^nil ]!
Levente Uzonyi uploaded a new version of MorphicExtras to project The Trunk:
http://source.squeak.org/trunk/MorphicExtras-ul.96.mcz
==================== Summary ====================
Name: MorphicExtras-ul.96
Author: ul
Time: 8 December 2010, 2:38:15.825 am
UUID: c2425953-3cba-a545-a970-62ede1af9f17
Ancestors: MorphicExtras-fbs.95, MorphicExtras-edc.95
merged
=============== Diff against MorphicExtras-fbs.95 ===============
Item was changed:
----- Method: ProjectNavigationMorph>>findAProject (in category 'the actions') -----
findAProject
FileList2
+ morphicViewProjectLoader2InWorld: World
- morphicViewProjectLoader2InWorld: self world
reallyLoad: true
dirFilterType: #initialDirectoryList!