Changes to Trunk (http://source.squeak.org/trunk.html) in the last 24 hours:
http://lists.squeakfoundation.org/pipermail/packages/2010-October/003866.ht…
Name: KernelTests-nice.167
Ancestors: KernelTests-nice.166
Assert that #degreeCos and #degreeSin are exact for any multiple of 90.
This is a nice property to have that radianCos and radianSin cannot afford due to approximate floating point representation of pi.
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2010-October/003867.ht…
Name: Kernel-nice.510
Ancestors: Kernel-ul.509
Provide an implementation of #degreeCos and #degreeSin such that results are exact for any multiple of 90.
Care is also taken to evaluate the sine between -90° and 90°, this will avoid #degreesToRadians and i386 FPU sine fonction to accumulate round off errors due to approximate representation of pi.
We can thus evaluate 240 degreeCos with at most 1 ulp error. It's not perfect, but better than previous implementation.
For cosine, we know that:
cosd(x)=cosd(abs(x))
cosd(x)=sind(90-x)
thus the trick is to evaluate:
cosd(x)=sind(90-abs(x)) after appropriate modulo in [-180,180[
This way, we are sure to evaluate the sine between -90° and 90°
The #degreesToRadians and #sin are used rather than #degreeSin to avoid cycles.
For sine, it would be necessary to evaluate either
sind(x) if abs(x) <=90
or sind(180-x) if abs(x) >= 90
A possible implementation would be:
| x |
x := 90 + self \\ 360 - 90.
x >= 180 ifTrue: [x := 180 - x].
^x degreesToRadians sin
We prefer evaluating cosd(90-x) thus providing a branch free implementation.
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2010-October/003868.ht…
Name: Collections-ul.398
Ancestors: Collections-ar.397
- restore the behavior of the old finalization scheme
=============================================
http://lists.squeakfoundation.org/pipermail/packages/2010-October/003869.ht…
Name: Collections-ul.399
Ancestors: Collections-ul.398
- added a postscript to apply the changes
=============================================
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.399.mcz
==================== Summary ====================
Name: Collections-ul.399
Author: ul
Time: 31 October 2010, 11:36:48.538 pm
UUID: d9152061-bf6c-eb4a-8a87-4a9bef73ea7e
Ancestors: Collections-ul.398
- added a postscript to apply the changes
=============== Diff against Collections-ul.398 ===============
Item was changed:
+ (PackageInfo named: 'Collections') postscript: 'WeakRegistry allInstancesDo: [ :each | each installFinalizer ]'!
- (PackageInfo named: 'Collections') postscript: 'WeakFinalizationRegistry migrateOldRegistries'!
Levente Uzonyi uploaded a new version of Collections to project The Trunk:
http://source.squeak.org/trunk/Collections-ul.398.mcz
==================== Summary ====================
Name: Collections-ul.398
Author: ul
Time: 31 October 2010, 10:06:44.386 pm
UUID: a696b0b6-1bd2-dc45-9606-33aebcfdc74c
Ancestors: Collections-ar.397
- restore the behavior of the old finalization scheme
=============== Diff against Collections-ar.397 ===============
Item was changed:
Collection subclass: #WeakRegistry
+ instanceVariableNames: 'list valueDictionary sema executors'
- instanceVariableNames: 'list valueDictionary sema'
classVariableNames: 'Default'
poolDictionaries: ''
category: 'Collections-Weak'!
!WeakRegistry commentStamp: 'ul 9/26/2010 02:51' prior: 0!
I am a registry for objects needing finalization. When an object is added the object as well as its executor is stored. When the object is garbage collected, the executor can take the appropriate action for any resources associated with the object.
This kind of WeakRegistry is using a new VM feature, which allows a more robust finalization support. In contrast to the old implementation, it doesn't spend linear time checking which elements became garbage.
See also:
Object executor
Object actAsExecutor
Object finalize!
Item was changed:
----- Method: WeakRegistry>>finalizeValues (in category 'finalization') -----
finalizeValues
"Finalize any values, which happen to stocked in our list, due to some weak references become garbage"
| finalizer |
-
WeakFinalizationList hasNewFinalization ifFalse: [
+ self protected: [
+ valueDictionary finalizeValues.
+ finalizer := executors.
+ executors := nil ].
+ finalizer ifNotNil: [
+ finalizer do: [ :each | each finalizeValues ] ].
- self protected: [ valueDictionary finalizeValues ].
^ self ].
+ finalizer := self protected: [ list swapWithNil ].
- self protected: [ finalizer := list swapWithNil ].
"We don't need to protect a following loop from concurrent access,
because at the moment we're finalizing values,
only we can access this list of finalizers, because valueDictionary already see them
as an unused slots, because they're associated with key == nil"
[ finalizer notNil ] whileTrue: [
| next |
next := finalizer next.
finalizer finalizeValues.
+ finalizer := next ].
- finalizer := next
- ].
!
Item was changed:
----- Method: WeakRegistry>>installFinalizer (in category 'initialize-release') -----
installFinalizer
+ valueDictionary finalizer: [ :executor |
+ WeakFinalizationList hasNewFinalization
+ ifTrue: [ executor finalizeValues ]
+ ifFalse: [
+ (executors ifNil: [ executors := OrderedCollection new ]) add: executor ] ]!
- valueDictionary finalizer: #finalizeValues!
Nicolas Cellier uploaded a new version of Kernel to project The Trunk:
http://source.squeak.org/trunk/Kernel-nice.510.mcz
==================== Summary ====================
Name: Kernel-nice.510
Author: nice
Time: 31 October 2010, 10:25:03.794 pm
UUID: 80b9fa44-3abc-4414-adae-10f3f03b0420
Ancestors: Kernel-ul.509
Provide an implementation of #degreeCos and #degreeSin such that results are exact for any multiple of 90.
Care is also taken to evaluate the sine between -90° and 90°, this will avoid #degreesToRadians and i386 FPU sine fonction to accumulate round off errors due to approximate representation of pi.
We can thus evaluate 240 degreeCos with at most 1 ulp error. It's not perfect, but better than previous implementation.
For cosine, we know that:
cosd(x)=cosd(abs(x))
cosd(x)=sind(90-x)
thus the trick is to evaluate:
cosd(x)=sind(90-abs(x)) after appropriate modulo in [-180,180[
This way, we are sure to evaluate the sine between -90° and 90°
The #degreesToRadians and #sin are used rather than #degreeSin to avoid cycles.
For sine, it would be necessary to evaluate either
sind(x) if abs(x) <=90
or sind(180-x) if abs(x) >= 90
A possible implementation would be:
| x |
x := 90 + self \\ 360 - 90.
x >= 180 ifTrue: [x := 180 - x].
^x degreesToRadians sin
We prefer evaluating cosd(90-x) thus providing a branch free implementation.
=============== Diff against Kernel-ul.509 ===============
Item was changed:
----- Method: Float>>degreeCos (in category 'mathematical functions') -----
degreeCos
+ "Take care of exceptional values"
+
+ self isFinite ifTrue: [^super degreeCos].
+ ^self radiansToDegrees cos!
- "Answer the cosine of the receiver taken as an angle in degrees."
-
- ^ self degreesToRadians cos!
Item was changed:
----- Method: Float>>degreeSin (in category 'mathematical functions') -----
degreeSin
+ "Take care of exceptional values"
+
+ self isFinite ifTrue: [^super degreeSin].
+ ^self radiansToDegrees sin!
- "Answer the sine of the receiver taken as an angle in degrees."
-
- ^ self degreesToRadians sin!
Item was changed:
----- Method: Number>>degreeCos (in category 'mathematical functions') -----
degreeCos
"Answer the cosine of the receiver taken as an angle in degrees."
+ ^ (90 - (180 + self \\ 360 - 180) abs) degreesToRadians sin!
- ^ (90 + self) degreeSin!
Item was changed:
----- Method: Number>>degreeSin (in category 'mathematical functions') -----
degreeSin
"Answer the sine of the receiver taken as an angle in degrees."
+ ^(90 - self) degreeCos!
- ^ self asFloat degreesToRadians sin!
Hello,
under VM with new finalization, some tests are failing.
Please, check
http://code.google.com/p/pharo/issues/detail?id=3183
for details.
it looks like i need to do a different changeset for Squeak
--
Best regards,
Igor Stasenko AKA sig.
A new version of Tests was added to project The Inbox:
http://source.squeak.org/inbox/Tests-bp.100.mcz
==================== Summary ====================
Name: Tests-bp.100
Author: bp
Time: 31 October 2010, 7:07:14.269 pm
UUID: f95fe472-fe1e-4e96-ae3e-9c5c917c39f1
Ancestors: Tests-bp.99
Add preamble to flush obsolete PackageInfos.
=============== Diff against Tests-bp.99 ===============
Item was added:
+ (PackageInfo named: 'Tests') preamble: 'MCWorkingCopy flushObsoletePackageInfos'!
A new version of PackageInfo-Base was added to project The Inbox:
http://source.squeak.org/inbox/PackageInfo-Base-bp.45.mcz
==================== Summary ====================
Name: PackageInfo-Base-bp.45
Author: bp
Time: 31 October 2010, 6:16:27.312 pm
UUID: ea9306f3-af1f-463e-bfd6-4651491f4e5b
Ancestors: PackageInfo-Base-eem.44
fixed category for PackageInfo>>name
=============== Diff against PackageInfo-Base-eem.44 ===============
Item was changed:
+ ----- Method: PackageInfo>>name (in category 'naming') -----
- ----- Method: PackageInfo>>name (in category 'preamble/postscript') -----
name
+ ^self packageName!
-
- ^ self packageName!