[Vm-dev] [commit][3481] JMM - adjustments to arc/nonarc via Nicolas Cellier, 64bit cleanup, fix zombie at quit time SQK-21

commits at squeakvm.org commits at squeakvm.org
Mon Nov 2 00:02:56 UTC 2015


Revision: 3481
Author:   johnmci
Date:     2015-11-01 16:02:54 -0800 (Sun, 01 Nov 2015)
Log Message:
-----------
JMM - adjustments to arc/nonarc via Nicolas Cellier, 64bit cleanup, fix zombie at quit time SQK-21

Modified Paths:
--------------
    branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.xcodeproj/project.pbxproj
    branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.xcworkspace/xcuserdata/johnmci.xcuserdatad/UserInterfaceState.xcuserstate
    branches/Cog/build.macos64x64/squeak.stack.spur/SqueakPureObjcCog.xcodeproj/project.xcworkspace/xcuserdata/johnmci.xcuserdatad/UserInterfaceState.xcuserstate
    branches/Cog/build.macos64x64/squeak.stack.spur/SqueakPureObjc_Prefix.pch
    branches/Cog/platforms/Mac OS/plugins/MIDIPlugin/sqMacMIDI.c
    branches/Cog/platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.h
    branches/Cog/platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.m
    branches/Cog/platforms/iOS/plugins/MIDIPlugin/sqMacMIDI.m
    branches/Cog/platforms/iOS/plugins/MacMenubarPlugin/MacMenuOS9ToOSX.m
    branches/Cog/platforms/iOS/plugins/MacMenubarPlugin/MacMenubarPlugin.h
    branches/Cog/platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.m
    branches/Cog/platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.m
    branches/Cog/platforms/iOS/vm/Common/Classes/Queue.m
    branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.m
    branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m
    branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m
    branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.m
    branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m
    branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.m
    branches/Cog/platforms/iOS/vm/OSX/SqViewBitmapConversion.m
    branches/Cog/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m
    branches/Cog/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.m
    branches/Cog/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m
    branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+clipboard.m
    branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+cursor.m
    branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m
    branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m
    branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m
    branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXFileDirectoryInterface.m
    branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m
    branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m
    branches/Cog/platforms/iOS/vm/SqueakPureObjc_Prefix.pch
    branches/Cog/platforms/iOS/vm/iPhone/sqMacV2Memory.c
    branches/Cog/platforms/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c
    branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c

Modified: branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.xcodeproj/project.pbxproj
===================================================================
--- branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.xcodeproj/project.pbxproj	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.xcodeproj/project.pbxproj	2015-11-02 00:02:54 UTC (rev 3481)
@@ -11,9 +11,9 @@
 		9402DD7010CE0E91005C2102 /* SqViewClut.m in Sources */ = {isa = PBXBuildFile; fileRef = 9402DD6F10CE0E91005C2102 /* SqViewClut.m */; };
 		9422C3B51AFFFAC500448DC0 /* Localizable.strings in Resources */ = {isa = PBXBuildFile; fileRef = 9422C3B31AFFFAC500448DC0 /* Localizable.strings */; };
 		943B9CA11235C5120056205E /* sqMacHostWindow.m in Sources */ = {isa = PBXBuildFile; fileRef = 943B9C9E1235C5120056205E /* sqMacHostWindow.m */; };
-		944154941BD595710062FCDE /* sqMacUnixExternalPrims.m in Sources */ = {isa = PBXBuildFile; fileRef = 946DA9FF10C0D35500F26F56 /* sqMacUnixExternalPrims.m */; settings = {ASSET_TAGS = (); }; };
-		94502E951BB609AC00EA8942 /* sqUnixSpurMemory.c in Sources */ = {isa = PBXBuildFile; fileRef = 94502E941BB609AC00EA8942 /* sqUnixSpurMemory.c */; settings = {ASSET_TAGS = (); }; };
-		94502E971BB71A9200EA8942 /* sqSqueakMainApplication+imageReadWrite.m in Sources */ = {isa = PBXBuildFile; fileRef = 94A0E8840DE5EF430071C8B9 /* sqSqueakMainApplication+imageReadWrite.m */; settings = {ASSET_TAGS = (); }; };
+		944154941BD595710062FCDE /* sqMacUnixExternalPrims.m in Sources */ = {isa = PBXBuildFile; fileRef = 946DA9FF10C0D35500F26F56 /* sqMacUnixExternalPrims.m */; };
+		94502E951BB609AC00EA8942 /* sqUnixSpurMemory.c in Sources */ = {isa = PBXBuildFile; fileRef = 94502E941BB609AC00EA8942 /* sqUnixSpurMemory.c */; };
+		94502E971BB71A9200EA8942 /* sqSqueakMainApplication+imageReadWrite.m in Sources */ = {isa = PBXBuildFile; fileRef = 94A0E8840DE5EF430071C8B9 /* sqSqueakMainApplication+imageReadWrite.m */; };
 		94584FDB10F02378001401E7 /* sqMacExtendedClipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 94584FD910F02378001401E7 /* sqMacExtendedClipboard.m */; };
 		9463C1BF1AEE13F3009C5CE5 /* ADPCMCodecPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 94E658E40DDD03FE00358328 /* ADPCMCodecPlugin.c */; };
 		9463C1C01AEE145C009C5CE5 /* B2DPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 94E658E60DDD03FE00358328 /* B2DPlugin.c */; };
@@ -171,11 +171,11 @@
 		949382791B001C7A00C802B2 /* sqSqueakOSXInfoPlistInterface.m in Sources */ = {isa = PBXBuildFile; fileRef = 94BCAE6810ACA10100F87527 /* sqSqueakOSXInfoPlistInterface.m */; };
 		9493827A1B001C7E00C802B2 /* sqSqueakInfoPlistInterface.m in Sources */ = {isa = PBXBuildFile; fileRef = 9412CAE50E6C05EC00DB8625 /* sqSqueakInfoPlistInterface.m */; };
 		94B9533510E6BD7100DC476A /* MacMenuOS9ToOSX.m in Sources */ = {isa = PBXBuildFile; fileRef = 94B9533410E6BD7100DC476A /* MacMenuOS9ToOSX.m */; };
-		94BB096E1BB47DDB0016BFDF /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94BB096B1BB47DDB0016BFDF /* Security.framework */; settings = {ASSET_TAGS = (); }; };
+		94BB096E1BB47DDB0016BFDF /* Security.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94BB096B1BB47DDB0016BFDF /* Security.framework */; };
 		94BB09721BB47F9B0016BFDF /* libz.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 94BB09711BB47F9B0016BFDF /* libz.tbd */; };
 		94BB09741BB47FB20016BFDF /* libstdc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 94BB09731BB47FB20016BFDF /* libstdc++.tbd */; };
 		94BB09761BB47FCD0016BFDF /* libc++.tbd in Frameworks */ = {isa = PBXBuildFile; fileRef = 94BB09751BB47FCD0016BFDF /* libc++.tbd */; };
-		94BB09781BB480AC0016BFDF /* HostWindowPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 94E658FA0DDD03FE00358328 /* HostWindowPlugin.c */; settings = {ASSET_TAGS = (); }; };
+		94BB09781BB480AC0016BFDF /* HostWindowPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 94E658FA0DDD03FE00358328 /* HostWindowPlugin.c */; };
 		94C315341AD4949B0096E59D /* AsynchFilePlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 94C315311AD4949B0096E59D /* AsynchFilePlugin.c */; };
 		94C317511AD495CD0096E59D /* JoystickTabletPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 94C317491AD495CD0096E59D /* JoystickTabletPlugin.c */; };
 		94C317541AD495CD0096E59D /* LocalePlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 94C3174B1AD495CD0096E59D /* LocalePlugin.c */; };
@@ -191,14 +191,14 @@
 		94D921571AC6321800A5970F /* LargeIntegers.c in Sources */ = {isa = PBXBuildFile; fileRef = 94E659040DDD03FE00358328 /* LargeIntegers.c */; };
 		94D921581AC6321E00A5970F /* ZipPlugin.c in Sources */ = {isa = PBXBuildFile; fileRef = 94E6591F0DDD03FE00358328 /* ZipPlugin.c */; };
 		94D9215B1AC6337D00A5970F /* sqManualSurface.c in Sources */ = {isa = PBXBuildFile; fileRef = 94BD816F11C8A58D00556751 /* sqManualSurface.c */; };
-		94F478C91BB527440069E57B /* gcc3x-cointerp.c in Sources */ = {isa = PBXBuildFile; fileRef = 94F478C51BB527440069E57B /* gcc3x-cointerp.c */; settings = {ASSET_TAGS = (); }; };
-		94F478D01BB52D8D0069E57B /* cogitIA32.c in Sources */ = {isa = PBXBuildFile; fileRef = 94F478CA1BB52D3A0069E57B /* cogitIA32.c */; settings = {ASSET_TAGS = (); }; };
-		94FA4CD51BB4D43900C1BE8F /* b3dAlloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 94E659980DDD053900358328 /* b3dAlloc.c */; settings = {ASSET_TAGS = (); }; };
-		94FA4CD61BB4D43900C1BE8F /* b3dDraw.c in Sources */ = {isa = PBXBuildFile; fileRef = 94E6599A0DDD053900358328 /* b3dDraw.c */; settings = {ASSET_TAGS = (); }; };
-		94FA4CD71BB4D43900C1BE8F /* b3dMain.c in Sources */ = {isa = PBXBuildFile; fileRef = 94E6599C0DDD053900358328 /* b3dMain.c */; settings = {ASSET_TAGS = (); }; };
-		94FA4CD81BB4D43900C1BE8F /* b3dRemap.c in Sources */ = {isa = PBXBuildFile; fileRef = 94E6599D0DDD053900358328 /* b3dRemap.c */; settings = {ASSET_TAGS = (); }; };
+		94F478C91BB527440069E57B /* gcc3x-cointerp.c in Sources */ = {isa = PBXBuildFile; fileRef = 94F478C51BB527440069E57B /* gcc3x-cointerp.c */; };
+		94F478D01BB52D8D0069E57B /* cogitIA32.c in Sources */ = {isa = PBXBuildFile; fileRef = 94F478CA1BB52D3A0069E57B /* cogitIA32.c */; };
+		94FA4CD51BB4D43900C1BE8F /* b3dAlloc.c in Sources */ = {isa = PBXBuildFile; fileRef = 94E659980DDD053900358328 /* b3dAlloc.c */; };
+		94FA4CD61BB4D43900C1BE8F /* b3dDraw.c in Sources */ = {isa = PBXBuildFile; fileRef = 94E6599A0DDD053900358328 /* b3dDraw.c */; };
+		94FA4CD71BB4D43900C1BE8F /* b3dMain.c in Sources */ = {isa = PBXBuildFile; fileRef = 94E6599C0DDD053900358328 /* b3dMain.c */; };
+		94FA4CD81BB4D43900C1BE8F /* b3dRemap.c in Sources */ = {isa = PBXBuildFile; fileRef = 94E6599D0DDD053900358328 /* b3dRemap.c */; };
 		94FA4CE31BB4DD9000C1BE8F /* OpenGL.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 94329ECA12275FFA0090298B /* OpenGL.framework */; };
-		94FA4CE51BB4DE1400C1BE8F /* Images-2.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 94FA4CE41BB4DE1400C1BE8F /* Images-2.xcassets */; settings = {ASSET_TAGS = (); }; };
+		94FA4CE51BB4DE1400C1BE8F /* Images-2.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 94FA4CE41BB4DE1400C1BE8F /* Images-2.xcassets */; };
 		94FE5EC31B7A6232000D6014 /* sqSqueakOSXCGView.m in Sources */ = {isa = PBXBuildFile; fileRef = 94FE5EC21B7A6232000D6014 /* sqSqueakOSXCGView.m */; };
 /* End PBXBuildFile section */
 
@@ -1862,7 +1862,6 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CLANG_ENABLE_OBJC_ARC = NO;
 				CLANG_USE_OPTIMIZATION_PROFILE = NO;
-				CODE_SIGN_IDENTITY = "Developer ID Application";
 				COMBINE_HIDPI_IMAGES = YES;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",
@@ -1886,7 +1885,7 @@
 				OTHER_CFLAGS = "";
 				PRODUCT_BUNDLE_IDENTIFIER = org.squeak.osx3286.cog;
 				PRODUCT_NAME = Squeak;
-				PROVISIONING_PROFILE = "a81f3cd0-20de-4e0b-b7a8-a98bcd57ec0c";
+				PROVISIONING_PROFILE = "";
 			};
 			name = Debug;
 		};
@@ -1897,7 +1896,6 @@
 				ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
 				CLANG_ENABLE_OBJC_ARC = NO;
 				CLANG_USE_OPTIMIZATION_PROFILE = NO;
-				CODE_SIGN_IDENTITY = "Developer ID Application";
 				COMBINE_HIDPI_IMAGES = YES;
 				FRAMEWORK_SEARCH_PATHS = (
 					"$(inherited)",

Modified: branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.xcworkspace/xcuserdata/johnmci.xcuserdatad/UserInterfaceState.xcuserstate
===================================================================
(Binary files differ)

Modified: branches/Cog/build.macos64x64/squeak.stack.spur/SqueakPureObjcCog.xcodeproj/project.xcworkspace/xcuserdata/johnmci.xcuserdatad/UserInterfaceState.xcuserstate
===================================================================
(Binary files differ)

Modified: branches/Cog/build.macos64x64/squeak.stack.spur/SqueakPureObjc_Prefix.pch
===================================================================
--- branches/Cog/build.macos64x64/squeak.stack.spur/SqueakPureObjc_Prefix.pch	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/build.macos64x64/squeak.stack.spur/SqueakPureObjc_Prefix.pch	2015-11-02 00:02:54 UTC (rev 3481)
@@ -5,3 +5,15 @@
 #ifdef __OBJC__
     #import <Cocoa/Cocoa.h>
 #endif
+
+#if __has_feature(objc_arc)
+#define RELEASEOBJ(x)
+#define RETAINOBJ(x) x
+#define AUTORELEASEOBJ(x) x
+#define SUPERDEALLOC
+#else
+#define RELEASEOBJ(x) [x release]
+#define RETAINOBJ(x) [x retain]
+#define AUTORELEASEOBJ(x) [x autorelease]
+#define SUPERDEALLOC [super dealloc];
+#endif
\ No newline at end of file

Modified: branches/Cog/platforms/Mac OS/plugins/MIDIPlugin/sqMacMIDI.c
===================================================================
--- branches/Cog/platforms/Mac OS/plugins/MIDIPlugin/sqMacMIDI.c	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/Mac OS/plugins/MIDIPlugin/sqMacMIDI.c	2015-11-02 00:02:54 UTC (rev 3481)
@@ -290,7 +290,7 @@
 	}
 }
 
-int sqMIDIGetPortName(int portNum, int namePtr, int length) {
+int sqMIDIGetPortName(int portNum, char * namePtr, int length) {
 /* Copy the name of the given MIDI port into the string at the given
    address. Copy at most length characters, and return the number of
    characters copied. Fail if there is no port of the given number.*/
@@ -427,7 +427,7 @@
 	return 0;
 }
 
-int sqMIDIPortReadInto(int portNum, int count, int bufferPtr) {
+int sqMIDIPortReadInto(int portNum, int count, char * bufferPtr) {
 /* bufferPtr is the address of the first byte of a Smalltalk
    ByteArray of the given length. Copy up to (length - 4) bytes
    of incoming MIDI data into that buffer, preceded by a 4-byte
@@ -456,7 +456,7 @@
 	return bytesRead + 4;
 }
 
-int sqMIDIPortWriteFromAt(int portNum, int count, int bufferPtr, int time) {
+int sqMIDIPortWriteFromAt(int portNum, int count, char *bufferPtr, int time) {
 /* bufferPtr is the address of the first byte of a Smalltalk
    ByteArray of the given length. Send its contents to the given
    port when the MIDI clock reaches the given time. If time equals

Modified: branches/Cog/platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.h
===================================================================
--- branches/Cog/platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.h	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.h	2015-11-02 00:02:54 UTC (rev 3481)
@@ -30,6 +30,7 @@
 /* The virtual machine proxy definition */
 #include "sqVirtualMachine.h"
 #ifdef BUILD_FOR_OSX
+#import <Cocoa/Cocoa.h>
 typedef NSPasteboard * CLIPBOARDTYPE;
 #else
 typedef UIPasteboard * CLIPBOARDTYPE;

Modified: branches/Cog/platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.m
===================================================================
--- branches/Cog/platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/plugins/ClipboardExtendedPlugin/sqMacExtendedClipboard.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -75,8 +75,8 @@
 
 void sqPasteboardPutItemFlavordatalengthformatTypeformatLength ( CLIPBOARDTYPE inPasteboard, char* inData, sqInt dataLength, char* format, sqInt formatLength)
 {
-    NSString *formatType = [[[NSString alloc] initWithBytes: format length: formatLength encoding:  NSUTF8StringEncoding] AUTORELEASEOBJ];
-    NSData* data = [[[NSData alloc ] initWithBytes: inData length: dataLength] AUTORELEASEOBJ];
+    NSString *formatType = AUTORELEASEOBJ([[NSString alloc] initWithBytes: format length: formatLength encoding:  NSUTF8StringEncoding]);
+    NSData* data = AUTORELEASEOBJ([[NSData alloc ] initWithBytes: inData length: dataLength]);
     NSArray *arrayOfTypes = @[formatType];
     
     [inPasteboard declareTypes: arrayOfTypes owner: nil];
@@ -86,7 +86,7 @@
 
 sqInt sqPasteboardCopyItemFlavorDataformatformatLength ( CLIPBOARDTYPE inPasteboard, char* format, sqInt formatLength)
 {
-    NSString *formatType = [[[NSString alloc] initWithBytes: format length: formatLength encoding:  NSUTF8StringEncoding] AUTORELEASEOBJ];
+    NSString *formatType = AUTORELEASEOBJ([[NSString alloc] initWithBytes: format length: formatLength encoding:  NSUTF8StringEncoding]);
     NSArray *arrayOfTypes = @[formatType];
     NSString     *type= [inPasteboard availableTypeFromArray: arrayOfTypes];
     

Modified: branches/Cog/platforms/iOS/plugins/MIDIPlugin/sqMacMIDI.m
===================================================================
--- branches/Cog/platforms/iOS/plugins/MIDIPlugin/sqMacMIDI.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/plugins/MIDIPlugin/sqMacMIDI.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -291,7 +291,7 @@
 	}
 }
 
-int sqMIDIGetPortName(int portNum, int namePtr, int length) {
+int sqMIDIGetPortName(int portNum, char * namePtr, int length) {
 /* Copy the name of the given MIDI port into the string at the given
    address. Copy at most length characters, and return the number of
    characters copied. Fail if there is no port of the given number.*/
@@ -428,7 +428,7 @@
 	return 0;
 }
 
-int sqMIDIPortReadInto(int portNum, int count, int bufferPtr) {
+int sqMIDIPortReadInto(int portNum, int count, char * bufferPtr) {
 /* bufferPtr is the address of the first byte of a Smalltalk
    ByteArray of the given length. Copy up to (length - 4) bytes
    of incoming MIDI data into that buffer, preceded by a 4-byte
@@ -457,7 +457,7 @@
 	return bytesRead + 4;
 }
 
-int sqMIDIPortWriteFromAt(int portNum, int count, int bufferPtr, int time) {
+int sqMIDIPortWriteFromAt(int portNum, int count, char * bufferPtr, int time) {
 /* bufferPtr is the address of the first byte of a Smalltalk
    ByteArray of the given length. Send its contents to the given
    port when the MIDI clock reaches the given time. If time equals

Modified: branches/Cog/platforms/iOS/plugins/MacMenubarPlugin/MacMenuOS9ToOSX.m
===================================================================
--- branches/Cog/platforms/iOS/plugins/MacMenubarPlugin/MacMenuOS9ToOSX.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/plugins/MacMenubarPlugin/MacMenuOS9ToOSX.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -7,6 +7,7 @@
 //
 
 #import "MacMenuOS9ToOSX.h"
+#import <Cocoa/Cocoa.h>
 
 
 Boolean ioCheckMenuHandle(MenuHandle menuHandle) {

Modified: branches/Cog/platforms/iOS/plugins/MacMenubarPlugin/MacMenubarPlugin.h
===================================================================
--- branches/Cog/platforms/iOS/plugins/MacMenubarPlugin/MacMenubarPlugin.h	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/plugins/MacMenubarPlugin/MacMenubarPlugin.h	2015-11-02 00:02:54 UTC (rev 3481)
@@ -34,7 +34,7 @@
 
 
 Boolean ioCheckMenuHandle(MenuHandle menuHandle);
-#define TARGET_API_MAC_CARBON 1
+//#define TARGET_API_MAC_CARBON 1
 #define kHICommandHide 'hide'
 
 MenuRef GetMenuHandle(MenuID menuID);

Modified: branches/Cog/platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.m
===================================================================
--- branches/Cog/platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/plugins/SoundPlugin/sqSqueakSoundCoreAudio.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -59,6 +59,7 @@
 			atom = [myInstance.soundOutQueue returnAndRemoveOldest];
 			inBuffer->mAudioDataByteSize = (int) atom.byteCount;
 			memcpy(inBuffer->mAudioData,atom.data,atom.byteCount);
+            RELEASEOBJ(atom);
 //NSLog(@"%i Fill sound buffer with %i bytesA",ioMSecs(),inBuffer->mAudioDataByteSize);
 		} else {
 			inBuffer->mAudioDataByteSize = (int) MIN(atom.byteCount - atom.startOffset,inBuffer->mAudioDataBytesCapacity);
@@ -66,6 +67,7 @@
 			atom.startOffset = atom.startOffset + inBuffer->mAudioDataByteSize;
 			if (atom.startOffset == atom.byteCount) {
 				atom = [myInstance.soundOutQueue returnAndRemoveOldest]; //ignore now it's empty
+                RELEASEOBJ(atom);
 			}
 //NSLog(@"%i Fill sound buffer with %i bytesB",ioMSecs(),inBuffer->mAudioDataByteSize);
 		}
@@ -114,7 +116,7 @@
 		return;
 	
 	if (inNumberPacketDescriptions > 0) {
-		soundAtom *atom = [[[soundAtom alloc] initWith: inBuffer->mAudioData count: inBuffer->mAudioDataByteSize] AUTORELEASEOBJ];
+		soundAtom *atom = AUTORELEASEOBJ([[soundAtom alloc] initWith: inBuffer->mAudioData count: inBuffer->mAudioDataByteSize]);
 		[myInstance.soundInQueue addItem: atom];
     }
 	
@@ -281,7 +283,7 @@
 	OSStatus result  = AudioQueueDispose (self.outputAudioQueue,true);
 #pragma unused(result)
 	self.outputAudioQueue = nil;
-	self.soundOutQueue = [[[Queue alloc] init] AUTORELEASEOBJ];
+	self.soundOutQueue = AUTORELEASEOBJ([[Queue alloc] init]);
 	return 1;
 }
 
@@ -308,7 +310,7 @@
 		return interpreterProxy->primitiveFail();
 	//NSLog(@"%i sound place samples on queue frames %i startIndex %i count %i",ioMSecs(),frameCount,startIndex,byteCount-startIndex);
 		
-	soundAtom *atom = [[[soundAtom alloc] initWith: arrayIndex+startIndex count: (unsigned) (byteCount-startIndex)] AUTORELEASEOBJ];
+	soundAtom *atom = AUTORELEASEOBJ([[soundAtom alloc] initWith: arrayIndex+startIndex count: (unsigned) (byteCount-startIndex)]);
 	[self.soundOutQueue addItem: atom];
 	
 	if (!self.outputIsRunning) {
@@ -396,7 +398,7 @@
 		return 0;
 	result = AudioQueueDispose (self.inputAudioQueue,true);
 	self.inputAudioQueue = nil;
-	self.soundInQueue = [[[Queue alloc] init] AUTORELEASEOBJ];
+	self.soundInQueue = AUTORELEASEOBJ([[Queue alloc] init]);
 	return 1;
 }
 
@@ -424,6 +426,7 @@
 		atom = [self.soundInQueue returnAndRemoveOldest];
 		memcpy(arrayIndex+start,atom.data,atom.byteCount);
 		count= MIN(atom.byteCount, bufferSizeInBytes - start);
+        RELEASEOBJ(atom);
 		return count / (SqueakFrameSize / 2) / self.inputChannels;
 	} else {
 		count= MIN(atom.byteCount-atom.startOffset, bufferSizeInBytes - start);
@@ -431,6 +434,7 @@
 		atom.startOffset = atom.startOffset + (count);
 		if (atom.startOffset == atom.byteCount) {
 			atom = [self.soundInQueue returnAndRemoveOldest]; //ignore now it's empty
+            RELEASEOBJ(atom);
 		}
 		return count / (SqueakFrameSize / 2) / self.inputChannels;
 	}

Modified: branches/Cog/platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.m
===================================================================
--- branches/Cog/platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/plugins/SqueakObjectiveC/squeakProxy.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -92,11 +92,11 @@
 		return;
 	}
 	
-	if([lockForSqueak lockWhenCondition: 0 beforeDate: (timeout = [[[NSDate alloc] initWithTimeIntervalSinceNow: 3.0] AUTORELEASEOBJ])])
+	if([lockForSqueak lockWhenCondition: 0 beforeDate: (timeout = AUTORELEASEOBJ([[NSDate alloc] initWithTimeIntervalSinceNow: 3.0]))])
 	{ 
 		// NSLog(@"inside lock 0");
 		[lockForSqueak unlockWithCondition: 1];
-		invocation = [anInvocation RETAINOBJ];
+		invocation = RETAINOBJ(anInvocation);
 		
 		// NSLog(@"signalling squeak");
 		interpreterProxy->signalSemaphoreWithIndex(sem);
@@ -104,7 +104,7 @@
 		if (isCarbonVM)
 			interpreterProxy->callbackEnter(&callbackid);
 		
-		if([lockForSqueak lockWhenCondition: 2 beforeDate: (timeout = [[[NSDate alloc] initWithTimeIntervalSinceNow: 5.0] AUTORELEASEOBJ])] )
+		if([lockForSqueak lockWhenCondition: 2 beforeDate: (timeout = AUTORELEASEOBJ([[NSDate alloc] initWithTimeIntervalSinceNow: 5.0]))] )
 		{
 			// NSLog(@"inside lock 2");
 			invocation = nil;
@@ -189,9 +189,9 @@
 
 - (void) dealloc
 {
-    [lockForSqueak RELEASEOBJ];
-    [sigs RELEASEOBJ];
-    [target RELEASEOBJ];
+    RELEASEOBJ(lockForSqueak);
+    RELEASEOBJ(sigs);
+    RELEASEOBJ(target);
     SUPERDEALLOC
 }
 

Modified: branches/Cog/platforms/iOS/vm/Common/Classes/Queue.m
===================================================================
--- branches/Cog/platforms/iOS/vm/Common/Classes/Queue.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/Common/Classes/Queue.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -73,7 +73,7 @@
 
 - (void) dealloc
 {
-    [mItemArray RELEASEOBJ];
+    RELEASEOBJ(mItemArray);
     SUPERDEALLOC
 }
 
@@ -86,6 +86,7 @@
 	anObject = [mItemArray lastObject];
 	if (anObject)
 	{
+        RETAINOBJ(anObject);
 		[mItemArray removeLastObject];		
 	}
 		}

Modified: branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.m
===================================================================
--- branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakAppDelegate.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -45,7 +45,7 @@
 @synthesize squeakApplication,squeakThread;
 
 - (void)dealloc {
-    [squeakApplication RELEASEOBJ];
+    RELEASEOBJ(squeakApplication);
     SUPERDEALLOC
 }
 

Modified: branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m
===================================================================
--- branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -191,7 +191,7 @@
 
 NSString* createFilePathFromString(char * aFilenameString,
 									sqInt filenameLength, sqInt resolveAlias) {
-	NSString * filePath = [[[NSString alloc] initWithBytes: aFilenameString length: (NSUInteger) filenameLength encoding: NSUTF8StringEncoding] AUTORELEASEOBJ];
+	NSString * filePath = AUTORELEASEOBJ([[NSString alloc] initWithBytes: aFilenameString length: (NSUInteger) filenameLength encoding: NSUTF8StringEncoding]);
 	if (!filePath) {
 		return NULL;
 	}
@@ -203,7 +203,7 @@
 		NSString *newFilePath = [gDelegateApp.squeakApplication.fileDirectoryLogic resolvedAliasFiles: owningDirectoryPath];
 		filePath = [newFilePath stringByAppendingPathComponent: [filePath lastPathComponent]];
 	}
-    [filePath RETAINOBJ];
+
 	return filePath;
 }
 

Modified: branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m
===================================================================
--- branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -133,8 +133,8 @@
     if (nameStringLength <= 0 || pathStringLength <= 0)
         return BAD_PATH;
         
-	directoryPath = [[[NSString alloc] initWithBytes: pathString length: (NSUInteger) pathStringLength encoding: NSUTF8StringEncoding] AUTORELEASEOBJ];
-    fileName      = [[[NSString alloc] initWithBytes: nameString length: (NSUInteger) nameStringLength encoding: NSUTF8StringEncoding] AUTORELEASEOBJ];
+	directoryPath = AUTORELEASEOBJ([[NSString alloc] initWithBytes: pathString length: (NSUInteger) pathStringLength encoding: NSUTF8StringEncoding]);
+    fileName      = AUTORELEASEOBJ([[NSString alloc] initWithBytes: nameString length: (NSUInteger) nameStringLength encoding: NSUTF8StringEncoding]);
 	
     if (![directoryPath hasSuffix: @"/"]) {
         directoryPath = [directoryPath stringByAppendingString: @"/"];
@@ -190,7 +190,7 @@
 	}
 	
 	if (pathStringLength > 0) {
-		directoryPath = [[[NSString alloc] initWithBytes: pathString length: (NSUInteger) pathStringLength encoding: NSUTF8StringEncoding] AUTORELEASEOBJ];
+		directoryPath = AUTORELEASEOBJ([[NSString alloc] initWithBytes: pathString length: (NSUInteger) pathStringLength encoding: NSUTF8StringEncoding]);
     }
 	if (directoryPath == NULL) {
 		return BAD_PATH;
@@ -376,9 +376,9 @@
 }
 
 - (void)dealloc {
+    RELEASEOBJ(lastPathForDirLookup);
+    RELEASEOBJ(directoryContentsForDirLookup);
     SUPERDEALLOC
-    [lastPathForDirLookup RELEASEOBJ];
-    [directoryContentsForDirLookup RELEASEOBJ];
 }
 
 

Modified: branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.m
===================================================================
--- branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakInfoPlistInterface.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -56,7 +56,7 @@
 }
 
 - (void)dealloc {
-    [defaults RELEASEOBJ];
+    RELEASEOBJ(defaults);
     SUPERDEALLOC
 }
 

Modified: branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m
===================================================================
--- branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication+events.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -76,6 +76,7 @@
 		@autoreleasepool {
             [self processAsOldEventOrComplexEvent: event placeIn: evt];
         }
+        RELEASEOBJ(event);
 	}
 	
 }

Modified: branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.m
===================================================================
--- branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakMainApplication.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -209,11 +209,13 @@
     
 }
 
+#ifndef SPURVM
 #if COGVM
     void sqMacMemoryFree();
 #else
     void sqMacMemoryFree(void);
 #endif
+#endif
 
 - (void) ioExit {
 	[self ioExitWithErrorCode: 0];

Modified: branches/Cog/platforms/iOS/vm/OSX/SqViewBitmapConversion.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/SqViewBitmapConversion.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/OSX/SqViewBitmapConversion.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -64,7 +64,7 @@
 	copyImage1To32(srcBits, dBits, srcPixelWidth, height, left, top, right, bottom,colorMap);
 	
 	
-	CHECKANDRETURN([[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
+	CHECKANDRETURN(AUTORELEASEOBJ([[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
 														   pixelsWide:right-left
 														   pixelsHigh:bottom-top
 														bitsPerSample:bitsPerSample
@@ -73,7 +73,7 @@
 															 isPlanar:NO
 													   colorSpaceName:colorSpace
 														  bytesPerRow:bytesPerRow
-														 bitsPerPixel:bitsPerPixel] AUTORELEASEOBJ]);
+														 bitsPerPixel:bitsPerPixel]));
 }//extractPixels_1_to_32;
 
 
@@ -96,7 +96,7 @@
 	copyImage2To32(srcBits, dBits, srcPixelWidth, height, left, top, right, bottom,colorMap);
 	
 	
-	CHECKANDRETURN([[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
+	CHECKANDRETURN(AUTORELEASEOBJ([[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
 														   pixelsWide:right-left
 														   pixelsHigh:bottom-top
 														bitsPerSample:bitsPerSample
@@ -105,7 +105,7 @@
 															 isPlanar:NO
 													   colorSpaceName:colorSpace
 														  bytesPerRow:bytesPerRow
-														 bitsPerPixel:bitsPerPixel] AUTORELEASEOBJ]);
+														 bitsPerPixel:bitsPerPixel]));
 }//extractPixels_2_to_32;
 
 -(CGImageRef)extractPixels_4_to_32:(void*)srcBits 
@@ -127,7 +127,7 @@
 	copyImage4To32(srcBits, dBits, srcPixelWidth, height, left, top, right, bottom,colorMap);
 	
 	
-	CHECKANDRETURN([[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
+	CHECKANDRETURN(AUTORELEASEOBJ([[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
 														   pixelsWide:right-left
 														   pixelsHigh:bottom-top
 														bitsPerSample:bitsPerSample
@@ -136,7 +136,7 @@
 															 isPlanar:NO
 													   colorSpaceName:colorSpace
 														  bytesPerRow:bytesPerRow
-														 bitsPerPixel:bitsPerPixel] AUTORELEASEOBJ]);
+														 bitsPerPixel:bitsPerPixel]));
 }//extractPixels_4_to_32;
 
 
@@ -159,7 +159,7 @@
 		copyImage8To32(srcBits, dBits, srcPixelWidth, height, left, top, right, bottom,colorMap);
 		
 		
-		CHECKANDRETURN([[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
+		CHECKANDRETURN(AUTORELEASEOBJ([[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
 				pixelsWide:right-left
 				pixelsHigh:bottom-top
 				bitsPerSample:bitsPerSample
@@ -168,7 +168,7 @@
 				isPlanar:NO
 				colorSpaceName:colorSpace
 				bytesPerRow:bytesPerRow
-				bitsPerPixel:bitsPerPixel] AUTORELEASEOBJ]);
+				bitsPerPixel:bitsPerPixel]));
 	}//extractPixels_8_to_32;
 	
 
@@ -189,7 +189,7 @@
 	
 	copyImage16To32(srcBits, dBits, srcPixelWidth, height, left, top, right, bottom);
 	
-	CHECKANDRETURN([[[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
+	CHECKANDRETURN(AUTORELEASEOBJ([[NSBitmapImageRep alloc] initWithBitmapDataPlanes:(unsigned char **)&dBits
 														   pixelsWide:right-left
 														   pixelsHigh:bottom-top
 														bitsPerSample:bitsPerSample
@@ -198,7 +198,7 @@
 															 isPlanar:NO
 													   colorSpaceName:colorSpace
 														  bytesPerRow:bytesPerRow
-														 bitsPerPixel:bitsPerPixel] AUTORELEASEOBJ]);
+														 bitsPerPixel:bitsPerPixel]));
 }//extractPixels_16_to_32;
 
 -(CGImageRef)computeBitmapFromBitsIndex:(void*)srcBits

Modified: branches/Cog/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/OSX/SqueakOSXAppDelegate.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -43,8 +43,8 @@
 #import "sqSqueakOSXInfoPlistInterface.h"
 #if defined(i386) || defined(__i386) || defined(__i386__)
 #else
-#import <Fabric/Fabric.h>
-#import <Crashlytics/Crashlytics.h>
+//#import <Fabric/Fabric.h>
+//#import <Crashlytics/Crashlytics.h>
 #endif
 
 #ifndef USE_CORE_GRAPHICS
@@ -63,7 +63,7 @@
 @synthesize window,mainView,possibleImageNameAtLaunchTime,checkForFileNameOnFirstParm,windowHandler;
 
 - (sqSqueakMainApplication *) makeApplicationInstance {
-	return [[[sqSqueakOSXApplication alloc] init] AUTORELEASEOBJ];
+	return AUTORELEASEOBJ([[sqSqueakOSXApplication alloc] init]);
 }
 
 - (void)applicationWillFinishLaunching:(NSNotification *)aNotification {
@@ -75,13 +75,13 @@
 #if defined(i386) || defined(__i386) || defined(__i386__)
 #else
     //   [Crashlytics startWithAPIKey:@"add501476623fc20212a60334cd537d16dfd566f"];
-    [Fabric with:@[[Crashlytics class]]];
+    //[Fabric with:@[[Crashlytics class]]];
 #endif
 	
     @autoreleasepool {
 		gDelegateApp = self;	
 		self.squeakApplication = [self makeApplicationInstance];
-		self.windowHandler = [[[sqSqueakOSXScreenAndWindow alloc] init] AUTORELEASEOBJ];
+		self.windowHandler = AUTORELEASEOBJ([[sqSqueakOSXScreenAndWindow alloc] init]);
 		windowHandler.mainViewOnWindow = self.mainView;
 		self.mainView.windowLogic = windowHandler;
 		windowHandler.windowIndex = 1;
@@ -176,7 +176,7 @@
     //It can right now, I have two implementations to pick (CoreGraphics or OpenGL), muy more/different could be added 
     //in the future. 
     
-    NSView *view = [[[ContentViewClass alloc] initWithFrame:[[self window] frame]] AUTORELEASEOBJ];
+    NSView *view = AUTORELEASEOBJ([[ContentViewClass alloc] initWithFrame:[[self window] frame]]);
     self.mainView = (id) view;
     [[self window] setContentView: view];
     

Modified: branches/Cog/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/OSX/plugins/HostWindowPlugin/sqMacHostWindow.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -101,7 +101,7 @@
 }
 
 sqInt ioSetTitleOfWindow(sqInt windowIndex, char * newTitle, sqInt sizeOfTitle) {
-    NSString *title = [[[NSString alloc] initWithBytes:newTitle length:sizeOfTitle encoding:NSUTF8StringEncoding] AUTORELEASEOBJ];
+    NSString *title = AUTORELEASEOBJ([[NSString alloc] initWithBytes:newTitle length:sizeOfTitle encoding:NSUTF8StringEncoding]);
     [[[NSApplication sharedApplication] mainWindow] setTitle:title];
 	return 1;
 }

Modified: branches/Cog/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -208,7 +208,7 @@
 			OSErr err = FSFindFolder(kSystemDomain, kFrameworksFolderType, false, &frameworksFolderRef);
 #pragma unused(err)
 			NSURL *myURLRef = (NSURL *) CFBridgingRelease(CFURLCreateFromFSRef(kCFAllocatorDefault, &frameworksFolderRef));
-			systemFolder = [[myURLRef path] RETAINOBJ];
+			systemFolder = RETAINOBJ([myURLRef path]);
 		}
 		
 		pluginNameLength = strlen(pluginName);

Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+clipboard.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+clipboard.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+clipboard.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -74,7 +74,7 @@
 
 - (void) clipboardWrite: (sqInt) count from: (char *)byteArrayIndex  startingAt:  (sqInt) startIndex {
 	NSPasteboard      *pboard= [NSPasteboard generalPasteboard];
-	NSString * string = [[[NSString alloc] initWithBytes: byteArrayIndex length:(NSUInteger)count encoding: NSUTF8StringEncoding] AUTORELEASEOBJ];
+	NSString * string = AUTORELEASEOBJ([[NSString alloc] initWithBytes: byteArrayIndex length:(NSUInteger)count encoding: NSUTF8StringEncoding]);
 	[pboard declareTypes: @[NSStringPboardType] owner: nil];
 	[pboard setString: string forType: NSStringPboardType];
 }

Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+cursor.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+cursor.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+cursor.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -62,13 +62,13 @@
 		return;
 	@autoreleasepool {
 	 
-	NSBitmapImageRep *bitmap= [[[NSBitmapImageRep alloc]
+	NSBitmapImageRep *bitmap= AUTORELEASEOBJ([[NSBitmapImageRep alloc]
 			 initWithBitmapDataPlanes:  NULL pixelsWide: 16 pixelsHigh: 16
 			 bitsPerSample: 1 samplesPerPixel: 2
 			 hasAlpha: YES isPlanar: YES
 			 colorSpaceName: NSCalibratedBlackColorSpace
 			 bytesPerRow: 2
-			 bitsPerPixel: 0] AUTORELEASEOBJ];
+			 bitsPerPixel: 0]);
 
     unsigned char*      planes[5];
 	[bitmap getBitmapDataPlanes:planes];
@@ -93,7 +93,7 @@
 		mask[i*2 + 1]= (word >> 16) & 0xFF;
 	}
 
-	NSImage *image = [[[NSImage alloc] init] AUTORELEASEOBJ];
+	NSImage *image = AUTORELEASEOBJ([[NSImage alloc] init]);
 	[image addRepresentation: bitmap];
 	
 	
@@ -125,13 +125,13 @@
 	
 	@autoreleasepool {
 	
-	NSBitmapImageRep *bitmap= [[[NSBitmapImageRep alloc]
+	NSBitmapImageRep *bitmap= AUTORELEASEOBJ([[NSBitmapImageRep alloc]
 								initWithBitmapDataPlanes: NULL pixelsWide: extentX pixelsHigh: extentY
 								bitsPerSample: 8 samplesPerPixel: 4
 								hasAlpha: YES isPlanar: NO
 								colorSpaceName: NSCalibratedRGBColorSpace
 								bytesPerRow: extentX * 4
-								bitsPerPixel: 0] AUTORELEASEOBJ];
+								bitsPerPixel: 0]);
 	unsigned int *planes[5];
 	[bitmap getBitmapDataPlanes: (unsigned char **) planes];
 	unsigned int *src= (unsigned int*) pointerForOop(cursorBitsIndex);
@@ -144,7 +144,7 @@
 		*dst= (*src & 0xFF00FF00) | ((*src & 0x000000FF) << 16) | ((*src & 0x00FF0000) >> 16); // BGRA to RGBA
 #endif
 	}
-	NSImage  *image= [[[NSImage alloc] init] AUTORELEASEOBJ];
+	NSImage  *image= AUTORELEASEOBJ([[NSImage alloc] init]);
 	[image addRepresentation: bitmap];
 	NSPoint hotSpot= { -offsetX, -offsetY };
 	self.squeakHasCursor = YES;

Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+events.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -156,10 +156,7 @@
 }
 
 - (void) pushEventToQueue: (sqInputEvent *) evt {	
-    NSMutableArray* data = [NSMutableArray arrayWithCapacity: 2];
-	[data addObject: @1];
-	[data addObject: [NSData  dataWithBytes:(const void *) evt length: sizeof(sqInputEvent)]];
-	[eventQueue addItem: data];
+	[eventQueue addItem: @[@1,[NSData  dataWithBytes:(const void *) evt length: sizeof(sqInputEvent)]]];
 }
 
 - (void) recordCharEvent:(NSString *) unicodeString fromView: (sqSqueakOSXOpenGLView *) mainView {
@@ -195,7 +192,7 @@
             }
 		}
 		
-		NSString *lookupString = [[[NSString alloc] initWithCharacters: &unicode length: 1] AUTORELEASEOBJ];
+		NSString *lookupString = AUTORELEASEOBJ([[NSString alloc] initWithCharacters: &unicode length: 1]);
 		[lookupString getBytes: &macRomanCharacter maxLength: 1 usedLength: NULL encoding: NSMacOSRomanStringEncoding
 					   options: 0 range: picker remainingRange: NULL];
 		

Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -126,7 +126,7 @@
 }
 
 - (void) setupSoundLogic {
-	self.soundInterfaceLogic = [[[sqSqueakOSXSoundCoreAudio alloc] init] AUTORELEASEOBJ];
+	self.soundInterfaceLogic = AUTORELEASEOBJ([[sqSqueakOSXSoundCoreAudio alloc] init]);
  	[(sqSqueakOSXSoundCoreAudio *) self.soundInterfaceLogic soundInitOverride];
 
 	snd_Start(2644, 22050, 1, 0);
@@ -195,7 +195,7 @@
 	
 	if ([args count] < 2) 
 		return;
-	NSMutableArray *revisedArgs = [[args mutableCopyWithZone: NULL] AUTORELEASEOBJ];
+	NSMutableArray *revisedArgs = AUTORELEASEOBJ([args mutableCopyWithZone: NULL]);
 	[revisedArgs removeObjectAtIndex:0];
 	
 	NSUInteger i,result;

Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXCGView.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -73,7 +73,7 @@
 		NSOpenGLPFABackingStore,
 		0
     };
-    return[[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs] AUTORELEASEOBJ];
+    return AUTORELEASEOBJ([[NSOpenGLPixelFormat alloc] initWithAttributes:attrs]);
 }
 
 - (id)initWithFrame:(NSRect)frameRect {
@@ -335,11 +335,11 @@
 	//http://www.internet4classrooms.com/mac_ext.gif
 	//http://developer.apple.com/legacy/mac/library/documentation/mac/Text/Text-571.html
 	
-	keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+	keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 	aKeyBoardStrokeDetails.keyCode = [theEvent keyCode];
 	aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];
 	
-	NSArray *down = [[[NSArray alloc] initWithObjects: theEvent,nil] AUTORELEASEOBJ];
+    NSArray *down = @[theEvent];
 	@synchronized(self) {
 		lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails;
 
@@ -355,11 +355,11 @@
 }
 
 -(void)keyDown:(NSEvent*)theEvent {
-	keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+	keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 	aKeyBoardStrokeDetails.keyCode = [theEvent keyCode];
 	aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];
 	
-	NSArray *down = [[[NSArray alloc] initWithObjects: theEvent,nil] AUTORELEASEOBJ];
+	NSArray *down = @[theEvent];
 //	NSLog(@"sqSqueakOSXCGView.m>>keyDown:");
 	@synchronized(self) {
 		lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails;
@@ -389,7 +389,7 @@
 
 - (void)flagsChanged:(NSEvent *)theEvent {
 //	NSLog(@"sqSqueakOSXCGView.m>>flagsChanged -- %d, %d", [theEvent keyCode], [theEvent modifierFlags] );
-	keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+	keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 	aKeyBoardStrokeDetails.keyCode = [theEvent keyCode];
 	aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];
 	self.lastSeenKeyBoardModifierDetails = aKeyBoardStrokeDetails;
@@ -464,7 +464,7 @@
     else return;
 	
 	@synchronized(self) {
-		keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+		keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 		aKeyBoardStrokeDetails.keyCode = keyCode;
 		aKeyBoardStrokeDetails.modifierFlags = self.lastSeenKeyBoardModifierDetails.modifierFlags;
 		lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails;

Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXFileDirectoryInterface.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXFileDirectoryInterface.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXFileDirectoryInterface.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -74,7 +74,7 @@
 - (NSString *)resolvedAliasFiles:(NSString *)filePath {
 	NSArray *compoents = [[filePath stringByStandardizingPath] pathComponents];
 	NSString *thisComponent;
-	NSString *path = [[[NSString alloc] init] AUTORELEASEOBJ];
+	NSString *path = AUTORELEASEOBJ([[NSString alloc] init]);
 	for (thisComponent in compoents) {
 		path = [path stringByAppendingPathComponent:thisComponent];
 		if (![[NSFileManager defaultManager] fileExistsAtPath:path])

Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXOpenGLView.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -70,7 +70,7 @@
 		NSOpenGLPFABackingStore,
 		0
     };
-    return[[[NSOpenGLPixelFormat alloc] initWithAttributes:attrs] AUTORELEASEOBJ];
+    return AUTORELEASEOBJ([[NSOpenGLPixelFormat alloc] initWithAttributes:attrs]);
 }
 
 - (id)initWithFrame:(NSRect)frameRect {
@@ -415,7 +415,7 @@
 	//http://www.internet4classrooms.com/mac_ext.gif
 	//http://developer.apple.com/legacy/mac/library/documentation/mac/Text/Text-571.html
 	
-	keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+	keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 	aKeyBoardStrokeDetails.keyCode = [theEvent keyCode];
 	aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];
 	
@@ -433,7 +433,7 @@
 }
 
 -(void)keyDown:(NSEvent*)theEvent {
-	keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+	keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 	aKeyBoardStrokeDetails.keyCode = [theEvent keyCode];
 	aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];
 	
@@ -462,7 +462,7 @@
 }
 
 - (void)flagsChanged:(NSEvent *)theEvent {
-	keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+	keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 	aKeyBoardStrokeDetails.keyCode = [theEvent keyCode];
 	aKeyBoardStrokeDetails.modifierFlags = [theEvent modifierFlags];
 	self.lastSeenKeyBoardModifierDetails = aKeyBoardStrokeDetails;
@@ -549,7 +549,7 @@
 																																									return;
 	
 	@synchronized(self) {
-		keyBoardStrokeDetails *aKeyBoardStrokeDetails = [[[keyBoardStrokeDetails alloc] init] AUTORELEASEOBJ];
+		keyBoardStrokeDetails *aKeyBoardStrokeDetails = AUTORELEASEOBJ([[keyBoardStrokeDetails alloc] init]);
 		aKeyBoardStrokeDetails.keyCode = keyCode;
 		aKeyBoardStrokeDetails.modifierFlags = self.lastSeenKeyBoardModifierDetails.modifierFlags;
 		lastSeenKeyBoardStrokeDetails = aKeyBoardStrokeDetails;

Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXScreenAndWindow.m	2015-11-02 00:02:54 UTC (rev 3481)
@@ -53,7 +53,7 @@
 }
 
 - (void) dealloc {
-    [mainViewOnWindow RELEASEOBJ];
+    RELEASEOBJ(mainViewOnWindow);
     SUPERDEALLOC
 }
 

Modified: branches/Cog/platforms/iOS/vm/SqueakPureObjc_Prefix.pch
===================================================================
--- branches/Cog/platforms/iOS/vm/SqueakPureObjc_Prefix.pch	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/SqueakPureObjc_Prefix.pch	2015-11-02 00:02:54 UTC (rev 3481)
@@ -7,12 +7,13 @@
 #endif
 
 #if __has_feature(objc_arc)
-#define RELEASEOBJ
-#define RETAINOBJ
-#define AUTORELEASEOBJ
+#define RELEASEOBJ(x)
+#define RETAINOBJ(x) x
+#define AUTORELEASEOBJ(x) x
+#define SUPERDEALLOC
 #else
-#define RELEASEOBJ release
-#define RETAINOBJ retain
-#define AUTORELEASEOBJ autorelease
+#define RELEASEOBJ(x) [x release]
+#define RETAINOBJ(x) [x retain]
+#define AUTORELEASEOBJ(x) [x autorelease]
 #define SUPERDEALLOC [super dealloc];
-#endif
\ No newline at end of file
+#endif

Modified: branches/Cog/platforms/iOS/vm/iPhone/sqMacV2Memory.c
===================================================================
--- branches/Cog/platforms/iOS/vm/iPhone/sqMacV2Memory.c	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/iOS/vm/iPhone/sqMacV2Memory.c	2015-11-02 00:02:54 UTC (rev 3481)
@@ -167,6 +167,7 @@
 	return gMaxHeapSize - gHeapSize;
 }
 
+#ifndef SPURVM
 void 
 sqMacMemoryFree() {
 	if (gSqueakUseFileMappedMMAP) {
@@ -174,6 +175,7 @@
 		munmap(startOfmmapForANONMemory,freeSpaceRoundedUpToPageSize);
 	}
 }
+#endif
 
 #ifdef BUILD_FOR_OSX
 size_t 
@@ -249,4 +251,36 @@
 	if (munmap(addr, sz) != 0)
 		perror("sqDeallocateMemorySegment... munmap");
 }
+
+static int mmax(size_t x, size_t y) { return (x > y) ? x : y; }
+
+
+/* Answer the address of minHeapSize rounded up to page size bytes of memory. */
+usqInt
+sqAllocateMemory(usqInt minHeapSize, usqInt desiredHeapSize)
+{
+    char *hint, *address, *alloc;
+    unsigned long alignment, allocBytes;
+    
+    if (pageSize) {
+        fprintf(stderr, "sqAllocateMemory: already called\n");
+        exit(1);
+    }
+    pageSize = getpagesize();
+    pageMask = ~(pageSize - 1);
+    
+    hint = sbrk(0);
+    
+    alignment = mmax(pageSize,1024*1024);
+    address = (char *)(((usqInt)hint + alignment - 1) & ~(alignment - 1));
+    
+    alloc = sqAllocateMemorySegmentOfSizeAboveAllocatedSizeInto
+    (roundUpToPage(desiredHeapSize), address, &allocBytes);
+    if (!alloc) {
+        fprintf(stderr, "sqAllocateMemory: initial alloc failed!\n");
+        exit(errno);
+    }
+    return (usqInt)alloc;
+}
+
 #endif /* SPURVM */

Modified: branches/Cog/platforms/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c
===================================================================
--- branches/Cog/platforms/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/unix/plugins/AsynchFilePlugin/sqUnixAsynchFile.c	2015-11-02 00:02:54 UTC (rev 3481)
@@ -140,7 +140,7 @@
   return fp;
 }
 
-INLINE static allocateBuffer(struct FileBuf *buf, int size)
+INLINE static int allocateBuffer(struct FileBuf *buf, int size)
 {
   if (buf->capacity >= size)
     return 1;

Modified: branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c
===================================================================
--- branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c	2015-10-26 04:05:32 UTC (rev 3480)
+++ branches/Cog/platforms/unix/vm/sqUnixHeartbeat.c	2015-11-02 00:02:54 UTC (rev 3481)
@@ -463,9 +463,9 @@
 unsigned long
 ioHeartbeatFrequency(int resetStats)
 {
-	unsigned duration = (ioUTCMicroseconds() - get64(frequencyMeasureStart))
+	unsigned long duration = (ioUTCMicroseconds() - get64(frequencyMeasureStart))
 						/ MicrosecondsPerSecond;
-	unsigned frequency = duration ? heartbeats / duration : 0;
+	unsigned long frequency = duration ? heartbeats / duration : 0;
 
 	if (resetStats) {
 		unsigned long long zero = 0;



More information about the Vm-dev mailing list