[Vm-dev] [commit][3219] Step one of replacing DOUBLE_WROD_ALIGNMENT with OBJECTS_32BIT_ALIGNED.

commits at squeakvm.org commits at squeakvm.org
Thu Jan 8 00:42:23 UTC 2015


Revision: 3219
Author:   eliot
Date:     2015-01-07 16:42:17 -0800 (Wed, 07 Jan 2015)
Log Message:
-----------
Step one of replacing DOUBLE_WROD_ALIGNMENT with OBJECTS_32BIT_ALIGNED.
Rename platforms/Cross/plugins/RePlugin/config.h to reConfig.h to avoid
conflicts with the VM's actual config.h file.

Modified Paths:
--------------
    trunk/platforms/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c
    trunk/platforms/Cross/plugins/RePlugin/internal.h
    trunk/platforms/Cross/plugins/RePlugin/oldInternal.h

Added Paths:
-----------
    trunk/platforms/Cross/plugins/RePlugin/reConfig.h

Removed Paths:
-------------
    trunk/platforms/Cross/plugins/RePlugin/config.h

Property Changed:
----------------
    trunk/platforms/Cross/plugins/sqPluginsSCCSVersion.h

Modified: trunk/platforms/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c
===================================================================
--- trunk/platforms/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c	2015-01-07 19:23:24 UTC (rev 3218)
+++ trunk/platforms/Cross/plugins/FilePlugin/sqFilePluginBasicPrims.c	2015-01-08 00:42:17 UTC (rev 3219)
@@ -79,32 +79,10 @@
 int thisSession = 0;
 extern struct VirtualMachine * interpreterProxy;
 
-/* Since SQFile instaces are held on the heap in 32-bit-aligned byte arrays we
+/* Since SQFile instances are held on the heap in 32-bit-aligned byte arrays we
  * may need to use memcpy to avoid alignment faults.
  */
-#if DOUBLE_WORD_ALIGNMENT
-static void setFile(SQFile *f, FILE *file)
-{
-  void *in= (void *)&file;
-  void *out= (void *)&f->file;
-  memcpy(out, in, sizeof(FILE *));
-}
-#else
-# define setFile(f,fileptr) ((f)->file = (fileptr))
-#endif
-
-#if DOUBLE_WORD_ALIGNMENT
-static void setSize(SQFile *f, squeakFileOffsetType size)
-{
-  void *in= (void *)&size;
-  void *out= (void *)&f->fileSize;
-  memcpy(out, in, sizeof(squeakFileOffsetType));
-}
-#else
-# define setSize(f,size) ((f)->fileSize = (size))
-#endif
-
-#if DOUBLE_WORD_ALIGNMENT
+#if OBJECTS_32BIT_ALIGNED
 static FILE *getFile(SQFile *f)
 {
   FILE *file;
@@ -113,11 +91,12 @@
   memcpy(out, in, sizeof(FILE *));
   return file;
 }
-#else
-# define getFile(f) ((FILE *)((f)->file))
-#endif
-
-#if DOUBLE_WORD_ALIGNMENT
+static void setFile(SQFile *f, FILE *file)
+{
+  void *in= (void *)&file;
+  void *out= (void *)&f->file;
+  memcpy(out, in, sizeof(FILE *));
+}
 static squeakFileOffsetType getSize(SQFile *f)
 {
   squeakFileOffsetType size;
@@ -126,9 +105,18 @@
   memcpy(out, in, sizeof(squeakFileOffsetType));
   return size;
 }
-#else
+static void setSize(SQFile *f, squeakFileOffsetType size)
+{
+  void *in= (void *)&size;
+  void *out= (void *)&f->fileSize;
+  memcpy(out, in, sizeof(squeakFileOffsetType));
+}
+#else /* OBJECTS_32BIT_ALIGNED */
+# define getFile(f) ((FILE *)((f)->file))
+# define setFile(f,fileptr) ((f)->file = (fileptr))
 # define getSize(f) ((f)->fileSize)
-#endif
+# define setSize(f,size) ((f)->fileSize = (size))
+#endif /* OBJECTS_32BIT_ALIGNED */
 
 #if 0
 # define pentry(func) do { int fn = fileno(getFile(f)); if (f->isStdioStream) printf("\n"#func "(%s) %lld %d\n", fn == 0 ? "in" : fn == 1 ? "out" : "err", (long long)ftell(getFile(f)), f->lastChar); } while (0)
@@ -140,7 +128,8 @@
 # define pfail() 0
 #endif
 
-sqInt sqFileAtEnd(SQFile *f) {
+sqInt
+sqFileAtEnd(SQFile *f) {
 	/* Return true if the file's read/write head is at the end of the file. */
 
 	if (!sqFileValid(f))
@@ -151,7 +140,8 @@
 	return ftell(getFile(f)) >= getSize(f);
 }
 
-sqInt sqFileClose(SQFile *f) {
+sqInt
+sqFileClose(SQFile *f) {
 	/* Close the given file. */
 
 	if (!sqFileValid(f))
@@ -165,7 +155,8 @@
 	return 1;
 }
 
-sqInt sqFileDeleteNameSize(char* sqFileName, sqInt sqFileNameSize) {
+sqInt
+sqFileDeleteNameSize(char* sqFileName, sqInt sqFileNameSize) {
 	char cFileName[1000];
 	int err;
 
@@ -183,7 +174,8 @@
 	return 1;
 }
 
-squeakFileOffsetType sqFileGetPosition(SQFile *f) {
+squeakFileOffsetType
+sqFileGetPosition(SQFile *f) {
 	/* Return the current position of the file's read/write head. */
 
 	squeakFileOffsetType position;
@@ -200,7 +192,8 @@
 	return position;
 }
 
-sqInt sqFileInit(void) {
+sqInt
+sqFileInit(void) {
 	/* Create a session ID that is unlikely to be repeated.
 	   Zero is never used for a valid session number.
 	   Should be called once at startup time.
@@ -214,11 +207,11 @@
 	return 1;
 }
 
-sqInt sqFileShutdown(void) {
-	return 1;
-}
+sqInt
+sqFileShutdown(void) { return 1; }
 
-sqInt sqFileOpen(SQFile *f, char* sqFileName, sqInt sqFileNameSize, sqInt writeFlag) {
+sqInt
+sqFileOpen(SQFile *f, char* sqFileName, sqInt sqFileNameSize, sqInt writeFlag) {
 	/* Opens the given file using the supplied sqFile structure
 	   to record its state. Fails with no side effects if f is
 	   already open. Files are always opened in binary mode;
@@ -337,7 +330,8 @@
 	return 7;
 }
 
-size_t sqFileReadIntoAt(SQFile *f, size_t count, char* byteArrayIndex, size_t startIndex) {
+size_t
+sqFileReadIntoAt(SQFile *f, size_t count, char* byteArrayIndex, size_t startIndex) {
 	/* Read count bytes from the given file into byteArray starting at
 	   startIndex. byteArray is the address of the first byte of a
 	   Squeak bytes object (e.g. String or ByteArray). startIndex
@@ -422,7 +416,8 @@
 	return pexit(bytesRead);
 }
 
-sqInt sqFileRenameOldSizeNewSize(char* oldNameIndex, sqInt oldNameSize, char* newNameIndex, sqInt newNameSize) {
+sqInt
+sqFileRenameOldSizeNewSize(char* oldNameIndex, sqInt oldNameSize, char* newNameIndex, sqInt newNameSize) {
 	char cOldName[1000], cNewName[1000];
 	int err;
 
@@ -442,7 +437,8 @@
 	return 1;
 }
 
-sqInt sqFileSetPosition(SQFile *f, squeakFileOffsetType position) {
+sqInt
+sqFileSetPosition(SQFile *f, squeakFileOffsetType position) {
 	/* Set the file's read/write head to the given position. */
 
 	if (!sqFileValid(f))
@@ -469,7 +465,8 @@
 	return 1;
 }
 
-squeakFileOffsetType sqFileSize(SQFile *f) {
+squeakFileOffsetType
+sqFileSize(SQFile *f) {
 	/* Return the length of the given file. */
 
 	if (!sqFileValid(f))
@@ -479,7 +476,8 @@
 	return getSize(f);
 }
 
-sqInt sqFileFlush(SQFile *f) {
+sqInt
+sqFileFlush(SQFile *f) {
 
 	if (!sqFileValid(f))
 		return interpreterProxy->success(false);
@@ -488,7 +486,8 @@
 	return 1;
 }
 
-sqInt sqFileTruncate(SQFile *f,squeakFileOffsetType offset) {
+sqInt
+sqFileTruncate(SQFile *f,squeakFileOffsetType offset) {
 
 	if (!sqFileValid(f))
 		return interpreterProxy->success(false);
@@ -499,14 +498,16 @@
 }
 
 
-sqInt sqFileValid(SQFile *f) {
+sqInt
+sqFileValid(SQFile *f) {
 	return (
 		(f != NULL) &&
 		(getFile(f) != NULL) &&
 		(f->sessionID == thisSession));
 }
 
-size_t sqFileWriteFromAt(SQFile *f, size_t count, char* byteArrayIndex, size_t startIndex) {
+size_t
+sqFileWriteFromAt(SQFile *f, size_t count, char* byteArrayIndex, size_t startIndex) {
 	/* Write count bytes to the given writable file starting at startIndex
 	   in the given byteArray. (See comment in sqFileReadIntoAt for interpretation
 	   of byteArray and startIndex).
@@ -537,7 +538,8 @@
 	return pexit(bytesWritten);
 }
 
-sqInt sqFileThisSession() {
+sqInt
+sqFileThisSession() {
 	return thisSession;
 }
 #endif /* NO_STD_FILE_SUPPORT */

Deleted: trunk/platforms/Cross/plugins/RePlugin/config.h
===================================================================
--- trunk/platforms/Cross/plugins/RePlugin/config.h	2015-01-07 19:23:24 UTC (rev 3218)
+++ trunk/platforms/Cross/plugins/RePlugin/config.h	2015-01-08 00:42:17 UTC (rev 3219)
@@ -1,48 +0,0 @@
-/* config.h.  Generated automatically by configure.  */
-
-/* On Unix systems config.in is converted by configure into config.h. PCRE is
-written in Standard C, but there are a few non-standard things it can cope
-with, allowing it to run on SunOS4 and other "close to standard" systems.
-
-On a non-Unix system you should just copy this file into config.h, and set up
-the macros the way you need them. You should normally change the definitions of
-HAVE_STRERROR and HAVE_MEMMOVE to 1. Unfortunately, because of the way autoconf
-works, these cannot be made the defaults. If your system has bcopy() and not
-memmove(), change the definition of HAVE_BCOPY instead of HAVE_MEMMOVE. If your
-system has neither bcopy() nor memmove(), leave them both as 0; an emulation
-function will be used. */
-
-/* Define to empty if the keyword does not work. */
-
-/* #undef const */
-
-/* Define to `unsigned' if <stddef.h> doesn't define size_t. */
-
-/* #undef size_t */
-
-/* The following two definitions are mainly for the benefit of SunOS4, which
-doesn't have the strerror() or memmove() functions that should be present in
-all Standard C libraries. The macros HAVE_STRERROR and HAVE_MEMMOVE should
-normally be defined with the value 1 for other systems, but unfortunately we
-can't make this the default because "configure" files generated by autoconf
-will only change 0 to 1; they won't change 1 to 0 if the functions are not
-found. */
-
-#define HAVE_STRERROR 1
-#define HAVE_MEMMOVE 1
-
-/* There are some non-Unix systems that don't even have bcopy(). If this macro
-is false, an emulation is used. If HAVE_MEMMOVE is set to 1, the value of
-HAVE_BCOPY is not relevant. */
-
-#define HAVE_BCOPY 1
-
-/* The value of NEWLINE determines the newline character. The default is to
-leave it up to the compiler, but some sites want to force a particular value.
-On Unix systems, "configure" can be used to override this default. */
-
-#ifndef NEWLINE
-#define NEWLINE '\n'
-#endif
-
-/* End */

Modified: trunk/platforms/Cross/plugins/RePlugin/internal.h
===================================================================
--- trunk/platforms/Cross/plugins/RePlugin/internal.h	2015-01-07 19:23:24 UTC (rev 3218)
+++ trunk/platforms/Cross/plugins/RePlugin/internal.h	2015-01-08 00:42:17 UTC (rev 3219)
@@ -40,7 +40,7 @@
 #define	NEWLINE	'\r'
 #define SQUEAK_PLUGIN
 
-#include "config.h"
+#include "reconfig.h"
 
 /* To cope with SunOS4 and other systems that lack memmove() but have bcopy(),
 define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY

Modified: trunk/platforms/Cross/plugins/RePlugin/oldInternal.h
===================================================================
--- trunk/platforms/Cross/plugins/RePlugin/oldInternal.h	2015-01-07 19:23:24 UTC (rev 3218)
+++ trunk/platforms/Cross/plugins/RePlugin/oldInternal.h	2015-01-08 00:42:17 UTC (rev 3219)
@@ -40,7 +40,7 @@
 #define	NEWLINE	'\r'
 #define SQUEAK_PLUGIN
 
-#include "config.h"
+#include "reconfig.h"
 
 /* To cope with SunOS4 and other systems that lack memmove() but have bcopy(),
 define a macro for memmove() if HAVE_MEMMOVE is false, provided that HAVE_BCOPY

Copied: trunk/platforms/Cross/plugins/RePlugin/reConfig.h (from rev 3216, trunk/platforms/Cross/plugins/RePlugin/config.h)
===================================================================
--- trunk/platforms/Cross/plugins/RePlugin/reConfig.h	                        (rev 0)
+++ trunk/platforms/Cross/plugins/RePlugin/reConfig.h	2015-01-08 00:42:17 UTC (rev 3219)
@@ -0,0 +1,49 @@
+/* config.h.  Generated automatically by configure.  */
+/* renamed to reConfig.h to avoid conflicts with the main config.h */
+
+/* On Unix systems config.in is converted by configure into config.h. PCRE is
+written in Standard C, but there are a few non-standard things it can cope
+with, allowing it to run on SunOS4 and other "close to standard" systems.
+
+On a non-Unix system you should just copy this file into config.h, and set up
+the macros the way you need them. You should normally change the definitions of
+HAVE_STRERROR and HAVE_MEMMOVE to 1. Unfortunately, because of the way autoconf
+works, these cannot be made the defaults. If your system has bcopy() and not
+memmove(), change the definition of HAVE_BCOPY instead of HAVE_MEMMOVE. If your
+system has neither bcopy() nor memmove(), leave them both as 0; an emulation
+function will be used. */
+
+/* Define to empty if the keyword does not work. */
+
+/* #undef const */
+
+/* Define to `unsigned' if <stddef.h> doesn't define size_t. */
+
+/* #undef size_t */
+
+/* The following two definitions are mainly for the benefit of SunOS4, which
+doesn't have the strerror() or memmove() functions that should be present in
+all Standard C libraries. The macros HAVE_STRERROR and HAVE_MEMMOVE should
+normally be defined with the value 1 for other systems, but unfortunately we
+can't make this the default because "configure" files generated by autoconf
+will only change 0 to 1; they won't change 1 to 0 if the functions are not
+found. */
+
+#define HAVE_STRERROR 1
+#define HAVE_MEMMOVE 1
+
+/* There are some non-Unix systems that don't even have bcopy(). If this macro
+is false, an emulation is used. If HAVE_MEMMOVE is set to 1, the value of
+HAVE_BCOPY is not relevant. */
+
+#define HAVE_BCOPY 1
+
+/* The value of NEWLINE determines the newline character. The default is to
+leave it up to the compiler, but some sites want to force a particular value.
+On Unix systems, "configure" can be used to override this default. */
+
+#ifndef NEWLINE
+#define NEWLINE '\n'
+#endif
+
+/* End */


Property changes on: trunk/platforms/Cross/plugins/sqPluginsSCCSVersion.h
___________________________________________________________________
Modified: checkindate
   - Wed Dec 31 14:28:47 PST 2014
   + Wed Jan  7 16:41:51 PST 2015



More information about the Vm-dev mailing list