[Vm-dev] [commit][3150] Add MorphFloat. st which morphs the Float hierarchy to admit immediate floats.

commits at squeakvm.org commits at squeakvm.org
Tue Nov 25 23:34:23 UTC 2014


Revision: 3150
Author:   eliot
Date:     2014-11-25 15:33:58 -0800 (Tue, 25 Nov 2014)
Log Message:
-----------
Add MorphFloat.st which morphs the Float hierarchy to admit immediate floats.
Add buildsqueaktrunkimage.sh to create image with morphed float hierarchy.
Use UpdateSqueakTrunkImage.st in place of equivalent BuildSqueakTrunkImage.st.

Modified Paths:
--------------
    branches/Cog/image/UpdateSqueakTrunkImage.st
    branches/Cog/image/buildspurtrunkimage.sh

Added Paths:
-----------
    branches/Cog/image/MorphFloat.st
    branches/Cog/image/buildsqueaktrunkimage.sh

Removed Paths:
-------------
    branches/Cog/image/BuildSqueakTrunkImage.st

Deleted: branches/Cog/image/BuildSqueakTrunkImage.st
===================================================================
--- branches/Cog/image/BuildSqueakTrunkImage.st	2014-11-24 22:09:18 UTC (rev 3149)
+++ branches/Cog/image/BuildSqueakTrunkImage.st	2014-11-25 23:33:58 UTC (rev 3150)
@@ -1,6 +0,0 @@
-"Change the update stream to trunk and update"
-[MCMcmUpdater
-	defaultUpdateURL: 'http://source.squeak.org/trunk';
-	updateFromServer] valueSupplyingAnswer: true.
-
-Smalltalk snapshot: true andQuit: true
Added: branches/Cog/image/MorphFloat.st
===================================================================
--- branches/Cog/image/MorphFloat.st	                        (rev 0)
+++ branches/Cog/image/MorphFloat.st	2014-11-25 23:33:58 UTC (rev 3150)
@@ -0,0 +1,111 @@
+SystemChangeNotifier uniqueInstance doSilently:
+	[| boxedFloat floatClassVars soonToBeFloat smallFloat |
+	boxedFloat := Float.
+	floatClassVars := Float classVariablesString.
+	soonToBeFloat := Number subclass: #SoonToBeFloat
+							instanceVariableNames: ''
+							classVariableNames: ''
+							poolDictionaries: ''
+							category: 'Kernel-Numbers'.
+	smallFloat := soonToBeFloat subclass: #SmallFloat64
+							instanceVariableNames: ''
+							classVariableNames: ''
+							poolDictionaries: ''
+							category: 'Kernel-Numbers'.
+	'!!SoonToBeFloat class methodsFor: ''instance creation'' stamp: ''eem 11/25/2014 7:54''!!
+basicNew
+	^Float basicNew: 2!! !!
+!!SoonToBeFloat class methodsFor: ''instance creation'' stamp: ''eem 11/25/2014 7:54''!!
+basicNew: anInteger
+	^Float basicNew: 2!! !!' readStream fileIn.
+
+	[soonToBeFloat variableWordSubclass: #Float
+							instanceVariableNames: ''
+							classVariableNames: floatClassVars
+							poolDictionaries: ''
+							category: 'Kernel-Numbers']
+		on: Error, Warning
+		do: [:ex|
+			Transcript cr; nextPutAll: ex messageText; flush.
+			ex isResumable ifFalse:
+				[Notification adoptInstance: ex].
+			ex resume: true].
+	soonToBeFloat classPool: Float classPool.
+	Float classPool: nil.
+	soonToBeFloat
+		comment: Float comment asString
+		stamp: Float organization commentStamp.
+	Float class selectors do:
+		[:s|
+		(soonToBeFloat class includesSelector: s) ifFalse:
+			[soonToBeFloat class recompile: s from: Float class.
+			 soonToBeFloat class organization
+				classify: s
+				under: (Float class organization categoryOfElement: s)]].
+
+	(Float selectors reject: [:s| (Float >> s) primitive between: 40 and: 59]) do:
+		[:s|
+		 soonToBeFloat recompile: s from: Float.
+		 soonToBeFloat organization
+			classify: s
+			under: (Float organization categoryOfElement: s).
+		 Float removeSelector: s].
+	[boxedFloat setName: #BoxedFloat64.
+	 boxedFloat environment renameClass: Float from: #Float.
+	 soonToBeFloat setName: #Float.
+	 soonToBeFloat environment renameClass: soonToBeFloat from: #SoonToBeFloat]
+		on: AttemptToWriteReadOnlyGlobal
+		do: [:ex| ex resume: true].
+
+	'!!Float class methodsFor: ''instance creation'' stamp: ''eem 11/25/2014 7:54''!!
+basicNew
+	^BoxedFloat64 basicNew: 2!! !!
+
+!!Float class methodsFor: ''instance creation'' stamp: ''eem 11/25/2014 7:54''!!
+basicNew: anInteger
+	^BoxedFloat64 basicNew: 2!! !!
+!!BoxedFloat64 class methodsFor: ''instance creation'' stamp: ''eem 11/25/2014 7:54''!!
+basicNew: sizeRequested 
+	"Primitive. Answer an instance of this class with the number
+	 of indexable variables specified by the argument, sizeRequested.
+	 Fail if this class is not indexable or if the argument is not a
+	 positive Integer, or if there is not enough memory available. 
+	 Essential. See Object documentation whatIsAPrimitive."
+
+	<primitive: 71>
+	sizeRequested isInteger ifTrue:
+		[^sizeRequested = 2
+			ifTrue: "arg okay; space must be low."
+				[OutOfMemory signal.
+				 self basicNew: sizeRequested]  "retry if user proceeds"
+			ifFalse:
+				[self error: ''a Float shall always have two slots'']].
+	self primitiveFailed!! !!
+
+!!SmallFloat64 class methodsFor: ''instance creation'' stamp: ''eem 11/25/2014 7:54''!!
+basicNew: anInteger
+	^self basicNew!! !!
+!!SmallFloat64 class methodsFor: ''instance creation'' stamp: ''eem 11/25/2014 7:54''!!
+basicNew
+	self error: ''SmallFloat64s can only be created by performing arithmetic''!! !!' readStream fileIn.
+
+	boxedFloat class selectors do:
+		[:s|
+		((#(basicNew basicNew:) includes: s) not
+		 and: [soonToBeFloat class includesSelector: s]) ifTrue:
+			[boxedFloat class removeSelector: s]].
+
+	{boxedFloat. boxedFloat class. Float. Float class} do:
+		[:bfc| | binding |
+		binding := bfc binding.
+		bfc selectorsAndMethodsDo:
+			[:s :m|
+			 m methodClassAssociation: binding].
+		bfc organization removeEmptyCategories; sortCategories].
+
+	boxedFloat comment: 'My instances hold 64-bit Floats in heap objects.  This is the only representation on 32-bit systems.  But on 64-bit systems SmallFloat64 holds a subset of the full 64-bit double-precision range in immediate objects.'
+		stamp: 'eem 11/25/2014 7:54'.
+	smallFloat comment: 'My instances represent 64-bit Floats whose exponent fits in 8 bits as immediate objects.  This representation is only available on 64-bit systems, not 32-bit systems.'
+		stamp: 'eem 11/25/2014 7:54'.
+
+	Undeclared removeUnreferencedKeys]
Modified: branches/Cog/image/UpdateSqueakTrunkImage.st
===================================================================
--- branches/Cog/image/UpdateSqueakTrunkImage.st	2014-11-24 22:09:18 UTC (rev 3149)
+++ branches/Cog/image/UpdateSqueakTrunkImage.st	2014-11-25 23:33:58 UTC (rev 3150)
@@ -3,4 +3,6 @@
 	defaultUpdateURL: 'http://source.squeak.org/trunk';
 	updateFromServer] valueSupplyingAnswer: true.
 
+(FileStream oldFileNamed: 'MorphFloat.st') fileIn.
+
 Smalltalk snapshot: true andQuit: true
Modified: branches/Cog/image/buildspurtrunkimage.sh
===================================================================
--- branches/Cog/image/buildspurtrunkimage.sh	2014-11-24 22:09:18 UTC (rev 3149)
+++ branches/Cog/image/buildspurtrunkimage.sh	2014-11-25 23:33:58 UTC (rev 3150)
@@ -7,8 +7,8 @@
 	cp -p $SQUEAK45.image trunk46forspur.image
 	cp -p $SQUEAK45.changes trunk46forspur.changes
 
-	echo $VM trunk46forspur.image BuildSqueakTrunkImage.st
-	$VM trunk46forspur.image BuildSqueakTrunkImage.st
+	echo $VM trunk46forspur.image UpdateSqueakTrunkImage.st
+	$VM trunk46forspur.image UpdateSqueakTrunkImage.st
 fi
 
 #Old code pre patchAndUploadUnpatchedInTrunk

Added: branches/Cog/image/buildsqueaktrunkimage.sh
===================================================================
--- branches/Cog/image/buildsqueaktrunkimage.sh	                        (rev 0)
+++ branches/Cog/image/buildsqueaktrunkimage.sh	2014-11-25 23:33:58 UTC (rev 3150)
@@ -0,0 +1,12 @@
+#!/bin/sh
+. ./envvars.sh
+./getsqueak45.sh
+. ./getGoodCogVM.sh
+
+cp -p $SQUEAK45.image trunk46forspur.image
+cp -p $SQUEAK45.changes trunk46forspur.changes
+
+echo $VM trunk46forspur.image UpdateSqueakTrunkImage.st
+$VM trunk46forspur.image UpdateSqueakTrunkImage.st
+
+./resizesqueakwindow.sh trunk46forspur.image 800 600


Property changes on: branches/Cog/image/buildsqueaktrunkimage.sh
___________________________________________________________________
Added: svn:executable
   + *



More information about the Vm-dev mailing list