1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2026-04-27 16:51:06 -07:00

Mps compiles and runs using pelles c.

Merge code from Bruce Mitchener <https://github.com/Ravenbrook/mps-temporary/pull/2> and from RB <https://github.com/waywardmonkeys/mps-temporary/pull/1/files>.
Split call to EVENT_LIST so that event.c compiles.
Remove useless call to va_end in seg.c.

Copied from Perforce
 Change: 184948
 ServerID: perforce.ravenbrook.com
This commit is contained in:
Gareth Rees 2014-03-21 18:28:39 +00:00
parent a6f8e8a25d
commit 4ef183e62a
6 changed files with 151 additions and 6 deletions

View file

@ -197,10 +197,13 @@ void EventInit(void)
AVER((Bool)Event##name##Always == always); \
AVERT(Bool, always); \
AVER(0 <= Event##name##Kind); \
AVER((EventKind)Event##name##Kind < EventKindLIMIT); \
AVER((EventKind)Event##name##Kind < EventKindLIMIT);
#define EVENT_CHECK_PARAMS(X, name, code, always, kind) \
EVENT_##name##_PARAMS(EVENT_PARAM_CHECK, name)
EVENT_LIST(EVENT_CHECK, X)
/*EVENT_LIST(EVENT_CHECK, X)*/
/*EVENT_LIST(EVENT_CHECK_PARAMS, X)*/
/* Ensure that no event can be larger than the maximum event size. */
AVER(EventBufferSIZE <= EventSizeMAX);

View file

@ -214,6 +214,21 @@
#include "spw3i6mv.c" /* Windows on 64-bit stack probe for Microsoft C */
#include "mpsiw3.c" /* Windows interface layer extras */
/* Windows on 32-bit Intel with Pelles C */
#elif defined(MPS_PF_W3I3PC)
#include "lockw3.c" /* Windows locks */
#include "thw3.c" /* Windows threading */
#include "thw3i3.c" /* Windows on 32-bit Intel thread stack scan */
#include "vmw3.c" /* Windows virtual memory */
#include "protw3.c" /* Windows protection */
#include "proti3.c" /* 32-bit Intel mutator context decoding */
#include "prmci3w3.c" /* Windows on 32-bit Intel mutator context */
#include "ssw3i3pc.c" /* Windows on 32-bit stack scan for Pelles C */
#include "spw3i3mv.c" /* Intel stack probe */
#include "mpsiw3.c" /* Windows interface layer extras */
#else
#error "Unknown platform -- can't determine platform specific parts."

View file

@ -31,9 +31,12 @@
* Alignment of 4 would work, but the MS library uses 8 bytes for
* doubles and __int64, so we choose that. The actual granularity of
* VC malloc is 16!
*
* PellesC /Ze (Microsoft compatibility mode) defines _MSC_VER but
* isn't compatible enough for MPS purposes.
*/
#if defined(_MSC_VER) && defined(_WIN32) && defined(_M_IX86)
#if defined(_MSC_VER) && defined(_WIN32) && defined(_M_IX86) && !defined(__POCC__)
#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_W3I3MV)
#error "specified CONFIG_PF_... inconsistent with detected w3i3mv"
#endif
@ -58,7 +61,7 @@
* <http://msdn.microsoft.com/en-us/library/ms235286>
*/
#elif defined(_MSC_VER) && defined(_WIN32) && defined(_WIN64) && defined(_M_X64)
#elif defined(_MSC_VER) && defined(_WIN32) && defined(_WIN64) && defined(_M_X64) && !defined(__POCC__)
#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_W3I6MV)
#error "specified CONFIG_PF_... inconsistent with detected w3i6mv"
#endif
@ -74,6 +77,26 @@
#define MPS_PF_ALIGN 16
/* PellesC version 7.00.25 with /Ze option (Microsoft compatibility mode)
* Help node "Predefined preprocessor symbols (POCC)"
*/
#elif defined(__POCC__) && defined(_WIN32) && defined(_M_IX86)
#if defined(CONFIG_PF_STRING) && ! defined(CONFIG_PF_W3I3PC)
#error "specified CONFIG_PF_... inconsistent with detected w3i3pc"
#endif
#define MPS_PF_W3I3PC
#define MPS_PF_STRING "w3i3pc"
#define MPS_OS_W3
#define MPS_ARCH_I3
#define MPS_BUILD_PC
#define MPS_T_WORD unsigned long
#define MPS_T_ULONGEST unsigned long
#define MPS_WORD_WIDTH 32
#define MPS_WORD_SHIFT 5
#define MPS_PF_ALIGN 8
/* GCC 4.0.1 (As supplied by Apple on Mac OS X 10.4.8 on an Intel Mac),
* gcc -E -dM
* And above for xcppgc.

View file

@ -571,7 +571,6 @@ Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi,
Addr base, mid, limit;
Arena arena;
Res res;
va_list args;
AVER(NULL != mergedSegReturn);
AVERT(Seg, segLo);
@ -591,7 +590,6 @@ Res SegMerge(Seg *mergedSegReturn, Seg segLo, Seg segHi,
/* Invoke class-specific methods to do the merge */
res = class->merge(segLo, segHi, base, mid, limit,
withReservoirPermit);
va_end(args);
if (ResOK != res)
goto failMerge;

View file

@ -37,6 +37,8 @@ Res StackScan(ScanState ss, Addr *stackBot)
AVER(sizeof(((_JUMP_BUFFER *)jb)->Esi) == sizeof(Addr));
AVER(sizeof(((_JUMP_BUFFER *)jb)->Ebx) == sizeof(Addr));
/* Ensure that the callee-save registers will be found by
StackScanInner when it's passed the address of the Ebx field. */
AVER(offsetof(_JUMP_BUFFER, Edi) == offsetof(_JUMP_BUFFER, Ebx) + 4);
AVER(offsetof(_JUMP_BUFFER, Esi) == offsetof(_JUMP_BUFFER, Ebx) + 8);

104
mps/code/ssw3i3pc.c Normal file
View file

@ -0,0 +1,104 @@
/* ssw3i3pc.c: STACK SCANNING FOR WIN32 WITH PELLES C
*
* $Id$
* Copyright (c) 2001-2014 Ravenbrook Limited. See end of file for license.
*
* This scans the stack and fixes the registers which may contain roots.
* See <design/thread-manager/>.
*
* .assume.ms-compat: We rely on the fact that Pelles C's setjmp stores
* the callee-save registers in the jmp_buf and is compatible with Microsoft
* C. The Pelles C 7.00 setjmp.h header has a comment "MS compatible". See
* also "Is Pelles C's jmp_buf compatible with Microsoft C's?"
* <http://forum.pellesc.de/index.php?topic=5464>
*
* REFERENCES
*
* "Argument Passing and Naming Conventions"; MSDN; Microsoft Corporation;
* <http://msdn.microsoft.com/en-us/library/984x0h58%28v=vs.100%29.aspx>.
*
* "Calling conventions for different C++ compilers and operating systems";
* Agner Fog; Copenhagen University College of Engineering; 2012-02-29;
* <http://agner.org./optimize/calling_conventions.pdf>.
*/
#include "mpm.h"
#include <setjmp.h>
SRCID(ssw3i3pc, "$Id$");
/* This definition isn't in the Pelles C headers, so we reproduce it here.
* See .assume.ms-compat. */
typedef struct __JUMP_BUFFER {
unsigned long Ebp;
unsigned long Ebx;
unsigned long Edi;
unsigned long Esi;
unsigned long Esp;
unsigned long Eip;
unsigned long Registration;
unsigned long TryLevel;
unsigned long Cookie;
unsigned long UnwindFunc;
unsigned long UnwindData[6];
} _JUMP_BUFFER;
Res StackScan(ScanState ss, Addr *stackBot)
{
jmp_buf jb;
/* .assume.ms-compat */
(void)setjmp(jb);
/* Ensure that the callee-save registers will be found by
StackScanInner when it's passed the address of the Ebx field. */
AVER(offsetof(_JUMP_BUFFER, Edi) == offsetof(_JUMP_BUFFER, Ebx) + 4);
AVER(offsetof(_JUMP_BUFFER, Esi) == offsetof(_JUMP_BUFFER, Ebx) + 8);
return StackScanInner(ss, stackBot, (Addr *)&((_JUMP_BUFFER *)jb)->Ebx, 3);
}
/* C. COPYRIGHT AND LICENSE
*
* Copyright (C) 2001-2014 Ravenbrook Limited <http://www.ravenbrook.com/>.
* All rights reserved. This is an open source license. Contact
* Ravenbrook for commercial licensing options.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright
* notice, this list of conditions and the following disclaimer in the
* documentation and/or other materials provided with the distribution.
*
* 3. Redistributions in any form must be accompanied by information on how
* to obtain complete source code for this software and any accompanying
* software that uses this software. The source code must either be
* included in the distribution or be available for no more than the cost
* of distribution plus a nominal fee, and must be freely redistributable
* under reasonable conditions. For an executable file, complete source
* code means the source code for all modules it contains. It does not
* include source code for modules or files that typically accompany the
* major components of the operating system on which the executable file
* runs.
*
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
* IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
* PURPOSE, OR NON-INFRINGEMENT, ARE DISCLAIMED. IN NO EVENT SHALL THE
* COPYRIGHT HOLDERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
* INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
* NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
* USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
* THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/