From 33b3eec69d67706d46abe0db8c88f60652066f4b Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sat, 14 Jun 2014 14:34:10 +0100 Subject: [PATCH 1/4] More modular to assign the primary chunk in arenachunkinsert. Copied from Perforce Change: 186621 ServerID: perforce.ravenbrook.com --- mps/code/arena.c | 7 ++++++- mps/code/tract.c | 5 ----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/mps/code/arena.c b/mps/code/arena.c index 5b81444b9ef..dbcf91ff5b2 100644 --- a/mps/code/arena.c +++ b/mps/code/arena.c @@ -638,7 +638,7 @@ Res ControlDescribe(Arena arena, mps_lib_FILE *stream, Count depth) } -/* ArenaChunkInsert -- insert chunk into arena's chunk tree */ +/* ArenaChunkInsert -- insert chunk into arena's chunk tree and ring */ void ArenaChunkInsert(Arena arena, Chunk chunk) { Bool inserted; @@ -655,6 +655,11 @@ void ArenaChunkInsert(Arena arena, Chunk chunk) { TreeBalance(&updatedTree); arena->chunkTree = updatedTree; RingAppend(&arena->chunkRing, &chunk->chunkRing); + + /* As part of the bootstrap, the first created chunk becomes the primary + chunk. This step allows ArenaFreeLandInsert to allocate pages. */ + if (arena->primary == NULL) + arena->primary = chunk; } diff --git a/mps/code/tract.c b/mps/code/tract.c index 943f84fedfa..eff4ffd7bba 100644 --- a/mps/code/tract.c +++ b/mps/code/tract.c @@ -232,11 +232,6 @@ Res ChunkInit(Chunk chunk, Arena arena, ArenaChunkInsert(arena, chunk); - /* As part of the bootstrap, the first created chunk becomes the primary - chunk. This step allows AreaFreeLandInsert to allocate pages. */ - if (arena->primary == NULL) - arena->primary = chunk; - return ResOK; failLandInsert: From 65243ddfdf8c84649baee51ff6aa1f98df2fd6d7 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sat, 14 Jun 2014 15:55:21 +0100 Subject: [PATCH 2/4] There's nothing special about version.c that requires it to be linked separately. Copied from Perforce Change: 186627 ServerID: perforce.ravenbrook.com --- mps/code/comm.gmk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mps/code/comm.gmk b/mps/code/comm.gmk index 6e5adce14f5..d923532269a 100644 --- a/mps/code/comm.gmk +++ b/mps/code/comm.gmk @@ -210,6 +210,7 @@ MPMCOMMON = \ traceanc.c \ tract.c \ tree.c \ + version.c \ walk.c MPM = $(MPMCOMMON) $(MPMPF) $(AMC) $(AMS) $(AWL) $(LO) $(MV2) $(MVFF) $(PLINTH) @@ -634,8 +635,7 @@ endif $(PFM)/$(VARIETY)/%.a: $(ECHO) "$(PFM): $@" rm -f $@ - $(CC) $(CFLAGSSTRICT) -c -o $(PFM)/$(VARIETY)/version.o version.c - $(AR) $(ARFLAGS) $@ $^ $(PFM)/$(VARIETY)/version.o + $(AR) $(ARFLAGS) $@ $^ $(RANLIB) $@ # Executable From 5107ea0a5329241cbe705f0a8c5b5261ac1374b1 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sat, 14 Jun 2014 16:08:31 +0100 Subject: [PATCH 3/4] Bring xcode project up to date. Fix signed/unsigned integer comparison warning in Scheme example. Copied from Perforce Change: 186629 ServerID: perforce.ravenbrook.com --- mps/code/mps.xcodeproj/project.pbxproj | 18 +++++++++++------- mps/example/scheme/scheme-advanced.c | 8 +++++--- mps/example/scheme/scheme.c | 8 +++++--- 3 files changed, 21 insertions(+), 13 deletions(-) diff --git a/mps/code/mps.xcodeproj/project.pbxproj b/mps/code/mps.xcodeproj/project.pbxproj index 39a2d76f8ea..6ba7c740c7a 100644 --- a/mps/code/mps.xcodeproj/project.pbxproj +++ b/mps/code/mps.xcodeproj/project.pbxproj @@ -1426,15 +1426,15 @@ 22B2BC3618B6434F00C33E63 /* scheme-advanced */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = "scheme-advanced"; sourceTree = BUILT_PRODUCTS_DIR; }; 22C2ACA018BE3FEC006B3677 /* nailboardtest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nailboardtest.c; sourceTree = ""; }; 22C2ACAF18BE400A006B3677 /* nailboardtest */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = nailboardtest; sourceTree = BUILT_PRODUCTS_DIR; }; - 22E30E821886FF1400D98EA9 /* nailboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nailboard.c; sourceTree = ""; }; - 22E30E831886FF1400D98EA9 /* nailboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nailboard.h; sourceTree = ""; }; - 22F846AF18F4379C00982BA7 /* lockut.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lockut.c; sourceTree = ""; }; - 22F846BD18F437B900982BA7 /* lockut */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = lockut; sourceTree = BUILT_PRODUCTS_DIR; }; 22C5C99A18EC6AEC004C63D4 /* failover.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = failover.c; sourceTree = ""; }; 22C5C99B18EC6AEC004C63D4 /* failover.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = failover.h; sourceTree = ""; }; 22C5C99C18EC6AEC004C63D4 /* land.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = land.c; sourceTree = ""; }; 22DD93E118ED815F00240DD2 /* failover.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = failover.txt; path = ../design/failover.txt; sourceTree = ""; }; 22DD93E218ED815F00240DD2 /* land.txt */ = {isa = PBXFileReference; lastKnownFileType = text; name = land.txt; path = ../design/land.txt; sourceTree = ""; }; + 22E30E821886FF1400D98EA9 /* nailboard.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = nailboard.c; sourceTree = ""; }; + 22E30E831886FF1400D98EA9 /* nailboard.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = nailboard.h; sourceTree = ""; }; + 22F846AF18F4379C00982BA7 /* lockut.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = lockut.c; sourceTree = ""; }; + 22F846BD18F437B900982BA7 /* lockut */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = lockut; sourceTree = BUILT_PRODUCTS_DIR; }; 22FA177516E8D6FC0098B23F /* amcssth */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = amcssth; sourceTree = BUILT_PRODUCTS_DIR; }; 22FA177616E8D7A80098B23F /* amcssth.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = amcssth.c; sourceTree = ""; }; 22FACED1188807FF000FDBC1 /* airtest.c */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.c; path = airtest.c; sourceTree = ""; }; @@ -1599,7 +1599,6 @@ 311F2F6717398B3B00C15B6A /* mpsio.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mpsio.h; sourceTree = ""; }; 311F2F6817398B3B00C15B6A /* mpslib.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mpslib.h; sourceTree = ""; }; 311F2F6917398B3B00C15B6A /* mpstd.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mpstd.h; sourceTree = ""; }; - 311F2F6A17398B4C00C15B6A /* mpsw3.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mpsw3.h; sourceTree = ""; }; 311F2F6B17398B4C00C15B6A /* mpswin.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = mpswin.h; sourceTree = ""; }; 311F2F6D17398B6300C15B6A /* prmci3.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = prmci3.h; sourceTree = ""; }; 311F2F6E17398B6300C15B6A /* prmci6.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = prmci6.h; sourceTree = ""; }; @@ -2410,7 +2409,6 @@ 311F2F6717398B3B00C15B6A /* mpsio.h */, 311F2F6817398B3B00C15B6A /* mpslib.h */, 311F2F6917398B3B00C15B6A /* mpstd.h */, - 311F2F6A17398B4C00C15B6A /* mpsw3.h */, 311F2F6B17398B4C00C15B6A /* mpswin.h */, 22E30E821886FF1400D98EA9 /* nailboard.c */, 22E30E831886FF1400D98EA9 /* nailboard.h */, @@ -3383,7 +3381,7 @@ 31EEABDA156AAE9E00714D05 /* Project object */ = { isa = PBXProject; attributes = { - LastUpgradeCheck = 0460; + LastUpgradeCheck = 0510; }; buildConfigurationList = 31EEABDD156AAE9E00714D05 /* Build configuration list for PBXProject "mps" */; compatibilityVersion = "Xcode 3.2"; @@ -5170,6 +5168,7 @@ isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -5190,6 +5189,7 @@ GCC_WARN_PEDANTIC = YES; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; @@ -5606,6 +5606,7 @@ isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -5626,6 +5627,7 @@ GCC_WARN_PEDANTIC = YES; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; @@ -5660,6 +5662,7 @@ isa = XCBuildConfiguration; buildSettings = { ARCHS = "$(ARCHS_STANDARD_32_64_BIT)"; + CLANG_WARN_EMPTY_BODY = YES; CLANG_WARN_IMPLICIT_SIGN_CONVERSION = YES; CLANG_WARN_SUSPICIOUS_IMPLICIT_CONVERSION = YES; CLANG_WARN__DUPLICATE_METHOD_MATCH = YES; @@ -5680,6 +5683,7 @@ GCC_WARN_PEDANTIC = YES; GCC_WARN_SHADOW = YES; GCC_WARN_SIGN_COMPARE = YES; + GCC_WARN_UNDECLARED_SELECTOR = YES; GCC_WARN_UNINITIALIZED_AUTOS = YES; GCC_WARN_UNKNOWN_PRAGMAS = YES; GCC_WARN_UNUSED_FUNCTION = YES; diff --git a/mps/example/scheme/scheme-advanced.c b/mps/example/scheme/scheme-advanced.c index 744025b1b76..82b9c58d1cd 100644 --- a/mps/example/scheme/scheme-advanced.c +++ b/mps/example/scheme/scheme-advanced.c @@ -4384,9 +4384,11 @@ static int start(int argc, char *argv[]) fprintf(stderr, "%s\n", error_message); fflush(stderr); exit_code = EXIT_FAILURE; - } else - for (i = 0; i < argc; ++i) - load(env, op_env, make_string(strlen(argv[i]), argv[i])); + } else { + int a; + for (a = 0; a < argc; ++a) + load(env, op_env, make_string(strlen(argv[a]), argv[a])); + } } else { /* Ask the MPS to tell us when it's garbage collecting so that we can print some messages. Completely optional. */ diff --git a/mps/example/scheme/scheme.c b/mps/example/scheme/scheme.c index 971314528f8..bb178276565 100644 --- a/mps/example/scheme/scheme.c +++ b/mps/example/scheme/scheme.c @@ -4314,9 +4314,11 @@ static int start(int argc, char *argv[]) fprintf(stderr, "%s\n", error_message); fflush(stderr); exit_code = EXIT_FAILURE; - } else - for (i = 0; i < argc; ++i) - load(env, op_env, make_string(strlen(argv[i]), argv[i])); + } else { + int a; + for (a = 0; a < argc; ++a) + load(env, op_env, make_string(strlen(argv[a]), argv[a])); + } } else { /* Ask the MPS to tell us when it's garbage collecting so that we can print some messages. Completely optional. */ From 916a40c8f2e19cb7e52feb94b77af2a744cf0202 Mon Sep 17 00:00:00 2001 From: Gareth Rees Date: Sat, 14 Jun 2014 16:18:50 +0100 Subject: [PATCH 4/4] Avoid warnings from xcode for string literals that exceed the portable limit. Copied from Perforce Change: 186632 ServerID: perforce.ravenbrook.com --- mps/code/djbench.c | 12 +++++++----- mps/code/gcbench.c | 29 ++++++++++++++++------------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/mps/code/djbench.c b/mps/code/djbench.c index 46f2cdb0086..b0f1d556560 100644 --- a/mps/code/djbench.c +++ b/mps/code/djbench.c @@ -301,6 +301,8 @@ int main(int argc, char *argv[]) { } break; default: + /* This is printed in parts to keep within the 509 character + limit for string literals in portable standard C. */ fprintf(stderr, "Usage: %s [option...] [test...]\n" "Options:\n" @@ -317,18 +319,17 @@ int main(int argc, char *argv[]) { " -b n, --nblocks=n\n" " Length of the block array (default %u).\n" " -s n, --sshift=n\n" - " Log2 max block size in words (default %u).\n" - " -c p, --pact=p\n" - " Probability of acting on a block (default %g).\n", + " Log2 max block size in words (default %u).\n", argv[0], (unsigned long)arena_size, (unsigned long)arena_grain_size, niter, npass, nblocks, - sshift, - pact); + sshift); fprintf(stderr, + " -c p, --pact=p\n" + " Probability of acting on a block (default %g).\n" " -r n, --rinter=n\n" " Recurse every n passes if n > 0 (default %u).\n" " -d n, --rmax=n\n" @@ -343,6 +344,7 @@ int main(int argc, char *argv[]) { " mv pool class MV\n" " mvb pool class MV with buffers\n" " an malloc\n", + pact, rinter, rmax); return EXIT_FAILURE; diff --git a/mps/code/gcbench.c b/mps/code/gcbench.c index 05eb5cff053..4503230580c 100644 --- a/mps/code/gcbench.c +++ b/mps/code/gcbench.c @@ -393,6 +393,8 @@ int main(int argc, char *argv[]) { zoned = FALSE; break; default: + /* This is printed in parts to keep within the 509 character + limit for string literals in portable standard C. */ fprintf(stderr, "Usage: %s [option...] [test...]\n" "Options:\n" @@ -405,20 +407,19 @@ int main(int argc, char *argv[]) { " -i n, --niter=n\n" " Iterate each test n times (default %u).\n" " -p n, --npass=n\n" - " Pass over the tree n times (default %u).\n" - " -g c,m, --gen=c[KMG],m\n" - " Generation with capacity c (in Kb) and mortality m\n" - " Use multiple times for multiple generations.\n" - " -w n, --width=n\n" - " Width of tree nodes made (default %lu)\n", + " Pass over the tree n times (default %u).\n", argv[0], (unsigned long)arena_size, (unsigned long)arena_grain_size, nthreads, niter, - npass, - (unsigned long)width); + npass); fprintf(stderr, + " -g c,m, --gen=c[KMG],m\n" + " Generation with capacity c (in Kb) and mortality m\n" + " Use multiple times for multiple generations.\n" + " -w n, --width=n\n" + " Width of tree nodes made (default %lu)\n" " -d n, --depth=n\n" " Depth of tree made (default %u)\n" " -r p, --preuse=p\n" @@ -428,15 +429,17 @@ int main(int argc, char *argv[]) { " -l --pin-leaf\n" " Make a pinned object to use for leaves.\n" " -x n, --seed=n\n" - " Random number seed (default from entropy)\n" + " Random number seed (default from entropy)\n", + (unsigned long)width, + depth, + preuse, + pupdate); + fprintf(stderr, " -z, --arena-unzoned\n" " Disable zoned allocation in the arena\n" "Tests:\n" " amc pool class AMC\n" - " ams pool class AMS\n", - depth, - preuse, - pupdate); + " ams pool class AMS\n"); return EXIT_FAILURE; } argc -= optind;