[Vm-dev] [commit][3476] JMM - ensure SqueakCogSpur32x86 will build, start work on leaks under 32bit non-arc systems

commits at squeakvm.org commits at squeakvm.org
Mon Oct 19 23:15:50 UTC 2015


Revision: 3476
Author:   johnmci
Date:     2015-10-19 16:15:48 -0700 (Mon, 19 Oct 2015)
Log Message:
-----------
JMM - ensure SqueakCogSpur32x86 will build, start work on leaks under 32bit non-arc systems

Modified Paths:
--------------
    branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.plist
    branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.xcodeproj/project.pbxproj
    branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.xcodeproj/xcuserdata/johnmci.xcuserdatad/xcschemes/SqueakCogSpur32x86.xcscheme
    branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.xcworkspace/xcuserdata/johnmci.xcuserdatad/UserInterfaceState.xcuserstate
    branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m
    branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m
    branches/Cog/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m
    branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+cursor.m
    branches/Cog/platforms/iOS/vm/SqueakPureObjc_Prefix.pch

Modified: branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.plist
===================================================================
--- branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.plist	2015-10-16 17:59:15 UTC (rev 3475)
+++ branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.plist	2015-10-19 23:15:48 UTC (rev 3476)
@@ -380,7 +380,7 @@
 	<key>CFBundleExecutable</key>
 	<string>Squeak</string>
 	<key>CFBundleGetInfoString</key>
-	<string>Squeak Stack 5.0.0 http://www.mirandabanda.org</string>
+	<string>Squeak Cog Spur http://www.mirandabanda.org</string>
 	<key>CFBundleIdentifier</key>
 	<string>org.squeak.osx6464.cog</string>
 	<key>CFBundleInfoDictionaryVersion</key>

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-16 17:59:15 UTC (rev 3475)
+++ branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.xcodeproj/project.pbxproj	2015-10-19 23:15:48 UTC (rev 3476)
@@ -11,6 +11,7 @@
 		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 = (); }; };
 		94584FDB10F02378001401E7 /* sqMacExtendedClipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 94584FD910F02378001401E7 /* sqMacExtendedClipboard.m */; };
@@ -149,7 +150,6 @@
 		9487749710C64DD800E4AEC5 /* sqSqueakOSXApplication+clipboard.m in Sources */ = {isa = PBXBuildFile; fileRef = 9428BB0510BB478600DAD287 /* sqSqueakOSXApplication+clipboard.m */; };
 		9487749810C64DD800E4AEC5 /* sqSqueakOSXSoundCoreAudio.m in Sources */ = {isa = PBXBuildFile; fileRef = 94C4B82F10C06F8800CD4F90 /* sqSqueakOSXSoundCoreAudio.m */; };
 		9487749A10C64DD800E4AEC5 /* sqSqueakOSXDropAPI.m in Sources */ = {isa = PBXBuildFile; fileRef = 946DA91410C0C71100F26F56 /* sqSqueakOSXDropAPI.m */; };
-		9487749B10C64DD800E4AEC5 /* sqMacUnixExternalPrims.m in Sources */ = {isa = PBXBuildFile; fileRef = 946DA9FF10C0D35500F26F56 /* sqMacUnixExternalPrims.m */; };
 		9487749D10C64DD800E4AEC5 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 947E61C210AA03C300D3B69E /* Cocoa.framework */; };
 		9487749E10C64DD800E4AEC5 /* Foundation.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1D30AB110D05D00D00671497 /* Foundation.framework */; };
 		9487749F10C64DD800E4AEC5 /* AudioToolbox.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 945550000DF1BC6A00FB176B /* AudioToolbox.framework */; };
@@ -1757,6 +1757,7 @@
 				9463C1C41AEE14DF009C5CE5 /* DropPlugin.c in Sources */,
 				94BB09781BB480AC0016BFDF /* HostWindowPlugin.c in Sources */,
 				94C3176A1AD49B020096E59D /* sqUnixJoystickTablet.c in Sources */,
+				944154941BD595710062FCDE /* sqMacUnixExternalPrims.m in Sources */,
 				9487748C10C64DD800E4AEC5 /* sqSqueakOSXApplication+imageReadWrite.m in Sources */,
 				94502E971BB71A9200EA8942 /* sqSqueakMainApplication+imageReadWrite.m in Sources */,
 				94FA4CD61BB4D43900C1BE8F /* b3dDraw.c in Sources */,
@@ -1780,7 +1781,6 @@
 				94FA4CD51BB4D43900C1BE8F /* b3dAlloc.c in Sources */,
 				9463C1C51AEE150B009C5CE5 /* FFTPlugin.c in Sources */,
 				9487749A10C64DD800E4AEC5 /* sqSqueakOSXDropAPI.m in Sources */,
-				9487749B10C64DD800E4AEC5 /* sqMacUnixExternalPrims.m in Sources */,
 				94D921561AC6320300A5970F /* SocketPlugin.c in Sources */,
 				94C315341AD4949B0096E59D /* AsynchFilePlugin.c in Sources */,
 				94C317541AD495CD0096E59D /* LocalePlugin.c in Sources */,

Modified: branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.xcodeproj/xcuserdata/johnmci.xcuserdatad/xcschemes/SqueakCogSpur32x86.xcscheme
===================================================================
--- branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.xcodeproj/xcuserdata/johnmci.xcuserdatad/xcschemes/SqueakCogSpur32x86.xcscheme	2015-10-16 17:59:15 UTC (rev 3475)
+++ branches/Cog/build.macos32x86/squeak.cog.spur/SqueakCogSpur32x86.xcodeproj/xcuserdata/johnmci.xcuserdatad/xcschemes/SqueakCogSpur32x86.xcscheme	2015-10-19 23:15:48 UTC (rev 3476)
@@ -64,6 +64,11 @@
          </BuildableReference>
       </BuildableProductRunnable>
       <AdditionalOptions>
+         <AdditionalOption
+            key = "NSZombieEnabled"
+            value = "YES"
+            isEnabled = "YES">
+         </AdditionalOption>
       </AdditionalOptions>
    </LaunchAction>
    <ProfileAction
@@ -80,8 +85,8 @@
             BuildableIdentifier = "primary"
             BlueprintIdentifier = "948773F910C64DD800E4AEC5"
             BuildableName = "Squeak.app"
-            BlueprintName = "SqueakPureObjc64x64"
-            ReferencedContainer = "container:SqueakPureObjc.xcodeproj">
+            BlueprintName = "SqueakCogSpur32x86"
+            ReferencedContainer = "container:SqueakCogSpur32x86.xcodeproj">
          </BuildableReference>
       </BuildableProductRunnable>
    </ProfileAction>

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

Modified: branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m
===================================================================
--- branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m	2015-10-16 17:59:15 UTC (rev 3475)
+++ branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryAPI.m	2015-10-19 23:15:48 UTC (rev 3476)
@@ -86,13 +86,25 @@
                   /* outputs */
                   char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate,
                   sqInt *isDirectory, squeakFileOffsetType *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink);
+#if !defined(PharoVM)
+# define PharoVM 0
+#endif
 
+#if PharoVM
 sqInt dir_Lookup(char *pathString, sqInt pathStringLength, sqInt index,
-/* outputs: */  char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate,
-                 sqInt *isDirectory, squeakFileOffsetType *sizeIfFile) {
-    sqInt posixPermissions;
-    sqInt isSymlink;
-    sqInt status = dir_Lookup2(pathString, pathStringLength, index, name, nameLength, creationDate, modificationDate, isDirectory, sizeIfFile,&posixPermissions,&isSymlink);
+                 /* outputs: */
+                 char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate,
+                 sqInt *isDirectory, squeakFileOffsetType *sizeIfFile, sqInt *posixPermissionsVar, sqInt *isSymlinkVar)
+#else
+sqInt dir_Lookup(char *pathString, sqInt pathStringLength, sqInt index,
+                 /* outputs: */
+                 char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate,
+                 sqInt *isDirectory, squeakFileOffsetType *sizeIfFile)
+#define posixPermissionsVar nil
+#define isSymlinkVar nil
+#endif
+{
+    sqInt status = dir_Lookup2(pathString, pathStringLength, index, name, nameLength, creationDate, modificationDate, isDirectory, sizeIfFile,posixPermissionsVar,isSymlinkVar);
     return status;
 }
 
@@ -129,13 +141,19 @@
 	return status;
 }
 
+#if PharoVM
 sqInt dir_EntryLookup(char *pathString, sqInt pathStringLength, char* nameString, sqInt nameStringLength,
-/* outputs: */  char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate,
-					  sqInt *isDirectory, squeakFileOffsetType *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink)
+                      /* outputs: */
+                      char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate,
+                      sqInt *isDirectory, squeakFileOffsetType *sizeIfFile, sqInt *posixPermissionsVar, sqInt *isSymlinkVar)
+#else
+sqInt dir_EntryLookup(char *pathString, sqInt pathStringLength, char* nameString, sqInt nameStringLength,
+                      /* outputs: */
+                      char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate,
+                      sqInt *isDirectory, squeakFileOffsetType *sizeIfFile)
+#endif
 {
-#if !defined(PharoVM)
-# define PharoVM 0
-#endif
+
 	/*Implementation notes
 	 if pathStringLength = 0 then we use the current working directory
 	 if pathStringLength > 0 then we resolve the pathString and alias */
@@ -151,8 +169,8 @@
 				 modificationDate: modificationDate
 					  isDirectory: isDirectory
 					   sizeIfFile: sizeIfFile
-				 posixPermissions: (PharoVM ? posixPermissions : 0)
-						isSymlink: (PharoVM ? isSymlink : 0)];
+				 posixPermissions: (PharoVM ? posixPermissionsVar : nil)
+						isSymlink:  (PharoVM ? isSymlinkVar : nil)];
 	return status;
 }
 
@@ -175,16 +193,20 @@
 									sqInt filenameLength, sqInt resolveAlias) {
 	NSString * filePath = [[NSString alloc] initWithBytes: aFilenameString length: (NSUInteger) filenameLength encoding: NSUTF8StringEncoding];
 	if (!filePath) {
+        [filePath RELEASEOBJ];
 		return NULL;
 	}
 	
+    NSString *oldFilePath = filePath;
 	if (resolveAlias) {
 		filePath = [gDelegateApp.squeakApplication.fileDirectoryLogic resolvedAliasFiles: filePath];
+        [oldFilePath RELEASEOBJ];
 	} else {
 		NSString *owningDirectoryPath = [filePath stringByDeletingLastPathComponent];
 		NSString *newFilePath = [gDelegateApp.squeakApplication.fileDirectoryLogic resolvedAliasFiles: owningDirectoryPath];
 		filePath = [newFilePath stringByAppendingPathComponent: [filePath lastPathComponent]];
 	}
+    [oldFilePath RELEASEOBJ];
 	return filePath;
 }
 

Modified: branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m
===================================================================
--- branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m	2015-10-16 17:59:15 UTC (rev 3475)
+++ branches/Cog/platforms/iOS/vm/Common/Classes/sqSqueakFileDirectoryInterface.m	2015-10-19 23:15:48 UTC (rev 3476)
@@ -133,8 +133,8 @@
     if (nameStringLength <= 0 || pathStringLength <= 0)
         return BAD_PATH;
         
-	directoryPath = [[NSString alloc] initWithBytes: pathString length: (NSUInteger) pathStringLength encoding: NSUTF8StringEncoding];
-    fileName      = [[NSString alloc] initWithBytes: nameString length: (NSUInteger) nameStringLength encoding: NSUTF8StringEncoding];
+	directoryPath = [[[NSString alloc] initWithBytes: pathString length: (NSUInteger) pathStringLength encoding: NSUTF8StringEncoding] AUTORELEASEOBJ];
+    fileName      = [[[NSString alloc] initWithBytes: nameString length: (NSUInteger) nameStringLength encoding: NSUTF8StringEncoding] AUTORELEASEOBJ];
 	
     if (![directoryPath hasSuffix: @"/"]) {
         directoryPath = [directoryPath stringByAppendingString: @"/"];
@@ -190,7 +190,7 @@
 	}
 	
 	if (pathStringLength > 0) {
-		directoryPath = [[NSString alloc] initWithBytes: pathString length: (NSUInteger) pathStringLength encoding: NSUTF8StringEncoding];
+		directoryPath = [[[NSString alloc] initWithBytes: pathString length: (NSUInteger) pathStringLength encoding: NSUTF8StringEncoding] AUTORELEASEOBJ];
     }
 	if (directoryPath == NULL) {
 		return BAD_PATH;

Modified: branches/Cog/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m	2015-10-16 17:59:15 UTC (rev 3475)
+++ branches/Cog/platforms/iOS/vm/OSX/sqMacUnixExternalPrims.m	2015-10-19 23:15:48 UTC (rev 3476)
@@ -208,7 +208,7 @@
 			OSErr err = FSFindFolder(kSystemDomain, kFrameworksFolderType, false, &frameworksFolderRef);
 #pragma unused(err)
 			NSURL *myURLRef = (NSURL *) CFBridgingRelease(CFURLCreateFromFSRef(kCFAllocatorDefault, &frameworksFolderRef));
-			systemFolder = [myURLRef path];
+			systemFolder = [[myURLRef path] RETAINOBJ];
 		}
 		
 		pluginNameLength = strlen(pluginName);

Modified: branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+cursor.m
===================================================================
--- branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+cursor.m	2015-10-16 17:59:15 UTC (rev 3475)
+++ branches/Cog/platforms/iOS/vm/OSX/sqSqueakOSXApplication+cursor.m	2015-10-19 23:15:48 UTC (rev 3476)
@@ -62,13 +62,13 @@
 		return;
 	@autoreleasepool {
 	 
-	NSBitmapImageRep *bitmap= [[NSBitmapImageRep alloc]
+	NSBitmapImageRep *bitmap= [[[NSBitmapImageRep alloc]
 			 initWithBitmapDataPlanes:  NULL pixelsWide: 16 pixelsHigh: 16
 			 bitsPerSample: 1 samplesPerPixel: 2
 			 hasAlpha: YES isPlanar: YES
 			 colorSpaceName: NSCalibratedBlackColorSpace
 			 bytesPerRow: 2
-			 bitsPerPixel: 0];
+			 bitsPerPixel: 0] AUTORELEASEOBJ];
 
     unsigned char*      planes[5];
 	[bitmap getBitmapDataPlanes:planes];
@@ -93,7 +93,7 @@
 		mask[i*2 + 1]= (word >> 16) & 0xFF;
 	}
 
-	NSImage *image = [[NSImage alloc] init];
+	NSImage *image = [[[NSImage alloc] init] AUTORELEASEOBJ];
 	[image addRepresentation: bitmap];
 	
 	
@@ -125,13 +125,13 @@
 	
 	@autoreleasepool {
 	
-	NSBitmapImageRep *bitmap= [[NSBitmapImageRep alloc]
+	NSBitmapImageRep *bitmap= [[[NSBitmapImageRep alloc]
 								initWithBitmapDataPlanes: NULL pixelsWide: extentX pixelsHigh: extentY
 								bitsPerSample: 8 samplesPerPixel: 4
 								hasAlpha: YES isPlanar: NO
 								colorSpaceName: NSCalibratedRGBColorSpace
 								bytesPerRow: extentX * 4
-								bitsPerPixel: 0];
+								bitsPerPixel: 0] AUTORELEASEOBJ];
 	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];
+	NSImage  *image= [[[NSImage alloc] init] AUTORELEASEOBJ];
 	[image addRepresentation: bitmap];
 	NSPoint hotSpot= { -offsetX, -offsetY };
 	self.squeakHasCursor = YES;

Modified: branches/Cog/platforms/iOS/vm/SqueakPureObjc_Prefix.pch
===================================================================
--- branches/Cog/platforms/iOS/vm/SqueakPureObjc_Prefix.pch	2015-10-16 17:59:15 UTC (rev 3475)
+++ branches/Cog/platforms/iOS/vm/SqueakPureObjc_Prefix.pch	2015-10-19 23:15:48 UTC (rev 3476)
@@ -5,3 +5,14 @@
 #ifdef __OBJC__
     #import <Cocoa/Cocoa.h>
 #endif
+
+#if __has_feature(objc_arc)
+#define RELEASEOBJ
+#define RETAINOBJ
+#define AUTORELEASEOBJ
+#else
+#define RELEASEOBJ release
+#define RETAINOBJ retain
+#define AUTORELEASEOBJ autorelease
+
+#endif
\ No newline at end of file



More information about the Vm-dev mailing list