[Vm-dev] [commit][2741] Update the Newspeak version of the VMProfileLinuxSupportPlugin.

commits at squeakvm.org commits at squeakvm.org
Wed Jun 12 19:40:50 UTC 2013


Revision: 2741
Author:   eliot
Date:     2013-06-12 12:40:48 -0700 (Wed, 12 Jun 2013)
Log Message:
-----------
Update the Newspeak version of the VMProfileLinuxSupportPlugin.
Improve robustness of the nscogbuild/unixbuild mvm scripts.

Modified Paths:
--------------
    branches/Cog/nscogbuild/unixbuild/astbld/mvm
    branches/Cog/nscogbuild/unixbuild/astbldt/mvm
    branches/Cog/nscogbuild/unixbuild/bld/mvm
    branches/Cog/nscogbuild/unixbuild/bldt/mvm
    branches/Cog/nscogbuild/unixbuild/dbgbld/mvm
    branches/Cog/nscogbuild/unixbuild/dbgbldt/mvm
    branches/Cog/nscogsrc/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c

Property Changed:
----------------
    branches/Cog/platforms/Cross/vm/sqSCCSVersion.h

Modified: branches/Cog/nscogbuild/unixbuild/astbld/mvm
===================================================================
--- branches/Cog/nscogbuild/unixbuild/astbld/mvm	2013-06-11 20:12:31 UTC (rev 2740)
+++ branches/Cog/nscogbuild/unixbuild/astbld/mvm	2013-06-12 19:40:48 UTC (rev 2741)
@@ -1,6 +1,6 @@
 #!/bin/bash
 INSTALLDIR=nsvmlinuxast
-if [ $# -ge 1 ]; then
+if [ $# -ge 1 -a -d "$1" ]; then
 	INSTALLDIR="$1"; shift
 fi
 OPT=-O1
@@ -9,7 +9,7 @@
 read a
 case $a in
 n|no|N|NO)	echo "ok but this isn't safe!!";;
-*)			test -f Makefile && make reallyclean
+*)			rm config.h; test -f Makefile && make reallyclean
 esac
 test -f config.h || ../../../platforms/unix/config/configure --with-src=nscogsrc \
 	--without-vm-display-fbdev --without-npsqueak \

Modified: branches/Cog/nscogbuild/unixbuild/astbldt/mvm
===================================================================
--- branches/Cog/nscogbuild/unixbuild/astbldt/mvm	2013-06-11 20:12:31 UTC (rev 2740)
+++ branches/Cog/nscogbuild/unixbuild/astbldt/mvm	2013-06-12 19:40:48 UTC (rev 2741)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # VM with VM profiler and threaded heartbeat assuming multiple thread priorities
 INSTALLDIR=nsvmlinuxastpt
-if [ $# -ge 1 ]; then
+if [ $# -ge 1 -a -d "$1" ]; then
 	INSTALLDIR="$1"; shift
 fi
 OPT=-O1
@@ -10,7 +10,7 @@
 read a
 case $a in
 n|no|N|NO)	echo "ok but this isn't safe!!";;
-*)			test -f Makefile && make reallyclean
+*)			rm config.h; test -f Makefile && make reallyclean
 esac
 test -f config.h || ../../../platforms/unix/config/configure --with-src=nscogsrc \
 	--without-vm-display-fbdev --without-npsqueak \

Modified: branches/Cog/nscogbuild/unixbuild/bld/mvm
===================================================================
--- branches/Cog/nscogbuild/unixbuild/bld/mvm	2013-06-11 20:12:31 UTC (rev 2740)
+++ branches/Cog/nscogbuild/unixbuild/bld/mvm	2013-06-12 19:40:48 UTC (rev 2741)
@@ -1,6 +1,6 @@
 #!/bin/bash
 INSTALLDIR=nsvmlinux
-if [ $# -ge 1 ]; then
+if [ $# -ge 1 -a -d "$1" ]; then
 	INSTALLDIR="$1"; shift
 fi
 # Some gcc versions create a broken VM using -O2
@@ -13,7 +13,7 @@
 read a
 case $a in
 n|no|N|NO)	echo "ok but this isn't safe!!";;
-*)			test -f Makefile && make reallyclean
+*)			rm config.h; test -f Makefile && make reallyclean
 esac
 test -f config.h || ../../../platforms/unix/config/configure --with-src=nscogsrc \
 	--without-vm-display-fbdev --without-npsqueak \

Modified: branches/Cog/nscogbuild/unixbuild/bldt/mvm
===================================================================
--- branches/Cog/nscogbuild/unixbuild/bldt/mvm	2013-06-11 20:12:31 UTC (rev 2740)
+++ branches/Cog/nscogbuild/unixbuild/bldt/mvm	2013-06-12 19:40:48 UTC (rev 2741)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # VM with VM profiler and threaded heartbeat assuming multiple thread priorities
 INSTALLDIR=nsvmlinuxpt
-if [ $# -ge 1 ]; then
+if [ $# -ge 1 -a -d "$1" ]; then
 	INSTALLDIR="$1"; shift
 fi
 # Some gcc versions create a broken VM using -O2
@@ -14,7 +14,7 @@
 read a
 case $a in
 n|no|N|NO)	echo "ok but this isn't safe!!";;
-*)			test -f Makefile && make reallyclean
+*)			rm config.h; test -f Makefile && make reallyclean
 esac
 test -f config.h || ../../../platforms/unix/config/configure --with-src=nscogsrc \
 	--without-vm-display-fbdev --without-npsqueak \

Modified: branches/Cog/nscogbuild/unixbuild/dbgbld/mvm
===================================================================
--- branches/Cog/nscogbuild/unixbuild/dbgbld/mvm	2013-06-11 20:12:31 UTC (rev 2740)
+++ branches/Cog/nscogbuild/unixbuild/dbgbld/mvm	2013-06-12 19:40:48 UTC (rev 2741)
@@ -1,6 +1,6 @@
 #!/bin/bash
 INSTALLDIR=nsvmlinuxdbg
-if [ $# -ge 1 ]; then
+if [ $# -ge 1 -a -d "$1" ]; then
 	INSTALLDIR="$1"; shift
 fi
 OPT=-O0
@@ -9,7 +9,7 @@
 read a
 case $a in
 n|no|N|NO)	echo "ok but this isn't safe!!";;
-*)			test -f Makefile && make reallyclean
+*)			rm config.h; test -f Makefile && make reallyclean
 esac
 test -f config.h || ../../../platforms/unix/config/configure --with-src=nscogsrc \
 	--without-vm-display-fbdev --without-npsqueak \

Modified: branches/Cog/nscogbuild/unixbuild/dbgbldt/mvm
===================================================================
--- branches/Cog/nscogbuild/unixbuild/dbgbldt/mvm	2013-06-11 20:12:31 UTC (rev 2740)
+++ branches/Cog/nscogbuild/unixbuild/dbgbldt/mvm	2013-06-12 19:40:48 UTC (rev 2741)
@@ -1,7 +1,7 @@
 #!/bin/bash
 # VM with VM profiler and threaded heartbeat assuming multiple thread priorities
 INSTALLDIR=nsvmlinuxdbgpt
-if [ $# -ge 1 ]; then
+if [ $# -ge 1 -a -d "$1" ]; then
 	INSTALLDIR="$1"; shift
 fi
 OPT=-O0
@@ -10,7 +10,7 @@
 read a
 case $a in
 n|no|N|NO)	echo "ok but this isn't safe!!";;
-*)			test -f Makefile && make reallyclean
+*)			rm config.h; test -f Makefile && make reallyclean
 esac
 test -f config.h || ../../../platforms/unix/config/configure --with-src=nscogsrc \
 	--without-vm-display-fbdev --without-npsqueak \

Modified: branches/Cog/nscogsrc/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c
===================================================================
--- branches/Cog/nscogsrc/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c	2013-06-11 20:12:31 UTC (rev 2740)
+++ branches/Cog/nscogsrc/plugins/VMProfileLinuxSupportPlugin/VMProfileLinuxSupportPlugin.c	2013-06-12 19:40:48 UTC (rev 2741)
@@ -1,9 +1,9 @@
 /* Automatically generated by
-	VMPluginCodeGenerator VMMaker.oscog-eem.297 uuid: cb5c5783-9e64-4e06-ac22-1303b40171e9
+	VMPluginCodeGenerator VMMaker.oscog-eem.298 uuid: da5c90a8-14fa-4f7a-a58f-40f16337392c
    from
-	VMProfileLinuxSupportPlugin VMMaker.oscog-eem.297 uuid: cb5c5783-9e64-4e06-ac22-1303b40171e9
+	VMProfileLinuxSupportPlugin VMMaker.oscog-eem.298 uuid: da5c90a8-14fa-4f7a-a58f-40f16337392c
  */
-static char __buildInfo[] = "VMProfileLinuxSupportPlugin VMMaker.oscog-eem.297 uuid: cb5c5783-9e64-4e06-ac22-1303b40171e9 " __DATE__ ;
+static char __buildInfo[] = "VMProfileLinuxSupportPlugin VMMaker.oscog-eem.298 uuid: da5c90a8-14fa-4f7a-a58f-40f16337392c " __DATE__ ;
 
 
 
@@ -12,6 +12,7 @@
 #include <stdlib.h>
 #include <string.h>
 #include <time.h>
+#include <limits.h>
 #ifndef _GNU_SOURCE
 # define _GNU_SOURCE
 #endif
@@ -58,6 +59,7 @@
 EXPORT(sqInt) primitiveExecutableModules(void);
 EXPORT(sqInt) primitiveInterpretAddress(void);
 static sqInt reapmodulenames(struct dl_phdr_info *info, size_t size, void *ignored);
+static sqInt reapmodulesymlinks(struct dl_phdr_info *info, size_t size, void *ignored);
 EXPORT(sqInt) setInterpreter(struct VirtualMachine*anInterpreter);
 
 
@@ -72,6 +74,7 @@
 static sqInt (*instantiateClassindexableSize)(sqInt classPointer, sqInt size);
 static sqInt (*isBytes)(sqInt oop);
 static sqInt (*methodReturnValue)(sqInt oop);
+static sqInt (*nilObject)(void);
 static sqInt (*popRemappableOop)(void);
 static sqInt (*positive32BitIntegerFor)(sqInt integerValue);
 static sqInt (*primitiveFailFor)(sqInt reasonCode);
@@ -88,6 +91,7 @@
 extern sqInt instantiateClassindexableSize(sqInt classPointer, sqInt size);
 extern sqInt isBytes(sqInt oop);
 extern sqInt methodReturnValue(sqInt oop);
+extern sqInt nilObject(void);
 extern sqInt popRemappableOop(void);
 extern sqInt positive32BitIntegerFor(sqInt integerValue);
 extern sqInt primitiveFailFor(sqInt reasonCode);
@@ -101,9 +105,9 @@
 struct VirtualMachine* interpreterProxy;
 static const char *moduleName =
 #ifdef SQUEAK_BUILTIN_PLUGIN
-	"VMProfileLinuxSupportPlugin VMMaker.oscog-eem.297 (i)"
+	"VMProfileLinuxSupportPlugin VMMaker.oscog-eem.298 (i)"
 #else
-	"VMProfileLinuxSupportPlugin VMMaker.oscog-eem.297 (e)"
+	"VMProfileLinuxSupportPlugin VMMaker.oscog-eem.298 (e)"
 #endif
 ;
 static sqInt numModules;
@@ -203,9 +207,11 @@
 }
 
 
-/*	Answer an Array of strings for executable modules (the VM executable and
-	loaded libraries).
- */
+/*	Answer an Array of pairs of strings for executable modules (the VM
+	executable and loaded libraries).
+	The first element in each pair is the filename of the module. The second
+	element is either nil or
+	the symlink's target, if the filename is a symlink. */
 
 EXPORT(sqInt)
 primitiveExecutableModules(void)
@@ -217,13 +223,13 @@
 
 	/* skip the fake linux-gate.so.1 */
 
-	resultObj = instantiateClassindexableSize(classArray(), numModules - 1);
+	resultObj = instantiateClassindexableSize(classArray(), (numModules - 1) * 2);
 	if (resultObj == 0) {
 		return primitiveFailFor(PrimErrNoMemory);
 	}
 	pushRemappableOop(resultObj);
 	primErr = (numModules = 0);
-	dl_iterate_phdr(reapmodulenames,0);
+	dl_iterate_phdr(reapmodulesymlinks,0);
 	resultObj = popRemappableOop();
 	if (primErr != 0) {
 		return primitiveFailFor(primErr);
@@ -269,6 +275,48 @@
 }
 
 
+/*	like reap:module:names:, but follows symlinks */
+
+static sqInt
+reapmodulesymlinks(struct dl_phdr_info *info, size_t size, void *ignored)
+{
+    const char *elfModuleName;
+    extern char *GetAttributeString(sqInt);
+    sqInt len;
+    sqInt moduleNameObj;
+    char symLinkBuf[PATH_MAX];
+
+	;
+	elfModuleName = numModules ? info->dlpi_name : GetAttributeString(0);
+	if ((elfModuleName == null)
+	 || (((len = strlen(elfModuleName))) == 0)) {
+		return 0;
+	}
+	moduleNameObj = instantiateClassindexableSize(classString(), len);
+	if (moduleNameObj == 0) {
+		primErr = PrimErrNoMemory;
+		return 1;
+	}
+	strncpy(arrayValueOf(moduleNameObj), elfModuleName, len);
+	storePointerofObjectwithValue(numModules, topRemappableOop(), moduleNameObj);
+	strcpy(symLinkBuf, elfModuleName);
+	if (((len = readlink(elfModuleName, symLinkBuf, PATH_MAX))) > 0) {
+		moduleNameObj = instantiateClassindexableSize(classString(), len);
+		if (moduleNameObj == 0) {
+			primErr = PrimErrNoMemory;
+			return 1;
+		}
+		strncpy(arrayValueOf(moduleNameObj), symLinkBuf, len);
+		storePointerofObjectwithValue(numModules + 1, topRemappableOop(), moduleNameObj);
+	}
+	else {
+		storePointerofObjectwithValue(numModules + 1, topRemappableOop(), nilObject());
+	}
+	numModules += 2;
+	return 0;
+}
+
+
 /*	Note: This is coded so that it can be run in Squeak. */
 
 EXPORT(sqInt)
@@ -290,6 +338,7 @@
 		instantiateClassindexableSize = interpreterProxy->instantiateClassindexableSize;
 		isBytes = interpreterProxy->isBytes;
 		methodReturnValue = interpreterProxy->methodReturnValue;
+		nilObject = interpreterProxy->nilObject;
 		popRemappableOop = interpreterProxy->popRemappableOop;
 		positive32BitIntegerFor = interpreterProxy->positive32BitIntegerFor;
 		primitiveFailFor = interpreterProxy->primitiveFailFor;


Property changes on: branches/Cog/platforms/Cross/vm/sqSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Tue Jun 11 13:11:09 PDT 2013
   + Wed Jun 12 12:39:49 PDT 2013



More information about the Vm-dev mailing list