Bug 433790: removed obsolete Win16 code from mozilla/nsprpub/lib. The

patch is contributed by Arpad Borsos <arpad.borsos@googlemail.com>.  r=wtc.
Modified Files:
	ds/plhash.c libc/src/plerror.c msgc/include/prgc.h
	msgc/src/prgcapi.c msgc/src/prmsgc.c msgc/tests/Makefile.in
	prstreams/tests/testprstrm/Makefile.in tests/Makefile.in
Removed Files:
	msgc/src/win16gc.c


git-svn-id: svn://10.0.0.236/trunk@256286 18797224-902f-48f8-a5cc-f745e15eee43
This commit is contained in:
wtc%google.com 2009-02-22 18:56:04 +00:00
parent 3c40bbdb59
commit 72cf124ef4
8 changed files with 0 additions and 364 deletions

View File

@ -132,12 +132,6 @@ PL_NewHashTable(PRUint32 n, PLHashFunction keyHash,
memset(ht, 0, sizeof *ht);
ht->shift = PL_HASH_BITS - n;
n = 1 << n;
#if defined(WIN16)
if (n > 16000) {
(*allocOps->freeTable)(allocPriv, ht);
return 0;
}
#endif /* WIN16 */
nb = n * sizeof(PLHashEntry *);
ht->buckets = (PLHashEntry**)((*allocOps->allocTable)(allocPriv, nb));
if (!ht->buckets) {
@ -254,10 +248,6 @@ PL_HashTableRawAdd(PLHashTable *ht, PLHashEntry **hep,
n = NBUCKETS(ht);
if (ht->nentries >= OVERLOADED(n)) {
oldbuckets = ht->buckets;
#if defined(WIN16)
if (2 * n > 16000)
return 0;
#endif /* WIN16 */
nb = 2 * n * sizeof(PLHashEntry *);
ht->buckets = (PLHashEntry**)
((*ht->allocOps->allocTable)(ht->allocPriv, nb));

View File

@ -69,20 +69,4 @@ PR_IMPLEMENT(void) PL_PrintError(const char *msg)
PL_FPrintError(fd, msg);
} /* PL_PrintError */
#if defined(WIN16)
/*
** libmain() is a required function for win16
**
*/
int CALLBACK LibMain( HINSTANCE hInst, WORD wDataSeg,
WORD cbHeapSize, LPSTR lpszCmdLine )
{
return TRUE;
}
#endif /* WIN16 */
/* plerror.c */

View File

@ -269,10 +269,6 @@ PR_IMPLEMENT(void) PR_GetEndFinalizeHook(GCEndFinalizeHook **hook, void **arg)
#ifdef DEBUG
#include "prprf.h"
#if defined(WIN16)
static FILE *tracefile = 0;
#endif
PR_IMPLEMENT(void) GCTrace(char *fmt, ...)
{
va_list ap;
@ -281,16 +277,7 @@ PR_IMPLEMENT(void) GCTrace(char *fmt, ...)
va_start(ap, fmt);
PR_vsnprintf(buf, sizeof(buf), fmt, ap);
va_end(ap);
#if defined(WIN16)
if ( tracefile == 0 )
{
tracefile = fopen( "xxxGCtr", "w" );
}
fprintf(tracefile, "%s\n", buf );
fflush(tracefile);
#else
PR_LOG(_pr_msgc_lm, PR_LOG_ALWAYS, ("%s", buf));
#endif
}
#endif

View File

@ -297,7 +297,6 @@ static PRWord bigAllocBytes = 0;
** for empty objects).
** XXX tune: put subtract of _sp->base into _sp->hbits pointer?
*/
#if !defined(WIN16)
#define SET_HBIT(_sp,_ph) \
SET_BIT((_sp)->hbits, (((PRWord*)(_ph)) - ((PRWord*) (_sp)->base)))
@ -306,67 +305,6 @@ static PRWord bigAllocBytes = 0;
#define IS_HBIT(_sp,_ph) \
TEST_BIT((_sp)->hbits, (((PRWord*)(_ph)) - ((PRWord*) (_sp)->base)))
#else
#define SET_HBIT(_sp,_ph) set_hbit(_sp,_ph)
#define CLEAR_HBIT(_sp,_ph) clear_hbit(_sp,_ph)
#define IS_HBIT(_sp,_ph) is_hbit(_sp,_ph)
static void
set_hbit(GCSeg *sp, PRWord *p)
{
unsigned int distance;
unsigned int index;
PRWord mask;
PR_ASSERT( SELECTOROF(p) == SELECTOROF(sp->base) );
PR_ASSERT( OFFSETOF(p) >= OFFSETOF(sp->base) );
distance = (OFFSETOF(p) - OFFSETOF(sp->base)) >> 2;
index = distance >> PR_BITS_PER_WORD_LOG2;
mask = 1L << (distance&(PR_BITS_PER_WORD-1));
sp->hbits[index] |= mask;
}
static void
clear_hbit(GCSeg *sp, PRWord *p)
{
unsigned int distance;
unsigned int index;
PRWord mask;
PR_ASSERT( SELECTOROF(p) == SELECTOROF(sp->base) );
PR_ASSERT( OFFSETOF(p) >= OFFSETOF(sp->base) );
distance = (OFFSETOF(p) - OFFSETOF(sp->base)) >> 2;
index = distance >> PR_BITS_PER_WORD_LOG2;
mask = 1L << (distance&(PR_BITS_PER_WORD-1));
sp->hbits[index] &= ~mask;
}
static int
is_hbit(GCSeg *sp, PRWord *p)
{
unsigned int distance;
unsigned int index;
PRWord mask;
PR_ASSERT( SELECTOROF(p) == SELECTOROF(sp->base) );
PR_ASSERT( OFFSETOF(p) >= OFFSETOF(sp->base) );
distance = (OFFSETOF(p) - OFFSETOF(sp->base)) >> 2;
index = distance >> PR_BITS_PER_WORD_LOG2;
mask = 1L << (distance&(PR_BITS_PER_WORD-1));
return ((sp->hbits[index] & mask) != 0);
}
#endif /* WIN16 */
/*
** Given a pointer into this segment, back it up until we are at the
@ -383,9 +321,6 @@ static PRWord *FindObject(GCSeg *sp, PRWord *p)
p = (PRWord*) ((PRWord)p & ~(PR_BYTES_PER_WORD-1L));
base = (PRWord *) sp->base;
#if defined(WIN16)
PR_ASSERT( SELECTOROF(p) == SELECTOROF(base));
#endif
do {
if (IS_HBIT(sp, p)) {
return (p);
@ -404,15 +339,9 @@ static PRWord *FindObject(GCSeg *sp, PRWord *p)
#define OutputDebugString(msg)
#endif
#if !defined(WIN16)
#define IN_SEGMENT(_sp, _p) \
((((char *)(_p)) >= (_sp)->base) && \
(((char *)(_p)) < (_sp)->limit))
#else
#define IN_SEGMENT(_sp, _p) \
((((PRWord)(_p)) >= ((PRWord)(_sp)->base)) && \
(((PRWord)(_p)) < ((PRWord)(_sp)->limit)))
#endif
static GCSeg *InHeap(void *p)
{
@ -465,13 +394,6 @@ static GCSeg* DoGrowHeap(PRInt32 requestedSize, PRBool exactly)
return 0;
}
#if defined(WIN16)
if (requestedSize > segmentSize) {
PR_DELETE(segInfo);
return 0;
}
#endif
/* Get more memory from the OS */
if (exactly) {
allocSize = requestedSize;
@ -493,9 +415,6 @@ static GCSeg* DoGrowHeap(PRInt32 requestedSize, PRBool exactly)
* sizeof(PRWord);
/* Get bitmap memory from malloc heap */
#if defined(WIN16)
PR_ASSERT( nhbytes < MAX_ALLOC_SIZE );
#endif
hbits = (PRWord *) PR_CALLOC((PRUint32)nhbytes);
if (!hbits) {
/* Loser! */
@ -801,16 +720,8 @@ static void PR_CALLBACK ProcessRootBlock(void **base, PRInt32 count)
high = _pr_gcData.highSeg;
while (--count >= 0) {
p0 = (PRWord*) *base++;
/*
** XXX:
** Until Win16 maintains lowSeg and highSeg correctly,
** (ie. lowSeg=MIN(all segs) and highSeg = MAX(all segs))
** Allways scan through the segment list
*/
#if !defined(WIN16)
if (p0 < low) continue; /* below gc heap */
if (p0 >= high) continue; /* above gc heap */
#endif
/* NOTE: inline expansion of InHeap */
/* Find segment */
sp = lastInHeap;
@ -897,16 +808,8 @@ static void PR_CALLBACK ProcessRootPointer(void *ptr)
p0 = (PRWord*) ptr;
/*
** XXX:
** Until Win16 maintains lowSeg and highSeg correctly,
** (ie. lowSeg=MIN(all segs) and highSeg = MAX(all segs))
** Allways scan through the segment list
*/
#if !defined(WIN16)
if (p0 < _pr_gcData.lowSeg) return; /* below gc heap */
if (p0 >= _pr_gcData.highSeg) return; /* above gc heap */
#endif
/* NOTE: inline expansion of InHeap */
/* Find segment */
@ -1858,16 +1761,8 @@ pr_ConservativeWalkPointer(void* ptr, PRWalkFun walkRootPointer, void* data)
p0 = (PRWord*) ptr;
/*
** XXX:
** Until Win16 maintains lowSeg and highSeg correctly,
** (ie. lowSeg=MIN(all segs) and highSeg = MAX(all segs))
** Allways scan through the segment list
*/
#if !defined(WIN16)
if (p0 < _pr_gcData.lowSeg) return 0; /* below gc heap */
if (p0 >= _pr_gcData.highSeg) return 0; /* above gc heap */
#endif
/* NOTE: inline expansion of InHeap */
/* Find segment */
@ -2637,11 +2532,6 @@ static PRWord *BigAlloc(int cbix, PRInt32 bytes, int dub)
}
#endif
#if defined(WIN16)
/* All memory MUST be aligned on 32bit boundaries */
PR_ASSERT( (((PRWord)p) & (PR_BYTES_PER_WORD-1)) == 0 );
#endif
/* Consume the *entire* segment with a single allocation */
h = MAKE_HEADER(cbix, (chunkSize >> PR_BYTES_PER_WORD_LOG2));
p[0] = h;
@ -2802,7 +2692,6 @@ PR_IMPLEMENT(PRWord GCPTR *)PR_AllocMemory(
**
** MSVC 1.52 crashed on the ff. code because of the "complex" shifting :-(
*/
#if !defined(WIN16)
/* Check for possible overflow of bytes before performing add */
if ((MAX_INT - PR_BYTES_PER_WORD) < bytes ) return NULL;
bytes = (bytes + PR_BYTES_PER_WORD - 1) >> PR_BYTES_PER_WORD_LOG2;
@ -2810,25 +2699,6 @@ PR_IMPLEMENT(PRWord GCPTR *)PR_AllocMemory(
/* Check for possible overflow of bytes before performing add */
if ((MAX_INT - sizeof(PRWord)) < bytes ) return NULL;
bytes += sizeof(PRWord);
#else
/*
** For WIN16 the shifts have been broken out into separate statements
** to prevent the compiler from crashing...
*/
{
PRWord shiftVal;
/* Check for possible overflow of bytes before performing add */
if ((MAX_INT - PR_BYTES_PER_WORD) < bytes ) return NULL;
bytes += PR_BYTES_PER_WORD - 1L;
shiftVal = PR_BYTES_PER_WORD_LOG2;
bytes >>= shiftVal;
bytes <<= shiftVal;
/* Check for possible overflow of bytes before performing add */
if ((MAX_INT - sizeof(PRWord)) < bytes ) return NULL;
bytes += sizeof(PRWord);
}
#endif
/*
* Add in an extra word of memory for double-aligned memory. Some
* percentage of the time this will waste a word of memory (too
@ -3070,25 +2940,9 @@ PR_AllocSimpleMemory(PRWord requestedBytes, PRInt32 tix)
**
** MSVC 1.52 crashed on the ff. code because of the "complex" shifting :-(
*/
#if !defined(WIN16)
bytes = (bytes + PR_BYTES_PER_WORD - 1) >> PR_BYTES_PER_WORD_LOG2;
bytes <<= PR_BYTES_PER_WORD_LOG2;
bytes += sizeof(PRWord);
#else
/*
** For WIN16 the shifts have been broken out into separate statements
** to prevent the compiler from crashing...
*/
{
PRWord shiftVal;
bytes += PR_BYTES_PER_WORD - 1L;
shiftVal = PR_BYTES_PER_WORD_LOG2;
bytes >>= shiftVal;
bytes <<= shiftVal;
bytes += sizeof(PRWord);
}
#endif
/*
* Add in an extra word of memory for double-aligned memory. Some
@ -3112,9 +2966,6 @@ PR_AllocSimpleMemory(PRWord requestedBytes, PRInt32 tix)
bytes += sizeof(GCBlockEnd);
#endif
#if defined(WIN16)
PR_ASSERT( bytes < MAX_ALLOC_SIZE );
#endif
/* Java can ask for objects bigger than 4M, but it won't get them */
/*
* This check was added because there is a fundamental limit of
@ -3288,10 +3139,6 @@ PR_IMPLEMENT(void) PR_InitGC(
_pr_pageShift = PR_GetPageShift();
_pr_pageSize = PR_GetPageSize();
#if defined(WIN16)
PR_ASSERT( initialHeapSize < MAX_ALLOC_SIZE );
#endif
/* Setup initial heap size and initial segment size */
if (0 != segSize) segmentSize = segSize;
#ifdef DEBUG
@ -3343,19 +3190,6 @@ PR_IMPLEMENT(void) PR_InitGC(
PR_RegisterRootFinder(ScanWeakFreeList, "scan weak free list", 0);
}
#if defined(WIN16)
/*
** For WIN16 the GC_IN_HEAP() macro must call the private InHeap function.
** This public wrapper function makes this possible...
*/
PR_IMPLEMENT(PRBool)
PR_GC_In_Heap(void *object)
{
return InHeap( object ) != NULL;
}
#endif
/** Added by Vishy for sanity checking a few GC structures **/
/** Can use SanityCheckGC to debug corrupted GC Heap situations **/

View File

@ -1,77 +0,0 @@
/* -*- Mode: C++; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
* Version: MPL 1.1/GPL 2.0/LGPL 2.1
*
* The contents of this file are subject to the Mozilla Public License Version
* 1.1 (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
* http://www.mozilla.org/MPL/
*
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
* for the specific language governing rights and limitations under the
* License.
*
* The Original Code is the Netscape Portable Runtime (NSPR).
*
* The Initial Developer of the Original Code is
* Netscape Communications Corporation.
* Portions created by the Initial Developer are Copyright (C) 1998-2000
* the Initial Developer. All Rights Reserved.
*
* Contributor(s):
*
* Alternatively, the contents of this file may be used under the terms of
* either the GNU General Public License Version 2 or later (the "GPL"), or
* the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
* in which case the provisions of the GPL or the LGPL are applicable instead
* of those above. If you wish to allow use of your version of this file only
* under the terms of either the GPL or the LGPL, and not to allow others to
* use your version of this file under the terms of the MPL, indicate your
* decision by deleting the provisions above and replace them with the notice
* and other provisions required by the GPL or the LGPL. If you do not delete
* the provisions above, a recipient may use your version of this file under
* the terms of any one of the MPL, the GPL or the LGPL.
*
* ***** END LICENSE BLOCK ***** */
#if defined(WIN16)
#include <windows.h>
#endif
#include "prtypes.h"
#include <stdlib.h>
#define MAX_SEGMENT_SIZE (65536l - 4096l)
/************************************************************************/
/*
** Machine dependent GC Heap management routines:
** _MD_GrowGCHeap
*/
/************************************************************************/
void _MD_InitGC(void) {}
extern void *
_MD_GrowGCHeap(PRUint32 *sizep)
{
void *addr;
if( *sizep > MAX_SEGMENT_SIZE ) {
*sizep = MAX_SEGMENT_SIZE;
}
addr = malloc((size_t)*sizep);
return addr;
}
HINSTANCE _pr_hInstance;
int CALLBACK LibMain( HINSTANCE hInst, WORD wDataSeg,
WORD cbHeapSize, LPSTR lpszCmdLine )
{
_pr_hInstance = hInst;
return TRUE;
}

View File

@ -46,11 +46,6 @@ include $(MOD_DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
ifeq ($(OS_TARGET), WIN16)
OS_CFLAGS = $(OS_EXE_CFLAGS)
W16STDIO = $(MOD_DEPTH)/pr/src/md/windows/$(OBJDIR)/w16stdio.$(OBJ_SUFFIX)
endif
ifeq ($(OS_TARGET), OS2)
OS_CFLAGS = $(OS_EXE_CFLAGS)
endif
@ -79,17 +74,11 @@ LIBPLC = -lplc$(NSPR_VERSION)
LIBGC = -lmsgc$(GC_VERSION)
ifeq ($(OS_ARCH), WINNT)
ifeq ($(OS_TARGET), WIN16)
LIBPR = $(dist_libdir)/nspr$(NSPR_VERSION).lib
LIBPLC = $(dist_libdir)/plc$(NSPR_VERSION).lib
LIBGC= $(dist_libdir)/msgc$(GC_VERSION).lib
else
LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO
LIBPR = $(dist_libdir)/libnspr$(NSPR_VERSION).$(LIB_SUFFIX)
LIBPLC = $(dist_libdir)/libplc$(NSPR_VERSION).$(LIB_SUFFIX)
LIBGC= $(dist_libdir)/libmsgc$(GC_VERSION).$(LIB_SUFFIX)
endif
endif
ifeq ($(OS_ARCH),OS2)
LDOPTS += -Zomf -Zlinker /PM:VIO
@ -266,23 +255,6 @@ else
$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
@$(MAKE_OBJDIR)
ifeq ($(OS_ARCH), WINNT)
ifeq ($(OS_TARGET),WIN16)
echo system windows >w16link
echo name $@ >>w16link
echo option map >>w16link
# echo option CASEEXACT >>w16link
echo option stack=16K >>w16link
echo debug $(DEBUGTYPE) all >>w16link
echo file >>w16link
echo $< , >>w16link
echo $(W16STDIO) >>w16link
echo library >>w16link
echo $(LIBPR), >>w16link
echo $(LIBPLC), >>w16link
echo $(LIBGC), >>w16link
echo winsock.lib >>w16link
wlink @w16link.
else
link $(LDOPTS) $< $(LIBGC) $(LIBPLC) $(LIBPR) wsock32.lib -out:$@
else
ifeq ($(OS_ARCH),OS2)

View File

@ -46,10 +46,6 @@ include $(MOD_DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
ifeq ($(OS_TARGET), WIN16)
OS_CFLAGS = $(OS_EXE_CFLAGS)
endif
CXXSRCS = \
testprstrm.cpp \
$(NULL)
@ -75,10 +71,6 @@ LIBPR = -lnspr$(MOD_MAJOR_VERSION)
LIBPRSTRMS = -lprstrms$(MOD_MAJOR_VERSION)
ifeq ($(OS_ARCH), WINNT)
ifeq ($(OS_TARGET), WIN16)
LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
LIBPRSTRMS = $(dist_libdir)/prstrms$(MOD_MAJOR_VERSION).lib
else
LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO
ifeq ($(OS_TARGET), WIN95)
LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
@ -88,7 +80,6 @@ else
LIBPRSTRMS = $(dist_libdir)/libprstrms$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
endif
endif
endif
ifeq ($(OS_ARCH),OS2)
LDOPTS += -Zomf -Zlinker /PM:VIO -lstdcpp
@ -211,23 +202,7 @@ else
$(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
@$(MAKE_OBJDIR)
ifeq ($(OS_ARCH), WINNT)
ifeq ($(OS_TARGET),WIN16)
echo system windows >w16link
echo option map >>w16link
echo option stack=10K >>w16link
echo option heapsize=32K >>w16link
echo debug $(DEBUGTYPE) all >>w16link
echo name $@ >>w16link
echo file >>w16link
echo $< >>w16link
echo library >>w16link
echo $(LIBPR), >>w16link
echo $(LIBPRSTRMS), >>w16link
echo winsock.lib >>w16link
wlink @w16link.
else
link $(LDOPTS) $< $(LIBPR) $(LIBPRSTRMS) wsock32.lib -out:$@
endif
else
ifeq ($(OS_ARCH),OS2)
$(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPR) $(LIBPRSTRMS) $(OS_LIBS) $(EXTRA_LIBS)

View File

@ -46,10 +46,6 @@ include $(MOD_DEPTH)/config/autoconf.mk
include $(topsrcdir)/config/config.mk
ifeq ($(OS_TARGET), WIN16)
OS_CFLAGS = $(OS_EXE_CFLAGS)
endif
CSRCS = \
arena.c \
base64t.c \
@ -80,11 +76,6 @@ LIBPLC = -lplc$(MOD_MAJOR_VERSION)
LIBPLDS = -lplds$(MOD_MAJOR_VERSION)
ifeq ($(OS_ARCH), WINNT)
ifeq ($(OS_TARGET), WIN16)
LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).lib
LIBPLC= $(dist_libdir)/plc$(MOD_MAJOR_VERSION).lib
LIBPLDS= $(dist_libdir)/plds$(MOD_MAJOR_VERSION).lib
else
LDOPTS = -NOLOGO -DEBUG -INCREMENTAL:NO
ifeq ($(OS_TARGET), WIN95)
LIBPR = $(dist_libdir)/nspr$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
@ -96,7 +87,6 @@ else
LIBPLDS= $(dist_libdir)/libplds$(MOD_MAJOR_VERSION).$(LIB_SUFFIX)
endif
endif
endif
ifeq ($(OS_ARCH),OS2)
LDOPTS += -Zomf -Zlinker /PM:VIO
@ -214,23 +204,7 @@ $(OBJDIR)/%$(PROG_SUFFIX): $(OBJDIR)/%.$(OBJ_SUFFIX)
@$(MAKE_OBJDIR)
ifeq ($(OS_ARCH), WINNT)
ifeq ($(OS_TARGET),WIN16)
echo system windows >w16link
echo option map >>w16link
echo option stack=10K >>w16link
echo option heapsize=32K >>w16link
echo debug $(DEBUGTYPE) all >>w16link
echo name $@ >>w16link
echo file >>w16link
echo $< >>w16link
echo library >>w16link
echo $(LIBPR), >>w16link
echo $(LIBPLC), >>w16link
echo winsock.lib >>w16link
wlink @w16link.
else
link $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) wsock32.lib -out:$@
endif
else
ifeq ($(OS_ARCH),OS2)
$(LINK) $(EXEFLAGS) $(LDOPTS) $< $(LIBPLC) $(LIBPLDS) $(LIBPR) $(OS_LIBS) $(EXTRA_LIBS)
@ -243,6 +217,3 @@ endif
export:: $(TARGETS)
clean::
rm -f $(TARGETS)