Eliot Miranda uploaded a new version of VMMaker to project VM Maker:
http://source.squeak.org/VMMaker/VMMaker.oscog-eem.393.mcz
==================== Summary ====================
Name: VMMaker.oscog-eem.393
Author: eem
Time: 19 September 2013, 2:39:25.571 pm
UUID: 89054bad-ac17-46e1-916f-9728d3774f3e
Ancestors: VMMaker.oscog-eem.392
Replace eeInstantiateSmallClass:sizeInBytes: with
eeInstantiateSmallClass:numSlots: and implement in SpurMemMgr.
Implement SpurMemMgr>>isClassOfNonImm:equalTo:.
=============== Diff against VMMaker.oscog-eem.392 ===============
Item was added:
+ ----- Method: NewObjectMemory>>eeInstantiateSmallClass:numSlots: (in category 'interpreter access') -----
+ eeInstantiateSmallClass: classPointer numSlots: numSlots
+ "This version of instantiateClass assumes that the total object
+ size is under 256 bytes, the limit for objects with only one or
+ two header words.
+ NOTE this code will only work for sizes that are an integral number of words
+ (like not a 32-bit LargeInteger in a 64-bit system).
+ Will *not* cause a GC.
+ Note that the created small object IS NOT FILLED and must be completed before returning it to Squeak.
+ Since this call is used in routines that do just that we are safe. Break this rule and die."
+
+ | sizeInBytes hash header1 header2 hdrSize |
+ sizeInBytes := numSlots << ShiftForWord + BaseHeaderSize.
+ self assert: sizeInBytes <= 252.
+ hash := self newObjectHash.
+ header1 := (hash bitAnd: HashMaskUnshifted) << HashBitsOffset bitOr: (self formatOfClass: classPointer).
+ header2 := classPointer.
+ hdrSize := (header1 bitAnd: CompactClassMask) > 0 "is this a compact class"
+ ifTrue: [1]
+ ifFalse: [2].
+ header1 := header1 + (sizeInBytes - (header1 bitAnd: SizeMask+Size4Bit)).
+ ^self eeAllocate: sizeInBytes headerSize: hdrSize h1: header1 h2: header2 h3: 0!
Item was removed:
- ----- Method: NewObjectMemory>>eeInstantiateSmallClass:sizeInBytes: (in category 'interpreter access') -----
- eeInstantiateSmallClass: classPointer sizeInBytes: sizeInBytes
- "This version of instantiateClass assumes that the total object
- size is under 256 bytes, the limit for objects with only one or
- two header words. Note that the size is specified in bytes
- and should include 4 or 8 bytes for the base header word.
- NOTE this code will only work for sizes that are an integral number of words
- (like not a 32-bit LargeInteger in a 64-bit system).
- Will *not* cause a GC.
- Note that the created small object IS NOT FILLED and must be completed before returning it to Squeak.
- Since this call is used in routines that do just that we are safe. Break this rule and die."
-
- | hash header1 header2 hdrSize |
- "size must be integral number of words"
- self assert: (sizeInBytes bitAnd: (BytesPerWord-1)) = 0.
- hash := self newObjectHash.
- header1 := (hash bitAnd: HashMaskUnshifted) << HashBitsOffset bitOr: (self formatOfClass: classPointer).
- header2 := classPointer.
- hdrSize := (header1 bitAnd: CompactClassMask) > 0 "is this a compact class"
- ifTrue: [1]
- ifFalse: [2].
- header1 := header1 + (sizeInBytes - (header1 bitAnd: SizeMask+Size4Bit)).
- ^self eeAllocate: sizeInBytes headerSize: hdrSize h1: header1 h2: header2 h3: 0!
Item was added:
+ ----- Method: SpurMemoryManager>>eeInstantiateSmallClass:numSlots: (in category 'allocation') -----
+ eeInstantiateSmallClass: classObj numSlots: numSlots
+ | classIndex |
+ <inline: true>
+ classIndex := self ensureBehaviorHash: classObj.
+ ^self
+ eeInstantiateClassIndex: classIndex
+ format: (self instSpecOfClass: classObj)
+ numSlots: numSlots!
Item was changed:
----- Method: SpurMemoryManager>>isClassOfNonImm:equalTo: (in category 'object testing') -----
isClassOfNonImm: objOop equalTo: classOop
+ ^(self classIndexOf: objOop) = (self rawHashBitsOf: classOop)!
- self shouldBeImplemented!
Item was changed:
----- Method: SpurMemoryManager>>isIntegerObject: (in category 'object testing') -----
isIntegerObject: oop
"This list records the valid senders of isIntegerObject: as we replace uses of
isIntegerObject: by isImmediate: where appropriate."
(#( DoIt
DoItIn:
makeBaseFrameFor:
quickFetchInteger:ofObject:
frameOfMarriedContext:
objCouldBeClassObj:
isMarriedOrWidowedContext:
shortPrint:
bytecodePrimAt
bytecodePrimAtPut
commonAt:
commonAtPut:
loadFloatOrIntFrom:
positive32BitValueOf:
primitiveExternalCall
checkedIntegerValueOf:
bytecodePrimAtPut
commonAtPut:
primitiveVMParameter
checkIsStillMarriedContext:currentFP:
displayBitsOf:Left:Top:Right:Bottom:
fetchStackPointerOf:
primitiveContextAt
primitiveContextAtPut
subscript:with:storing:format:
printContext:
compare31or32Bits:equal:
signed64BitValueOf:
primDigitMultiply:negative:
digitLength:
isNegativeIntegerValueOf:
+ magnitude64BitValueOf:
+ primitiveMakePoint) includes: thisContext sender method selector) ifFalse:
- magnitude64BitValueOf:) includes: thisContext sender method selector) ifFalse:
[self halt].
^(oop bitAnd: 1) ~= 0!
Item was added:
+ ----- Method: SpurMemoryManager>>splObj:put: (in category 'interpreter access') -----
+ splObj: index put: anObject
+ "Set one of the objects in the SpecialObjectsArray"
+ self storePointer: index ofObject: specialObjectsOop withValue: anObject!
Item was changed:
----- Method: StackInterpreter>>closureIn:numArgs:instructionPointer:copiedValues: (in category 'control primitives') -----
closureIn: context numArgs: numArgs instructionPointer: initialIP copiedValues: copiedValues
| newClosure numCopied |
<inline: true>
"numCopied should be zero for nil"
numCopied := objectMemory fetchWordLengthOf: copiedValues.
ClassBlockClosureCompactIndex ~= 0
ifTrue:
[newClosure := objectMemory
eeInstantiateClassIndex: ClassBlockClosureCompactIndex
format: objectMemory indexablePointersFormat
numSlots: ClosureFirstCopiedValueIndex + numCopied]
ifFalse:
[newClosure := objectMemory
eeInstantiateSmallClass: (objectMemory splObj: ClassBlockClosure)
+ numSlots: ClosureFirstCopiedValueIndex + numCopied].
- sizeInBytes: (BytesPerWord * (ClosureFirstCopiedValueIndex + numCopied)) + BaseHeaderSize].
"Assume: have just allocated a new closure; it must be young. Thus, can use unchecked stores."
objectMemory
storePointerUnchecked: ClosureOuterContextIndex ofObject: newClosure withValue: context;
storePointerUnchecked: ClosureStartPCIndex ofObject: newClosure withValue: (objectMemory integerObjectOf: initialIP);
storePointerUnchecked: ClosureNumArgsIndex ofObject: newClosure withValue: (objectMemory integerObjectOf: numArgs).
0 to: numCopied - 1 do:
[:i|
objectMemory storePointerUnchecked: i + ClosureFirstCopiedValueIndex
ofObject: newClosure
withValue: (objectMemory fetchPointer: i ofObject: copiedValues)].
^newClosure!
Item was changed:
----- Method: StackInterpreter>>closureIn:numArgs:instructionPointer:numCopiedValues: (in category 'control primitives') -----
closureIn: context numArgs: numArgs instructionPointer: initialIP numCopiedValues: numCopied
| newClosure |
<inline: true>
ClassBlockClosureCompactIndex ~= 0
ifTrue:
[newClosure := objectMemory
eeInstantiateClassIndex: ClassBlockClosureCompactIndex
format: objectMemory indexablePointersFormat
numSlots: ClosureFirstCopiedValueIndex + numCopied]
ifFalse:
+ [newClosure := objectMemory
- [self assert: (BytesPerWord * (ClosureFirstCopiedValueIndex + numCopied)) + BaseHeaderSize <= 252.
- newClosure := objectMemory
eeInstantiateSmallClass: (objectMemory splObj: ClassBlockClosure)
+ numSlots: ClosureFirstCopiedValueIndex + numCopied].
- sizeInBytes: (BytesPerWord * (ClosureFirstCopiedValueIndex + numCopied)) + BaseHeaderSize].
"Assume: have just allocated a new closure; it must be young. Thus, can use unchecked stores."
objectMemory storePointerUnchecked: ClosureOuterContextIndex ofObject: newClosure withValue: context.
objectMemory storePointerUnchecked: ClosureStartPCIndex ofObject: newClosure withValue: (objectMemory integerObjectOf: initialIP).
objectMemory storePointerUnchecked: ClosureNumArgsIndex ofObject: newClosure withValue: (objectMemory integerObjectOf: numArgs).
^newClosure!
Item was changed:
----- Method: StackInterpreter>>makePointwithxValue:yValue: (in category 'utilities') -----
makePointwithxValue: xValue yValue: yValue
+ "make a Point xValue@yValue.
+ We know both will be integers so no value nor root checking is needed"
- "make a Point xValue@yValue.
- We know both will be integers so no value nor root checking is needed"
| pointResult |
+ pointResult := objectMemory eeInstantiateSmallClass: (objectMemory splObj: ClassPoint) numSlots: YIndex + 1.
- pointResult := objectMemory eeInstantiateSmallClass: (objectMemory splObj: ClassPoint) sizeInBytes: 3*BytesPerWord.
objectMemory storePointerUnchecked: XIndex ofObject: pointResult withValue: (objectMemory integerObjectOf: xValue).
objectMemory storePointerUnchecked: YIndex ofObject: pointResult withValue: (objectMemory integerObjectOf: yValue).
+ ^pointResult!
- ^ pointResult!
Revision: 2784
Author: rowledge
Date: 2013-09-18 18:07:31 -0700 (Wed, 18 Sep 2013)
Log Message:
-----------
bring RISC OS src up to date
Modified Paths:
--------------
trunk/platforms/RiscOS/misc/ToCopy/!Squeak/!Help
trunk/platforms/RiscOS/misc/ToCopy/!Squeak/!run
trunk/platforms/RiscOS/vm/sqRPCEvents.c
Added Paths:
-----------
trunk/platforms/RiscOS/plugins/SoundPlugin/sqRPCSound.h
Modified: trunk/platforms/RiscOS/misc/ToCopy/!Squeak/!Help
===================================================================
--- trunk/platforms/RiscOS/misc/ToCopy/!Squeak/!Help 2013-09-10 23:39:47 UTC (rev 2783)
+++ trunk/platforms/RiscOS/misc/ToCopy/!Squeak/!Help 2013-09-19 01:07:31 UTC (rev 2784)
@@ -3,12 +3,14 @@
What is this?
-------------
-This is the RISC OS port of Squeak 3.9, a public domain Smalltalk system.
+This is the RISC OS port of Squeak 4.4, a public domain Smalltalk system.
Updates, patches etc are available from:
http://www.rowledge.org/tim/squeak
-as and when I can make time to produce then. The main website for the Squeak project is:
+as and when I can make time to produce them.
+
+The main website for the Squeak project is:
http://www.squeak.org
-and I suggest you take a look there.
+and I suggest you take a look there for news, discussion forums and links.
Information herein
------------------
@@ -21,7 +23,7 @@
What is Smalltalk?
------------------
-Smalltalk is the original object oriented programming language and environment from which most OSs have learnt about windowing, pixel displays, menus and so on. You will need to read about Smalltalk to make best use of it, since it is likely to be quite unfamiliar to you at first.
+Smalltalk is the original object oriented programming language and environment from which most OSs have learnt about windowing, pixel displays, menus and so on. You will need to read about Smalltalk to make best use of it, since it is likely to be quite unfamiliar to you at first. See below for some links.
Be warned, the user interface is not quite like RISC OS; in particular:-
a) the right hand mouse button is NOT used as 'adjust', but to operate on the window currently active; thus serving many of the functions of the window icons under RISC OS.
@@ -67,21 +69,22 @@
Oddities and Known problems with this release
=============================================
-File naming is a problem. Squeak is ported to many machines and far too many people make bad assumptions about the permissable form of file names. RISC OS is the only popular OS to have problems with long filenames (in pre-RISC OS 4 systems), '.' used for filename extensions etc. This shouldn't be a problem in an object oriented system, since we should be able to catch bad behaviour and correct the file names, but there are many places currently in the system where something like 'fred the great.text' is used as a filename.
+File naming can be a problem. Squeak is ported to many machines and far too many people make bad assumptions about the permissable form of file names and how they are constructed. This shouldn't be a problem in an object oriented system, since we should be able to catch bad behaviour and correct the file names, but there are many places currently in the system where something like 'fred the great.text' is used as a filename.
To get around this problem, I have made Squeak accept Unix style filenames, ie use a '/' as the directory separator and '.' for filename extensions. This is a minor inconvenience in that you have to remember the change from normal RISC OS practice, but we are all getting used to URLs anyway, so it should not be too painful. It does at least save most of the filename troubles with Squeak code.
At various times Squeak expects to be able to open a file for read/write and read-only at the same time. RISC OS doesn't support this and so I have had to implement a way to fake it. So far this seems reliable but let me know of problems.
-No iconbar menu yet. However, you can bring the Squeak window to the front by clicking on the Squeak iconbar icon.
+There is no iconbar menu yet. However, you can bring the Squeak window to the front by clicking on the Squeak iconbar icon. I'm not really sure what we would put in an iconbar menu, anyway.
-Hotkeys don't work quite like in RISC OS. Again, since Squeak was first created on a Mac, it is rather biased towards the Mac keyboard layout and shortcuts. Mac's have both a 'cmd' key and a 'ctl' key (and the 'option' key of course but won't worry about that for now) and RPCs have 'ctl' and 'alt' keys. Sadly, we can't map one to the other in a simple way since there are no keypress events generated for most alt-keys. So to get around this I have separated out the left and right ctl keys. The LEFT one is used for 'ctl' (think controL) and the RIGHT for 'cmd' (think commanD => dexter => right). There are still some confusions beyond this in that there are shift-cmd hotkeys available in Squeak, but the ctl key can be used to access them as well.
-New for 3.7 is a commandline option to swap these two in case you find it more convenient. Add the flag '-swapMeta' to the final line of the !Run file.
+Hotkeys don't work quite like in RISC OS. Again, since Squeak was first created on a Mac, it is rather biased towards the Mac keyboard layout and shortcuts. Mac's have both a 'cmd' key and a 'ctl' key (and the 'option' key of course but won't worry about that for now) and RISC OS understands 'ctl' and 'alt' keys. Sadly, we can't map one to the other in a simple way since there are no keypress events generated for most alt-keys. So to get around this I have separated out the left and right ctl keys. The LEFT one is used for 'ctl' (think controL) and the RIGHT for 'cmd' (think commanD => dexter => right). There are still some confusions beyond this in that there are shift-cmd hotkeys available in Squeak, but the ctl key can be used to access them as well.
+There is a commandline option to swap these two in case you find it more convenient. Add the flag '-swapMeta' to the final line of the !Run file. If you don't know what a !run file is, don't worry about it for now.
-There is a help window that describes the available hotkeys (use the screen menu, choose 'help...' then 'command key help') that should give you some assistance in understanding things. The ctl-<, ctl-= and cmd-shift-+ actions don't work because RiscOS doesn't generate keypress event for those keys.
+There is a Squeak help window that describes the available hotkeys (use the Squeak screen menu, choose 'help...' then 'command key help') that should give you some assistance in understanding things. The ctl-<, ctl-= and cmd-shift-+ actions don't work because RiscOS doesn't generate keypress event for those keys.
-Sound is not hooked up yet. Serial ports neither. Nor MIDI. Bummer. Volunteer to help fix this!
+Sound suport has been added as of the 4.0 release; Squeak has had sound since 1996 but I didn't get around to adding it for RISC OS until recently.
+Serial ports are not supported. Nor MIDI. Bummer. Volunteer to help fix this!
-Window resizing - as in the RISC OS window holding all the Squeak windows - is a little non-standard. To resize the window, hold down a ctrl key and press the SELECT mouse button in the bottom right corner (within 15 pixels) and drag to the new size. It will take a moment for the display to catch up with the change so don't worry.
+Window resizing - as in resizing the RISC OS window holding all the Squeak windows - is a little non-standard. To resize the window, hold down a ctrl key and press the SELECT mouse button in the bottom right corner (within 15 pixels) and drag to the new size. It will take a moment for the display to catch up with the change so don't worry.
Quitting Squeak. Normally one uses the main World Menu and chooses 'quit', 'save and quit' or whatever. If you have a problem and the system is not responding you can also close the Squeak window the normal way and 'accept' in the resulting confirmation dialogue.
Modified: trunk/platforms/RiscOS/misc/ToCopy/!Squeak/!run
===================================================================
--- trunk/platforms/RiscOS/misc/ToCopy/!Squeak/!run 2013-09-10 23:39:47 UTC (rev 2783)
+++ trunk/platforms/RiscOS/misc/ToCopy/!Squeak/!run 2013-09-19 01:07:31 UTC (rev 2784)
@@ -23,7 +23,7 @@
| Specify amount of free space to attempt to allocate for Squeak's object
| memory. More will be claimed for the display sprite that is used.
| 15m == 15 MB, for example.
-| I recommend a setting of around double the image file size
+| I recommend a setting of around treble the image file size
| -useDA
| force use of DynamicArea memory even if you are on RISC OS 5 and
| Aemulor is not running.
@@ -40,4 +40,4 @@
| imageoption - any words following will be available to the image via
| Smalltalk getSystemAttribute: -{1000, 1}
/<Squeak$Dir>.!Boot
-/<Squeak$Dir>.!RunImage -memory:60m %*0
\ No newline at end of file
+/<Squeak$Dir>.!RunImage -memory:160m %*0
\ No newline at end of file
Added: trunk/platforms/RiscOS/plugins/SoundPlugin/sqRPCSound.h
===================================================================
--- trunk/platforms/RiscOS/plugins/SoundPlugin/sqRPCSound.h (rev 0)
+++ trunk/platforms/RiscOS/plugins/SoundPlugin/sqRPCSound.h 2013-09-19 01:07:31 UTC (rev 2784)
@@ -0,0 +1,74 @@
+// A Squeak VM for RiscOS machines
+// Suited to RISC OS > 4, preferably > 5
+// See www.squeak.org for much more information
+//
+// tim Rowledge tim(a)rowledge.org
+//
+// License: MIT License -
+// Copyright (C) <2013> <tim rowledge>
+//
+// Permission is hereby granted, free of charge, to any person obtaining a
+// copy of this software and associated documentation files (the "Software"),
+// to deal in the Software without restriction, including without limitation
+// the rights to use, copy, modify, merge, publish, distribute, sublicense,
+// and/or sell copies of the Software, and to permit persons to whom the
+// Software is furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
+// THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
+// FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
+// DEALINGS IN THE SOFTWARE.
+// This is sqRPCSound.c
+// It provides Squeak with access to the RISC OS sound system as
+// implemented by John Duffell's very neat SharedSoundBuffer/StreamManager
+// modules.. Furthermore, my understanding of how to make use of John's modules
+// relied on reading Andrew Sellors excellent code for !RDPClient.
+// Thank you both.
+
+#define SOUND_HEAP_MAX_SIZE 4096 * 1024
+#define SOUND_DA_MAX_SIZE 4096 * 1024
+#define SOUND_BLOCK_SIZE 32764
+#define BYTESPERSAMPLE 4
+#define BYTESFROMSAMPLES(numsample) (numsample * BYTESPERSAMPLE)
+#define SOUND_BUFFER_SIZE(numsamples) (4* BYTESFROMSAMPLES(numsamples))
+
+#ifndef SWI_XOS_Bit
+#define SWI_XOS_Bit 0x020000
+#endif
+
+#define SWI_SharedSoundBuffer_OpenStream 0x55FC0 /* Opens a stream */
+#define SWI_SharedSoundBuffer_CloseStream 0x55FC1 /* Closes and stops a stream immediately */
+#define SWI_SharedSoundBuffer_AddBlock 0x55FC2 /* Adds a block to a stream's queue */
+#define SWI_SharedSoundBuffer_PollWord 0x55FC3 /* Sets up the buffer pollword */
+#define SWI_SharedSoundBuffer_Volume 0x55FC4 /* Set the volume of output */
+#define SWI_SharedSoundBuffer_SampleRate 0x55FC5 /* Set the sample rate */
+#define SWI_SharedSoundBuffer_ReturnSSHandle 0x55FC6 /* Return the internal SharedSound handle */
+#define SWI_SharedSoundBuffer_SetBuffer 0x55FC7 /* Set the stream buffer limit */
+#define SWI_SharedSoundBuffer_BufferStats 0x52E08 /* Find out information about the buffer */
+#define SWI_SharedSoundBuffer_Pause 0x55FC9 /* Pauses playback */
+#define SWI_SharedSoundBuffer_StreamEnd 0x55FCA /* Closes a stream */
+#define SWI_SharedSoundBuffer_Flush 0x55fcc
+#define SWI_SharedSoundBuffer_BlockFilled 0x55fcd
+#define SWI_SharedSoundBuffer_ReturnStreamHandle 0x55fce
+
+
+#define SWI_StreamManager_OpenStream 0x57280
+#define SWI_StreamManager_CloseStream 0x57281
+#define SWI_StreamManager_AddBlock 0x57282
+#define SWI_StreamManager_BlockFilled 0x57283
+#define SWI_StreamManager_GetBlock 0x57284
+#define SWI_StreamManager_FreeBlocks 0x57285
+#define SWI_StreamManager_SrcPollWord 0x57286
+#define SWI_StreamManager_SetBuffer 0x57287
+#define SWI_StreamManager_BufferStats 0x57288
+#define SWI_StreamManager_Mark 0x57289
+#define SWI_StreamManager_Flush 0x5728a
+#define SWI_StreamManager_DestPollWord 0x5728b
+#define SWI_StreamManager_SetDALimits 0x5728c
+
Property changes on: trunk/platforms/RiscOS/plugins/SoundPlugin/sqRPCSound.h
___________________________________________________________________
Added: svn:riscosfiletype
+ FFF
Modified: trunk/platforms/RiscOS/vm/sqRPCEvents.c
===================================================================
--- trunk/platforms/RiscOS/vm/sqRPCEvents.c 2013-09-10 23:39:47 UTC (rev 2783)
+++ trunk/platforms/RiscOS/vm/sqRPCEvents.c 2013-09-19 01:07:31 UTC (rev 2784)
@@ -981,7 +981,7 @@
};
#endif
if (iebEmptyP()) {
- HandleEvents();
+ HandleEventsNotTooOften();
forceInterruptCheck(); /* handleevents can take a while */
}
if (iebEmptyP()) return false;
@@ -1013,7 +1013,7 @@
*/
//PRINTF(("\\t relinq %d\n", microSeconds));
/* HandleEventsWithWait(microSeconds); */
- HandleEvents();
+ HandleEventsNotTooOften();
forceInterruptCheck();
return microSeconds;
}
@@ -1025,7 +1025,7 @@
* the image is up to. We don't force an interrupt check here because we're
* in the middle of one already
*/
- HandleEvents();
+ HandleEventsNotTooOften();
return true;
}