Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Nov 2013 08:49:53 +0000 (UTC)
From:      Gleb Smirnoff <glebius@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r258764 - in projects/sendfile: . cddl/contrib/opensolaris/cmd/zdb cddl/contrib/opensolaris/cmd/zpool cddl/contrib/opensolaris/cmd/ztest contrib/gcc contrib/gcc/config/rs6000 contrib/gc...
Message-ID:  <201311300849.rAU8nrAZ057142@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: glebius
Date: Sat Nov 30 08:49:52 2013
New Revision: 258764
URL: http://svnweb.freebsd.org/changeset/base/258764

Log:
  Merge head up to r258763.

Added:
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c
     - copied unchanged from r258763, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/range_tree.c
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_reftree.c
     - copied unchanged from r258763, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_reftree.c
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/range_tree.h
     - copied unchanged from r258763, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/range_tree.h
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_reftree.h
     - copied unchanged from r258763, head/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_reftree.h
  projects/sendfile/sys/net/sff8472.h
     - copied unchanged from r258763, head/sys/net/sff8472.h
  projects/sendfile/sys/powerpc/wii/ios_if.m
     - copied unchanged from r258763, head/sys/powerpc/wii/ios_if.m
Modified:
  projects/sendfile/UPDATING
  projects/sendfile/cddl/contrib/opensolaris/cmd/zdb/zdb.c
  projects/sendfile/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
  projects/sendfile/cddl/contrib/opensolaris/cmd/ztest/ztest.c
  projects/sendfile/contrib/gcc/ChangeLog.gcc43
  projects/sendfile/contrib/gcc/builtins.c
  projects/sendfile/contrib/gcc/c-common.c
  projects/sendfile/contrib/gcc/c-decl.c
  projects/sendfile/contrib/gcc/c-typeck.c
  projects/sendfile/contrib/gcc/config/rs6000/rs6000.c
  projects/sendfile/contrib/gcc/cp/ChangeLog.gcc43
  projects/sendfile/contrib/gcc/cp/decl.c
  projects/sendfile/contrib/gcc/cp/semantics.c
  projects/sendfile/contrib/gcc/cp/typeck.c
  projects/sendfile/contrib/gcc/doc/extend.texi
  projects/sendfile/contrib/gcc/flags.h
  projects/sendfile/contrib/gcc/print-tree.c
  projects/sendfile/contrib/gcc/toplev.c
  projects/sendfile/contrib/gcc/tree.c
  projects/sendfile/contrib/gcc/tree.h
  projects/sendfile/contrib/gcc/varasm.c
  projects/sendfile/contrib/gcclibs/libcpp/charset.c
  projects/sendfile/contrib/gcclibs/libcpp/errors.c
  projects/sendfile/contrib/gdb/gdb/amd64fbsd-nat.c
  projects/sendfile/etc/mtree/BSD.var.dist
  projects/sendfile/lib/libnetgraph/netgraph.3
  projects/sendfile/lib/libstand/libstand.3
  projects/sendfile/release/Makefile
  projects/sendfile/sbin/fdisk/fdisk.c
  projects/sendfile/sbin/ipfw/ipfw2.c
  projects/sendfile/sbin/ipfw/ipfw2.h
  projects/sendfile/sbin/sysctl/sysctl.c
  projects/sendfile/share/man/man4/Makefile
  projects/sendfile/share/man/man4/netgraph.4
  projects/sendfile/share/man/man4/u3g.4
  projects/sendfile/share/misc/committers-src.dot   (contents, props changed)
  projects/sendfile/sys/amd64/include/pcb.h
  projects/sendfile/sys/amd64/include/segments.h
  projects/sendfile/sys/amd64/vmm/io/ppt.c
  projects/sendfile/sys/amd64/vmm/io/vhpet.c
  projects/sendfile/sys/amd64/vmm/io/vioapic.c
  projects/sendfile/sys/amd64/vmm/io/vioapic.h
  projects/sendfile/sys/amd64/vmm/io/vlapic.c
  projects/sendfile/sys/amd64/vmm/io/vlapic.h
  projects/sendfile/sys/amd64/vmm/vmm_dev.c
  projects/sendfile/sys/amd64/vmm/vmm_ktr.h
  projects/sendfile/sys/amd64/vmm/vmm_lapic.c
  projects/sendfile/sys/amd64/vmm/vmm_lapic.h
  projects/sendfile/sys/arm/arm/pmap-v6.c
  projects/sendfile/sys/boot/fdt/dts/rpi.dts
  projects/sendfile/sys/boot/i386/efi/reloc.c
  projects/sendfile/sys/cddl/compat/opensolaris/kern/opensolaris_taskq.c
  projects/sendfile/sys/cddl/compat/opensolaris/kern/opensolaris_vm.c
  projects/sendfile/sys/cddl/compat/opensolaris/sys/vm.h
  projects/sendfile/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.c
  projects/sendfile/sys/cddl/contrib/opensolaris/common/zfs/zfeature_common.h
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/Makefile.files
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dmu.c
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/dnode.c
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/metaslab.c
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa.c
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/spa_misc.c
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/space_map.c
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/dmu.h
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab.h
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/metaslab_impl.h
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/space_map.h
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/vdev_impl.h
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/sys/zfeature.h
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev.c
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/vdev_label.c
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfeature.c
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_dir.c
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vnops.c
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_znode.c
  projects/sendfile/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zio.c
  projects/sendfile/sys/compat/freebsd32/freebsd32.h
  projects/sendfile/sys/compat/freebsd32/freebsd32_misc.c
  projects/sendfile/sys/conf/files
  projects/sendfile/sys/conf/kern.pre.mk
  projects/sendfile/sys/conf/options
  projects/sendfile/sys/conf/options.amd64
  projects/sendfile/sys/dev/cxgbe/t4_sge.c
  projects/sendfile/sys/dev/iwn/if_iwn.c
  projects/sendfile/sys/dev/nand/nandbus.c
  projects/sendfile/sys/dev/sfxge/common/siena_nic.c
  projects/sendfile/sys/dev/usb/wlan/if_run.c
  projects/sendfile/sys/dev/usb/wlan/if_runreg.h
  projects/sendfile/sys/fs/nfsclient/nfs_kdtrace.h
  projects/sendfile/sys/geom/geom_disk.c
  projects/sendfile/sys/geom/geom_dump.c
  projects/sendfile/sys/geom/geom_int.h
  projects/sendfile/sys/kern/kern_jail.c
  projects/sendfile/sys/kern/kern_proc.c
  projects/sendfile/sys/kern/kern_synch.c
  projects/sendfile/sys/kern/subr_taskqueue.c
  projects/sendfile/sys/libkern/iconv.c
  projects/sendfile/sys/net/netisr.c
  projects/sendfile/sys/net/vnet.c
  projects/sendfile/sys/net80211/ieee80211_scan.c
  projects/sendfile/sys/net80211/ieee80211_scan_sta.c
  projects/sendfile/sys/netpfil/ipfw/ip_fw2.c
  projects/sendfile/sys/netpfil/ipfw/ip_fw_sockopt.c
  projects/sendfile/sys/powerpc/aim/machdep.c
  projects/sendfile/sys/powerpc/aim/trap.c
  projects/sendfile/sys/powerpc/booke/trap.c
  projects/sendfile/sys/powerpc/ofw/rtas.c
  projects/sendfile/sys/powerpc/powermac/grackle.c
  projects/sendfile/sys/powerpc/powerpc/cpu.c
  projects/sendfile/sys/powerpc/pseries/phyp_console.c
  projects/sendfile/sys/sys/sysctl.h
  projects/sendfile/sys/sys/taskqueue.h
  projects/sendfile/sys/sys/user.h
  projects/sendfile/sys/vm/uma_core.c
  projects/sendfile/tools/tools/cxgbetool/Makefile
  projects/sendfile/tools/tools/cxgbetool/cxgbetool.c
  projects/sendfile/tools/tools/nanobsd/nanobsd.sh
  projects/sendfile/tools/tools/zfsboottest/Makefile
  projects/sendfile/usr.sbin/bhyve/acpi.c
  projects/sendfile/usr.sbin/bhyve/mptbl.c
  projects/sendfile/usr.sbin/bhyve/uart_emul.c
  projects/sendfile/usr.sbin/bhyveload/bhyveload.8
  projects/sendfile/usr.sbin/bhyveload/bhyveload.c
  projects/sendfile/usr.sbin/bsdconfig/includes/includes
  projects/sendfile/usr.sbin/makefs/ffs.c
Directory Properties:
  projects/sendfile/   (props changed)
  projects/sendfile/cddl/   (props changed)
  projects/sendfile/cddl/contrib/opensolaris/   (props changed)
  projects/sendfile/cddl/contrib/opensolaris/cmd/dtrace/test/tst/common/print/   (props changed)
  projects/sendfile/cddl/contrib/opensolaris/cmd/zfs/   (props changed)
  projects/sendfile/cddl/contrib/opensolaris/lib/libzfs/   (props changed)
  projects/sendfile/contrib/gcc/   (props changed)
  projects/sendfile/contrib/gdb/   (props changed)
  projects/sendfile/sbin/   (props changed)
  projects/sendfile/sbin/ipfw/   (props changed)
  projects/sendfile/share/man/man4/   (props changed)
  projects/sendfile/sys/   (props changed)
  projects/sendfile/sys/amd64/vmm/   (props changed)
  projects/sendfile/sys/boot/   (props changed)
  projects/sendfile/sys/boot/i386/efi/   (props changed)
  projects/sendfile/sys/cddl/contrib/opensolaris/   (props changed)
  projects/sendfile/sys/conf/   (props changed)
  projects/sendfile/usr.sbin/bhyve/   (props changed)
  projects/sendfile/usr.sbin/bhyveload/   (props changed)

Modified: projects/sendfile/UPDATING
==============================================================================
--- projects/sendfile/UPDATING	Sat Nov 30 07:04:35 2013	(r258763)
+++ projects/sendfile/UPDATING	Sat Nov 30 08:49:52 2013	(r258764)
@@ -76,7 +76,12 @@ NOTE TO PEOPLE WHO THINK THAT FreeBSD 11
 	BIND has been removed from the base system.  If all you need
 	is a local resolver, simply enable and start the local_unbound
 	service instead.  Otherwise, several versions of BIND are
-	available in the ports tree.
+	available in the ports tree.   The dns/bind99 port is one example.
+
+	With this change, nslookup(1) and dig(1) are no longer in the base
+	system.  Users should instead use host(1) and drill(1) which are
+	in the base system.  Alternatively, nslookup and dig can
+	be obtained by installing the dns/bind-tools port.
 
 20130916:
 	With the addition of unbound(8), a new unbound user is now

Modified: projects/sendfile/cddl/contrib/opensolaris/cmd/zdb/zdb.c
==============================================================================
--- projects/sendfile/cddl/contrib/opensolaris/cmd/zdb/zdb.c	Sat Nov 30 07:04:35 2013	(r258763)
+++ projects/sendfile/cddl/contrib/opensolaris/cmd/zdb/zdb.c	Sat Nov 30 08:49:52 2013	(r258764)
@@ -242,7 +242,7 @@ const char histo_stars[] = "************
 const int histo_width = sizeof (histo_stars) - 1;
 
 static void
-dump_histogram(const uint64_t *histo, int size)
+dump_histogram(const uint64_t *histo, int size, int offset)
 {
 	int i;
 	int minidx = size - 1;
@@ -263,7 +263,7 @@ dump_histogram(const uint64_t *histo, in
 
 	for (i = minidx; i <= maxidx; i++) {
 		(void) printf("\t\t\t%3u: %6llu %s\n",
-		    i, (u_longlong_t)histo[i],
+		    i + offset, (u_longlong_t)histo[i],
 		    &histo_stars[(max - histo[i]) * histo_width / max]);
 	}
 }
@@ -316,19 +316,19 @@ dump_zap_stats(objset_t *os, uint64_t ob
 	    (u_longlong_t)zs.zs_salt);
 
 	(void) printf("\t\tLeafs with 2^n pointers:\n");
-	dump_histogram(zs.zs_leafs_with_2n_pointers, ZAP_HISTOGRAM_SIZE);
+	dump_histogram(zs.zs_leafs_with_2n_pointers, ZAP_HISTOGRAM_SIZE, 0);
 
 	(void) printf("\t\tBlocks with n*5 entries:\n");
-	dump_histogram(zs.zs_blocks_with_n5_entries, ZAP_HISTOGRAM_SIZE);
+	dump_histogram(zs.zs_blocks_with_n5_entries, ZAP_HISTOGRAM_SIZE, 0);
 
 	(void) printf("\t\tBlocks n/10 full:\n");
-	dump_histogram(zs.zs_blocks_n_tenths_full, ZAP_HISTOGRAM_SIZE);
+	dump_histogram(zs.zs_blocks_n_tenths_full, ZAP_HISTOGRAM_SIZE, 0);
 
 	(void) printf("\t\tEntries with n chunks:\n");
-	dump_histogram(zs.zs_entries_using_n_chunks, ZAP_HISTOGRAM_SIZE);
+	dump_histogram(zs.zs_entries_using_n_chunks, ZAP_HISTOGRAM_SIZE, 0);
 
 	(void) printf("\t\tBuckets with n entries:\n");
-	dump_histogram(zs.zs_buckets_with_n_entries, ZAP_HISTOGRAM_SIZE);
+	dump_histogram(zs.zs_buckets_with_n_entries, ZAP_HISTOGRAM_SIZE, 0);
 }
 
 /*ARGSUSED*/
@@ -517,26 +517,85 @@ dump_zpldir(objset_t *os, uint64_t objec
 	zap_cursor_fini(&zc);
 }
 
+int
+get_dtl_refcount(vdev_t *vd)
+{
+	int refcount = 0;
+
+	if (vd->vdev_ops->vdev_op_leaf) {
+		space_map_t *sm = vd->vdev_dtl_sm;
+
+		if (sm != NULL &&
+		    sm->sm_dbuf->db_size == sizeof (space_map_phys_t))
+			return (1);
+		return (0);
+	}
+
+	for (int c = 0; c < vd->vdev_children; c++)
+		refcount += get_dtl_refcount(vd->vdev_child[c]);
+	return (refcount);
+}
+
+int
+get_metaslab_refcount(vdev_t *vd)
+{
+	int refcount = 0;
+
+	if (vd->vdev_top == vd) {
+		for (int m = 0; m < vd->vdev_ms_count; m++) {
+			space_map_t *sm = vd->vdev_ms[m]->ms_sm;
+
+			if (sm != NULL &&
+			    sm->sm_dbuf->db_size == sizeof (space_map_phys_t))
+				refcount++;
+		}
+	}
+	for (int c = 0; c < vd->vdev_children; c++)
+		refcount += get_metaslab_refcount(vd->vdev_child[c]);
+
+	return (refcount);
+}
+
+static int
+verify_spacemap_refcounts(spa_t *spa)
+{
+	int expected_refcount, actual_refcount;
+
+	expected_refcount = spa_feature_get_refcount(spa,
+	    &spa_feature_table[SPA_FEATURE_SPACEMAP_HISTOGRAM]);
+	actual_refcount = get_dtl_refcount(spa->spa_root_vdev);
+	actual_refcount += get_metaslab_refcount(spa->spa_root_vdev);
+
+	if (expected_refcount != actual_refcount) {
+		(void) printf("space map refcount mismatch: expected %d != "
+		    "actual %d\n", expected_refcount, actual_refcount);
+		return (2);
+	}
+	return (0);
+}
+
 static void
-dump_spacemap(objset_t *os, space_map_obj_t *smo, space_map_t *sm)
+dump_spacemap(objset_t *os, space_map_t *sm)
 {
 	uint64_t alloc, offset, entry;
-	uint8_t mapshift = sm->sm_shift;
-	uint64_t mapstart = sm->sm_start;
 	char *ddata[] = { "ALLOC", "FREE", "CONDENSE", "INVALID",
 			    "INVALID", "INVALID", "INVALID", "INVALID" };
 
-	if (smo->smo_object == 0)
+	if (sm == NULL)
 		return;
 
 	/*
 	 * Print out the freelist entries in both encoded and decoded form.
 	 */
 	alloc = 0;
-	for (offset = 0; offset < smo->smo_objsize; offset += sizeof (entry)) {
-		VERIFY3U(0, ==, dmu_read(os, smo->smo_object, offset,
+	for (offset = 0; offset < space_map_length(sm);
+	    offset += sizeof (entry)) {
+		uint8_t mapshift = sm->sm_shift;
+
+		VERIFY0(dmu_read(os, space_map_object(sm), offset,
 		    sizeof (entry), &entry, DMU_READ_PREFETCH));
 		if (SM_DEBUG_DECODE(entry)) {
+
 			(void) printf("\t    [%6llu] %s: txg %llu, pass %llu\n",
 			    (u_longlong_t)(offset / sizeof (entry)),
 			    ddata[SM_DEBUG_ACTION_DECODE(entry)],
@@ -548,10 +607,10 @@ dump_spacemap(objset_t *os, space_map_ob
 			    (u_longlong_t)(offset / sizeof (entry)),
 			    SM_TYPE_DECODE(entry) == SM_ALLOC ? 'A' : 'F',
 			    (u_longlong_t)((SM_OFFSET_DECODE(entry) <<
-			    mapshift) + mapstart),
+			    mapshift) + sm->sm_start),
 			    (u_longlong_t)((SM_OFFSET_DECODE(entry) <<
-			    mapshift) + mapstart + (SM_RUN_DECODE(entry) <<
-			    mapshift)),
+			    mapshift) + sm->sm_start +
+			    (SM_RUN_DECODE(entry) << mapshift)),
 			    (u_longlong_t)(SM_RUN_DECODE(entry) << mapshift));
 			if (SM_TYPE_DECODE(entry) == SM_ALLOC)
 				alloc += SM_RUN_DECODE(entry) << mapshift;
@@ -559,10 +618,10 @@ dump_spacemap(objset_t *os, space_map_ob
 				alloc -= SM_RUN_DECODE(entry) << mapshift;
 		}
 	}
-	if (alloc != smo->smo_alloc) {
+	if (alloc != space_map_allocated(sm)) {
 		(void) printf("space_map_object alloc (%llu) INCONSISTENT "
 		    "with space map summary (%llu)\n",
-		    (u_longlong_t)smo->smo_alloc, (u_longlong_t)alloc);
+		    (u_longlong_t)space_map_allocated(sm), (u_longlong_t)alloc);
 	}
 }
 
@@ -570,15 +629,17 @@ static void
 dump_metaslab_stats(metaslab_t *msp)
 {
 	char maxbuf[32];
-	space_map_t *sm = msp->ms_map;
-	avl_tree_t *t = sm->sm_pp_root;
-	int free_pct = sm->sm_space * 100 / sm->sm_size;
+	range_tree_t *rt = msp->ms_tree;
+	avl_tree_t *t = &msp->ms_size_tree;
+	int free_pct = range_tree_space(rt) * 100 / msp->ms_size;
 
-	zdb_nicenum(space_map_maxsize(sm), maxbuf);
+	zdb_nicenum(metaslab_block_maxsize(msp), maxbuf);
 
 	(void) printf("\t %25s %10lu   %7s  %6s   %4s %4d%%\n",
 	    "segments", avl_numnodes(t), "maxsize", maxbuf,
 	    "freepct", free_pct);
+	(void) printf("\tIn-memory histogram:\n");
+	dump_histogram(rt->rt_histogram, RANGE_TREE_HISTOGRAM_SIZE, 0);
 }
 
 static void
@@ -586,33 +647,45 @@ dump_metaslab(metaslab_t *msp)
 {
 	vdev_t *vd = msp->ms_group->mg_vd;
 	spa_t *spa = vd->vdev_spa;
-	space_map_t *sm = msp->ms_map;
-	space_map_obj_t *smo = &msp->ms_smo;
+	space_map_t *sm = msp->ms_sm;
 	char freebuf[32];
 
-	zdb_nicenum(sm->sm_size - smo->smo_alloc, freebuf);
+	zdb_nicenum(msp->ms_size - space_map_allocated(sm), freebuf);
 
 	(void) printf(
 	    "\tmetaslab %6llu   offset %12llx   spacemap %6llu   free    %5s\n",
-	    (u_longlong_t)(sm->sm_start / sm->sm_size),
-	    (u_longlong_t)sm->sm_start, (u_longlong_t)smo->smo_object, freebuf);
+	    (u_longlong_t)msp->ms_id, (u_longlong_t)msp->ms_start,
+	    (u_longlong_t)space_map_object(sm), freebuf);
 
-	if (dump_opt['m'] > 1 && !dump_opt['L']) {
+	if (dump_opt['m'] > 2 && !dump_opt['L']) {
 		mutex_enter(&msp->ms_lock);
-		space_map_load_wait(sm);
-		if (!sm->sm_loaded)
-			VERIFY(space_map_load(sm, zfs_metaslab_ops,
-			    SM_FREE, smo, spa->spa_meta_objset) == 0);
+		metaslab_load_wait(msp);
+		if (!msp->ms_loaded) {
+			VERIFY0(metaslab_load(msp));
+			range_tree_stat_verify(msp->ms_tree);
+		}
 		dump_metaslab_stats(msp);
-		space_map_unload(sm);
+		metaslab_unload(msp);
 		mutex_exit(&msp->ms_lock);
 	}
 
-	if (dump_opt['d'] > 5 || dump_opt['m'] > 2) {
-		ASSERT(sm->sm_size == (1ULL << vd->vdev_ms_shift));
+	if (dump_opt['m'] > 1 && sm != NULL &&
+	    spa_feature_is_active(spa,
+	    &spa_feature_table[SPA_FEATURE_SPACEMAP_HISTOGRAM])) {
+		/*
+		 * The space map histogram represents free space in chunks
+		 * of sm_shift (i.e. bucket 0 refers to 2^sm_shift).
+		 */
+		(void) printf("\tOn-disk histogram:\n");
+		dump_histogram(sm->sm_phys->smp_histogram,
+		    SPACE_MAP_HISTOGRAM_SIZE(sm), sm->sm_shift);
+	}
+
+	if (dump_opt['d'] > 5 || dump_opt['m'] > 3) {
+		ASSERT(msp->ms_size == (1ULL << vd->vdev_ms_shift));
 
 		mutex_enter(&msp->ms_lock);
-		dump_spacemap(spa->spa_meta_objset, smo, sm);
+		dump_spacemap(spa->spa_meta_objset, msp->ms_sm);
 		mutex_exit(&msp->ms_lock);
 	}
 }
@@ -801,9 +874,9 @@ dump_all_ddts(spa_t *spa)
 }
 
 static void
-dump_dtl_seg(space_map_t *sm, uint64_t start, uint64_t size)
+dump_dtl_seg(void *arg, uint64_t start, uint64_t size)
 {
-	char *prefix = (void *)sm;
+	char *prefix = arg;
 
 	(void) printf("%s [%llu,%llu) length %llu\n",
 	    prefix,
@@ -833,17 +906,16 @@ dump_dtl(vdev_t *vd, int indent)
 	    required ? "DTL-required" : "DTL-expendable");
 
 	for (int t = 0; t < DTL_TYPES; t++) {
-		space_map_t *sm = &vd->vdev_dtl[t];
-		if (sm->sm_space == 0)
+		range_tree_t *rt = vd->vdev_dtl[t];
+		if (range_tree_space(rt) == 0)
 			continue;
 		(void) snprintf(prefix, sizeof (prefix), "\t%*s%s",
 		    indent + 2, "", name[t]);
-		mutex_enter(sm->sm_lock);
-		space_map_walk(sm, dump_dtl_seg, (void *)prefix);
-		mutex_exit(sm->sm_lock);
+		mutex_enter(rt->rt_lock);
+		range_tree_walk(rt, dump_dtl_seg, prefix);
+		mutex_exit(rt->rt_lock);
 		if (dump_opt['d'] > 5 && vd->vdev_children == 0)
-			dump_spacemap(spa->spa_meta_objset,
-			    &vd->vdev_dtl_smo, sm);
+			dump_spacemap(spa->spa_meta_objset, vd->vdev_dtl_sm);
 	}
 
 	for (int c = 0; c < vd->vdev_children; c++)
@@ -2172,39 +2244,17 @@ zdb_blkptr_cb(spa_t *spa, zilog_t *zilog
 }
 
 static void
-zdb_leak(space_map_t *sm, uint64_t start, uint64_t size)
+zdb_leak(void *arg, uint64_t start, uint64_t size)
 {
-	vdev_t *vd = sm->sm_ppd;
+	vdev_t *vd = arg;
 
 	(void) printf("leaked space: vdev %llu, offset 0x%llx, size %llu\n",
 	    (u_longlong_t)vd->vdev_id, (u_longlong_t)start, (u_longlong_t)size);
 }
 
-/* ARGSUSED */
-static void
-zdb_space_map_load(space_map_t *sm)
-{
-}
-
-static void
-zdb_space_map_unload(space_map_t *sm)
-{
-	space_map_vacate(sm, zdb_leak, sm);
-}
-
-/* ARGSUSED */
-static void
-zdb_space_map_claim(space_map_t *sm, uint64_t start, uint64_t size)
-{
-}
-
-static space_map_ops_t zdb_space_map_ops = {
-	zdb_space_map_load,
-	zdb_space_map_unload,
+static metaslab_ops_t zdb_metaslab_ops = {
 	NULL,	/* alloc */
-	zdb_space_map_claim,
-	NULL,	/* free */
-	NULL	/* maxsize */
+	NULL	/* fragmented */
 };
 
 static void
@@ -2259,11 +2309,21 @@ zdb_leak_init(spa_t *spa, zdb_cb_t *zcb)
 			for (int m = 0; m < vd->vdev_ms_count; m++) {
 				metaslab_t *msp = vd->vdev_ms[m];
 				mutex_enter(&msp->ms_lock);
-				space_map_unload(msp->ms_map);
-				VERIFY(space_map_load(msp->ms_map,
-				    &zdb_space_map_ops, SM_ALLOC, &msp->ms_smo,
-				    spa->spa_meta_objset) == 0);
-				msp->ms_map->sm_ppd = vd;
+				metaslab_unload(msp);
+
+				/*
+				 * For leak detection, we overload the metaslab
+				 * ms_tree to contain allocated segments
+				 * instead of free segments. As a result,
+				 * we can't use the normal metaslab_load/unload
+				 * interfaces.
+				 */
+				if (msp->ms_sm != NULL) {
+					msp->ms_ops = &zdb_metaslab_ops;
+					VERIFY0(space_map_load(msp->ms_sm,
+					    msp->ms_tree, SM_ALLOC));
+					msp->ms_loaded = B_TRUE;
+				}
 				mutex_exit(&msp->ms_lock);
 			}
 		}
@@ -2286,7 +2346,20 @@ zdb_leak_fini(spa_t *spa)
 			for (int m = 0; m < vd->vdev_ms_count; m++) {
 				metaslab_t *msp = vd->vdev_ms[m];
 				mutex_enter(&msp->ms_lock);
-				space_map_unload(msp->ms_map);
+
+				/*
+				 * The ms_tree has been overloaded to
+				 * contain allocated segments. Now that we
+				 * finished traversing all blocks, any
+				 * block that remains in the ms_tree
+				 * represents an allocated block that we
+				 * did not claim during the traversal.
+				 * Claimed blocks would have been removed
+				 * from the ms_tree.
+				 */
+				range_tree_vacate(msp->ms_tree, zdb_leak, vd);
+				msp->ms_loaded = B_FALSE;
+
 				mutex_exit(&msp->ms_lock);
 			}
 		}
@@ -2489,7 +2562,7 @@ dump_block_stats(spa_t *spa)
 					    "(in 512-byte sectors): "
 					    "number of blocks\n");
 					dump_histogram(zb->zb_psize_histogram,
-					    PSIZE_HISTO_SIZE);
+					    PSIZE_HISTO_SIZE, 0);
 				}
 			}
 		}
@@ -2659,6 +2732,9 @@ dump_zpool(spa_t *spa)
 	if (dump_opt['b'] || dump_opt['c'])
 		rc = dump_block_stats(spa);
 
+	if (rc == 0)
+		rc = verify_spacemap_refcounts(spa);
+
 	if (dump_opt['s'])
 		show_pool_stats(spa);
 

Modified: projects/sendfile/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7
==============================================================================
--- projects/sendfile/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7	Sat Nov 30 07:04:35 2013	(r258763)
+++ projects/sendfile/cddl/contrib/opensolaris/cmd/zpool/zpool-features.7	Sat Nov 30 08:49:52 2013	(r258764)
@@ -23,7 +23,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd September 20, 2013
+.Dd October 08, 2013
 .Dt ZPOOL-FEATURES 7
 .Os
 .Sh NAME
@@ -251,6 +251,24 @@ configuration.
 .\" .Xr dumpon 8
 .\" command to configure a
 .\" dump device on a pool comprised of multiple vdevs.
+.It Sy spacemap_histogram
+.Bl -column "READ\-ONLY COMPATIBLE" "com.delphix:spacemap_histogram"
+.It GUID Ta com.delphix:spacemap_histogram
+.It READ\-ONLY COMPATIBLE Ta yes
+.It DEPENDENCIES Ta none
+.El
+.Pp
+This features allows ZFS to maintain more information about how free space
+is organized within the pool. If this feature is 
+.Sy enabled ,
+ZFS will
+set this feature to
+.Sy active
+when a new space map object is created or
+an existing space map is upgraded to the new format.
+Once the feature is
+.Sy active ,
+it will remain in that state until the pool is destroyed.
 .El
 .Sh SEE ALSO
 .Xr zpool 8

Modified: projects/sendfile/cddl/contrib/opensolaris/cmd/ztest/ztest.c
==============================================================================
--- projects/sendfile/cddl/contrib/opensolaris/cmd/ztest/ztest.c	Sat Nov 30 07:04:35 2013	(r258763)
+++ projects/sendfile/cddl/contrib/opensolaris/cmd/ztest/ztest.c	Sat Nov 30 08:49:52 2013	(r258764)
@@ -5339,7 +5339,7 @@ ztest_deadman_thread(void *arg)
 		 * vdev_deadman() discovers that there hasn't been any recent
 		 * I/Os then it will end up aborting the tests.
 		 */
-		if (spa_suspended(spa)) {
+		if (spa_suspended(spa) || spa->spa_root_vdev == NULL) {
 			fatal(0, "aborting test after %llu seconds because "
 			    "pool has transitioned to a suspended state.",
 			    zfs_deadman_synctime_ms / 1000);

Modified: projects/sendfile/contrib/gcc/ChangeLog.gcc43
==============================================================================
--- projects/sendfile/contrib/gcc/ChangeLog.gcc43	Sat Nov 30 07:04:35 2013	(r258763)
+++ projects/sendfile/contrib/gcc/ChangeLog.gcc43	Sat Nov 30 08:49:52 2013	(r258764)
@@ -4,6 +4,47 @@
 	* config/arm/unwind-arm.h (__gnu_Unwind_Backtrace): New.
 	* config/arm/unwind-arm.c (__gnu_Unwind_Backtrace): New.
 
+2007-07-12  Geoffrey Keating  <geoffk@apple.com> (r126588)
+
+	* builtins.c (get_pointer_alignment): Honor DECL_ALIGN on a
+	FUNCTION_DECL.
+	* tree.c (build_decl_stat): Move code from here...
+	(make_node_stat): ... to here.  Don't uselessly clear DECL_USER_ALIGN.
+	(expr_align): Honor DECL_ALIGN on a FUNCTION_DECL.  Add comment
+	about using DECL_ALIGN of LABEL_DECL and CONST_DECL.
+	* tree.h (DECL_USER_ALIGN): Fix misplaced comment.
+	* varasm.c (assemble_start_function): Use DECL_ALIGN instead of
+	FUNCTION_BOUNDARY.
+
+2007-07-09  Geoffrey Keating  <geoffk@apple.com> (r126529)
+
+	PR 32617
+	* c-common.c (c_alignof_expr): Look at DECL_ALIGN of
+	FUNCTION_DECLs.
+	(handle_aligned_attribute): Allow use on FUNCTION_DECLs.
+	* varasm.c (assemble_start_function): Honor DECL_ALIGN
+	for FUNCTION_DECLs.  Don't use align_functions_log if
+	DECL_USER_ALIGN.
+	* print-tree.c (print_node): Print DECL_ALIGN and DECL_USER_ALIGN
+	even for FUNCTION_DECLs.
+	* c-decl.c (merge_decls): Propagate DECL_ALIGN even for
+	FUNCTION_DECLs.
+	* tree.h (DECL_ALIGN): Update for new location of 'align'.
+	(DECL_FUNCTION_CODE): Update for new location and name of
+	'function_code'.
+	(DECL_OFFSET_ALIGN): Update for new location of 'off_align'.
+	(struct tree_decl_common): Move 'align' and 'off_align' out
+	of union, ensure they're still on a 32-bit boundary.  Remove
+	other fields in union 'u1'.
+	(struct tree_function_decl): Add field 'function_code' replacing
+	'u1.f' in tree_decl_common.
+	* tree.c (build_decl_stat): Set initial value of DECL_ALIGN.
+	* doc/extend.texi (Function Attributes): Add 'aligned' attribute.
+	(Variable Attributes): Cross-reference 'aligned' attribute
+	to Function Attributes.
+	* flags.h (force_align_functions_log): Delete.
+	* toplev.c (force_align_functions_log): Delete.
+
 2007-06-05  Joerg Wunsch  <j.gnu@uriah.heep.sax.de> (r125346)
 
 	PR preprocessor/23479
@@ -31,6 +72,12 @@
 	regs_invalidated_by_call, rather than just checking the
 	membership of REGNO (REG).
 
+2007-05-16  Eric Christopher  <echristo@apple.com> (r124763)
+
+       * config/rs6000/rs6000.c (rs6000_emit_prologue): Move altivec register
+        saving after stack push. Set sp_offset whenever we push.
+        (rs6000_emit_epilogue): Move altivec register restore before stack push.
+
 2007-05-03  Ian Lance Taylor  <iant@google.com> (r124381)
 
 	* config/rs6000/rs6000.c (rs6000_override_options): Don't set
@@ -54,7 +101,7 @@
 	alignment for amdfam10 architecture. Increasing the max loop
 	alignment to 24 bytes.
 
-2007-04-16  Lawrence Crowl  <crowl@google.com>
+2007-04-16  Lawrence Crowl  <crowl@google.com> (r123909)
 
 	* doc/invoke.texi (Debugging Options): Add documentation for the
 	-femit-struct-debug options -femit-struct-debug-baseonly,
@@ -133,7 +180,7 @@
 	* config/i386/i386.c (override_options): Likewise.
 	* doc/invoke.texi: Likewise.
 
-2007-03-12  Seongbae Park <seongbae.park@gmail.com>
+2007-03-12  Seongbae Park <seongbae.park@gmail.com> (r122851)
 
 	* c-decl.c (warn_variable_length_array): New function.
 	Refactored from grokdeclarator to handle warn_vla
@@ -334,6 +381,16 @@
 
 	* config.gcc: Support core2 processor.
 
+2007-01-05  Manuel Lopez-Ibanez  <manu@gcc.gnu.org> (r120505)
+
+	PR c/19978
+	* tree.h (TREE_OVERFLOW_P): New.
+	* c-typeck.c (parser_build_unary_op): Warn only if result
+	overflowed and operands did not.
+	(parser_build_binary_op): Likewise.
+	(convert_for_assignment): Remove redundant overflow_warning.
+	* c-common.c (overflow_warning): Don't check or set TREE_OVERFLOW.
+
 2006-12-13  Ian Lance Taylor  <iant@google.com> (r119855)
 
 	PR c++/19564

Modified: projects/sendfile/contrib/gcc/builtins.c
==============================================================================
--- projects/sendfile/contrib/gcc/builtins.c	Sat Nov 30 07:04:35 2013	(r258763)
+++ projects/sendfile/contrib/gcc/builtins.c	Sat Nov 30 08:49:52 2013	(r258764)
@@ -315,9 +315,7 @@ get_pointer_alignment (tree exp, unsigne
 	      else if (offset)
 		inner = MIN (inner, BITS_PER_UNIT);
 	    }
-	  if (TREE_CODE (exp) == FUNCTION_DECL)
-	    align = FUNCTION_BOUNDARY;
-	  else if (DECL_P (exp))
+	  if (DECL_P (exp))
 	    align = MIN (inner, DECL_ALIGN (exp));
 #ifdef CONSTANT_ALIGNMENT
 	  else if (CONSTANT_CLASS_P (exp))

Modified: projects/sendfile/contrib/gcc/c-common.c
==============================================================================
--- projects/sendfile/contrib/gcc/c-common.c	Sat Nov 30 07:04:35 2013	(r258763)
+++ projects/sendfile/contrib/gcc/c-common.c	Sat Nov 30 08:49:52 2013	(r258764)
@@ -916,39 +916,45 @@ constant_expression_warning (tree value)
     pedwarn ("overflow in constant expression");
 }
 
-/* Print a warning if an expression had overflow in folding.
+/* Print a warning if an expression had overflow in folding and its
+   operands hadn't.
+
    Invoke this function on every expression that
    (1) appears in the source code, and
-   (2) might be a constant expression that overflowed, and
+   (2) is a constant expression that overflowed, and
    (3) is not already checked by convert_and_check;
-   however, do not invoke this function on operands of explicit casts.  */
+   however, do not invoke this function on operands of explicit casts
+   or when the expression is the result of an operator and any operand
+   already overflowed.  */
 
 void
 overflow_warning (tree value)
 {
-  if ((TREE_CODE (value) == INTEGER_CST
-       || (TREE_CODE (value) == COMPLEX_CST
-	   && TREE_CODE (TREE_REALPART (value)) == INTEGER_CST))
-      && TREE_OVERFLOW (value))
-    {
-      TREE_OVERFLOW (value) = 0;
-      if (skip_evaluation == 0)
-	warning (OPT_Woverflow, "integer overflow in expression");
-    }
-  else if ((TREE_CODE (value) == REAL_CST
-	    || (TREE_CODE (value) == COMPLEX_CST
-		&& TREE_CODE (TREE_REALPART (value)) == REAL_CST))
-	   && TREE_OVERFLOW (value))
-    {
-      TREE_OVERFLOW (value) = 0;
-      if (skip_evaluation == 0)
-	warning (OPT_Woverflow, "floating point overflow in expression");
-    }
-  else if (TREE_CODE (value) == VECTOR_CST && TREE_OVERFLOW (value))
-    {
-      TREE_OVERFLOW (value) = 0;
-      if (skip_evaluation == 0)
-	warning (OPT_Woverflow, "vector overflow in expression");
+  if (skip_evaluation) return;
+
+  switch (TREE_CODE (value))
+    {
+    case INTEGER_CST:
+      warning (OPT_Woverflow, "integer overflow in expression");
+      break;
+      
+    case REAL_CST:
+      warning (OPT_Woverflow, "floating point overflow in expression");
+      break;
+      
+    case VECTOR_CST:
+      warning (OPT_Woverflow, "vector overflow in expression");
+      break;
+      
+    case COMPLEX_CST:
+      if (TREE_CODE (TREE_REALPART (value)) == INTEGER_CST)
+	warning (OPT_Woverflow, "complex integer overflow in expression");
+      else if (TREE_CODE (TREE_REALPART (value)) == REAL_CST)
+	warning (OPT_Woverflow, "complex floating point overflow in expression");
+      break;
+
+    default:
+      break;
     }
 }
 
@@ -2989,16 +2995,16 @@ c_sizeof_or_alignof_type (tree type, boo
 }
 
 /* Implement the __alignof keyword: Return the minimum required
-   alignment of EXPR, measured in bytes.  For VAR_DECL's and
-   FIELD_DECL's return DECL_ALIGN (which can be set from an
-   "aligned" __attribute__ specification).  */
+   alignment of EXPR, measured in bytes.  For VAR_DECLs,
+   FUNCTION_DECLs and FIELD_DECLs return DECL_ALIGN (which can be set
+   from an "aligned" __attribute__ specification).  */
 
 tree
 c_alignof_expr (tree expr)
 {
   tree t;
 
-  if (TREE_CODE (expr) == VAR_DECL)
+  if (VAR_OR_FUNCTION_DECL_P (expr))
     t = size_int (DECL_ALIGN_UNIT (expr));
 
   else if (TREE_CODE (expr) == COMPONENT_REF
@@ -4803,12 +4809,24 @@ handle_aligned_attribute (tree *node, tr
       TYPE_ALIGN (*type) = (1 << i) * BITS_PER_UNIT;
       TYPE_USER_ALIGN (*type) = 1;
     }
-  else if (TREE_CODE (decl) != VAR_DECL
+  else if (! VAR_OR_FUNCTION_DECL_P (decl)
 	   && TREE_CODE (decl) != FIELD_DECL)
     {
       error ("alignment may not be specified for %q+D", decl);
       *no_add_attrs = true;
     }
+  else if (TREE_CODE (decl) == FUNCTION_DECL
+	   && DECL_ALIGN (decl) > (1 << i) * BITS_PER_UNIT)
+    {
+      if (DECL_USER_ALIGN (decl))
+	error ("alignment for %q+D was previously specified as %d "
+	       "and may not be decreased", decl,
+	       DECL_ALIGN (decl) / BITS_PER_UNIT);
+      else
+	error ("alignment for %q+D must be at least %d", decl,
+	       DECL_ALIGN (decl) / BITS_PER_UNIT);
+      *no_add_attrs = true;
+    }
   else
     {
       DECL_ALIGN (decl) = (1 << i) * BITS_PER_UNIT;

Modified: projects/sendfile/contrib/gcc/c-decl.c
==============================================================================
--- projects/sendfile/contrib/gcc/c-decl.c	Sat Nov 30 07:04:35 2013	(r258763)
+++ projects/sendfile/contrib/gcc/c-decl.c	Sat Nov 30 08:49:52 2013	(r258764)
@@ -1690,12 +1690,11 @@ merge_decls (tree newdecl, tree olddecl,
       DECL_SIZE (newdecl) = DECL_SIZE (olddecl);
       DECL_SIZE_UNIT (newdecl) = DECL_SIZE_UNIT (olddecl);
       DECL_MODE (newdecl) = DECL_MODE (olddecl);
-      if (TREE_CODE (olddecl) != FUNCTION_DECL)
-	if (DECL_ALIGN (olddecl) > DECL_ALIGN (newdecl))
-	  {
-	    DECL_ALIGN (newdecl) = DECL_ALIGN (olddecl);
-	    DECL_USER_ALIGN (newdecl) |= DECL_ALIGN (olddecl);
-	  }
+      if (DECL_ALIGN (olddecl) > DECL_ALIGN (newdecl))
+	{
+	  DECL_ALIGN (newdecl) = DECL_ALIGN (olddecl);
+	  DECL_USER_ALIGN (newdecl) |= DECL_ALIGN (olddecl);
+	}
     }
 
 

Modified: projects/sendfile/contrib/gcc/c-typeck.c
==============================================================================
--- projects/sendfile/contrib/gcc/c-typeck.c	Sat Nov 30 07:04:35 2013	(r258763)
+++ projects/sendfile/contrib/gcc/c-typeck.c	Sat Nov 30 08:49:52 2013	(r258764)
@@ -2616,7 +2616,10 @@ parser_build_unary_op (enum tree_code co
 
   result.original_code = ERROR_MARK;
   result.value = build_unary_op (code, arg.value, 0);
-  overflow_warning (result.value);
+  
+  if (TREE_OVERFLOW_P (result.value) && !TREE_OVERFLOW_P (arg.value))
+    overflow_warning (result.value);
+
   return result;
 }
 
@@ -2660,7 +2663,10 @@ parser_build_binary_op (enum tree_code c
     warning (OPT_Waddress, 
              "comparison with string literal results in unspecified behaviour");
 
-  overflow_warning (result.value);
+  if (TREE_OVERFLOW_P (result.value) 
+      && !TREE_OVERFLOW_P (arg1.value) 
+      && !TREE_OVERFLOW_P (arg2.value))
+    overflow_warning (result.value);
 
   return result;
 }
@@ -3847,10 +3853,7 @@ convert_for_assignment (tree type, tree 
     }
 
   if (TYPE_MAIN_VARIANT (type) == TYPE_MAIN_VARIANT (rhstype))
-    {
-      overflow_warning (rhs);
-      return rhs;
-    }
+    return rhs;
 
   if (coder == VOID_TYPE)
     {

Modified: projects/sendfile/contrib/gcc/config/rs6000/rs6000.c
==============================================================================
--- projects/sendfile/contrib/gcc/config/rs6000/rs6000.c	Sat Nov 30 07:04:35 2013	(r258763)
+++ projects/sendfile/contrib/gcc/config/rs6000/rs6000.c	Sat Nov 30 08:49:52 2013	(r258764)
@@ -14466,77 +14466,6 @@ rs6000_emit_prologue (void)
       sp_offset = info->total_size;
     }
 
-  /* Save AltiVec registers if needed.  */
-  if (!WORLD_SAVE_P (info) && TARGET_ALTIVEC_ABI && info->altivec_size != 0)
-    {
-      int i;
-
-      /* There should be a non inline version of this, for when we
-	 are saving lots of vector registers.  */
-      for (i = info->first_altivec_reg_save; i <= LAST_ALTIVEC_REGNO; ++i)
-	if (info->vrsave_mask & ALTIVEC_REG_BIT (i))
-	  {
-	    rtx areg, savereg, mem;
-	    int offset;
-
-	    offset = info->altivec_save_offset + sp_offset
-	      + 16 * (i - info->first_altivec_reg_save);
-
-	    savereg = gen_rtx_REG (V4SImode, i);
-
-	    areg = gen_rtx_REG (Pmode, 0);
-	    emit_move_insn (areg, GEN_INT (offset));
-
-	    /* AltiVec addressing mode is [reg+reg].  */
-	    mem = gen_frame_mem (V4SImode,
-				 gen_rtx_PLUS (Pmode, frame_reg_rtx, areg));
-
-	    insn = emit_move_insn (mem, savereg);
-
-	    rs6000_frame_related (insn, frame_ptr_rtx, info->total_size,
-				  areg, GEN_INT (offset));
-	  }
-    }
-
-  /* VRSAVE is a bit vector representing which AltiVec registers
-     are used.  The OS uses this to determine which vector
-     registers to save on a context switch.  We need to save
-     VRSAVE on the stack frame, add whatever AltiVec registers we
-     used in this function, and do the corresponding magic in the
-     epilogue.  */
-
-  if (TARGET_ALTIVEC && TARGET_ALTIVEC_VRSAVE
-      && info->vrsave_mask != 0)
-    {
-      rtx reg, mem, vrsave;
-      int offset;
-
-      /* Get VRSAVE onto a GPR.  Note that ABI_V4 might be using r12
-	 as frame_reg_rtx and r11 as the static chain pointer for
-	 nested functions.  */
-      reg = gen_rtx_REG (SImode, 0);
-      vrsave = gen_rtx_REG (SImode, VRSAVE_REGNO);
-      if (TARGET_MACHO)
-	emit_insn (gen_get_vrsave_internal (reg));
-      else
-	emit_insn (gen_rtx_SET (VOIDmode, reg, vrsave));
-
-      if (!WORLD_SAVE_P (info))
-	{
-          /* Save VRSAVE.  */
-          offset = info->vrsave_save_offset + sp_offset;
-          mem = gen_frame_mem (SImode,
-			       gen_rtx_PLUS (Pmode, frame_reg_rtx,
-					     GEN_INT (offset)));
-          insn = emit_move_insn (mem, reg);
-	}
-
-      /* Include the registers in the mask.  */
-      emit_insn (gen_iorsi3 (reg, reg, GEN_INT ((int) info->vrsave_mask)));
-
-      insn = emit_insn (generate_set_vrsave (reg, info, 0));
-    }
-
   /* If we use the link register, get it into r0.  */
   if (!WORLD_SAVE_P (info) && info->lr_save_p)
     {
@@ -14774,7 +14703,10 @@ rs6000_emit_prologue (void)
      for which it was done previously.  */
   if (!WORLD_SAVE_P (info) && info->push_p
       && !(DEFAULT_ABI == ABI_V4 || current_function_calls_eh_return))
-    rs6000_emit_allocate_stack (info->total_size, FALSE);
+    {
+      rs6000_emit_allocate_stack (info->total_size, FALSE);
+      sp_offset = info->total_size;
+    }
 
   /* Set frame pointer, if needed.  */
   if (frame_pointer_needed)
@@ -14784,6 +14716,78 @@ rs6000_emit_prologue (void)
       RTX_FRAME_RELATED_P (insn) = 1;
     }
 
+  /* Save AltiVec registers if needed.  Save here because the red zone does
+     not include AltiVec registers.  */
+  if (!WORLD_SAVE_P (info) && TARGET_ALTIVEC_ABI && info->altivec_size != 0)
+    {
+      int i;
+
+      /* There should be a non inline version of this, for when we
+         are saving lots of vector registers.  */
+      for (i = info->first_altivec_reg_save; i <= LAST_ALTIVEC_REGNO; ++i)
+        if (info->vrsave_mask & ALTIVEC_REG_BIT (i))
+          {
+            rtx areg, savereg, mem;
+            int offset;
+
+            offset = info->altivec_save_offset + sp_offset
+              + 16 * (i - info->first_altivec_reg_save);
+
+            savereg = gen_rtx_REG (V4SImode, i);
+
+            areg = gen_rtx_REG (Pmode, 0);
+            emit_move_insn (areg, GEN_INT (offset));
+
+            /* AltiVec addressing mode is [reg+reg].  */
+            mem = gen_frame_mem (V4SImode,
+                                 gen_rtx_PLUS (Pmode, frame_reg_rtx, areg));
+
+            insn = emit_move_insn (mem, savereg);
+
+            rs6000_frame_related (insn, frame_ptr_rtx, info->total_size,
+                                  areg, GEN_INT (offset));
+          }
+    }
+
+  /* VRSAVE is a bit vector representing which AltiVec registers
+     are used.  The OS uses this to determine which vector
+     registers to save on a context switch.  We need to save
+     VRSAVE on the stack frame, add whatever AltiVec registers we
+     used in this function, and do the corresponding magic in the
+     epilogue.  */
+
+  if (TARGET_ALTIVEC && TARGET_ALTIVEC_VRSAVE
+      && info->vrsave_mask != 0)
+    {
+      rtx reg, mem, vrsave;
+      int offset;
+
+      /* Get VRSAVE onto a GPR.  Note that ABI_V4 might be using r12
+         as frame_reg_rtx and r11 as the static chain pointer for
+         nested functions.  */
+      reg = gen_rtx_REG (SImode, 0);
+      vrsave = gen_rtx_REG (SImode, VRSAVE_REGNO);
+      if (TARGET_MACHO)
+        emit_insn (gen_get_vrsave_internal (reg));
+      else
+        emit_insn (gen_rtx_SET (VOIDmode, reg, vrsave));
+
+      if (!WORLD_SAVE_P (info))
+        {
+          /* Save VRSAVE.  */
+          offset = info->vrsave_save_offset + sp_offset;
+          mem = gen_frame_mem (SImode,
+                               gen_rtx_PLUS (Pmode, frame_reg_rtx,
+                                             GEN_INT (offset)));
+          insn = emit_move_insn (mem, reg);
+        }
+
+      /* Include the registers in the mask.  */
+      emit_insn (gen_iorsi3 (reg, reg, GEN_INT ((int) info->vrsave_mask)));
+
+      insn = emit_insn (generate_set_vrsave (reg, info, 0));
+    }
+
   /* If we are using RS6000_PIC_OFFSET_TABLE_REGNUM, we need to set it up.  */
   if ((TARGET_TOC && TARGET_MINIMAL_TOC && get_pool_size () != 0)
       || (DEFAULT_ABI == ABI_V4
@@ -15041,33 +15045,10 @@ rs6000_emit_epilogue (int sibcall)
       return;
     }
 
-  /* If we have a frame pointer, a call to alloca,  or a large stack
-     frame, restore the old stack pointer using the backchain.  Otherwise,
-     we know what size to update it with.  */
-  if (use_backchain_to_restore_sp)
-    {
-      /* Under V.4, don't reset the stack pointer until after we're done
-	 loading the saved registers.  */
-      if (DEFAULT_ABI == ABI_V4)
-	frame_reg_rtx = gen_rtx_REG (Pmode, 11);
-
-      emit_move_insn (frame_reg_rtx,
-		      gen_rtx_MEM (Pmode, sp_reg_rtx));
-    }
-  else if (info->push_p)
-    {
-      if (DEFAULT_ABI == ABI_V4
-	  || current_function_calls_eh_return)
-	sp_offset = info->total_size;
-      else
-	{
-	  emit_insn (TARGET_32BIT
-		     ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx,
-				   GEN_INT (info->total_size))
-		     : gen_adddi3 (sp_reg_rtx, sp_reg_rtx,
-				   GEN_INT (info->total_size)));
-	}
-    }
+  /* Set sp_offset based on the stack push from the prologue.  */
+  if ((DEFAULT_ABI == ABI_V4 || current_function_calls_eh_return)
+      && info->total_size < 32767)
+    sp_offset = info->total_size;
 
   /* Restore AltiVec registers if needed.  */
   if (TARGET_ALTIVEC_ABI && info->altivec_size != 0)
@@ -15108,6 +15089,36 @@ rs6000_emit_epilogue (int sibcall)
       emit_insn (generate_set_vrsave (reg, info, 1));
     }
 
+  sp_offset = 0;
+
+  /* If we have a frame pointer, a call to alloca,  or a large stack
+     frame, restore the old stack pointer using the backchain.  Otherwise,
+     we know what size to update it with.  */
+  if (use_backchain_to_restore_sp)
+    {
+      /* Under V.4, don't reset the stack pointer until after we're done
+	 loading the saved registers.  */
+      if (DEFAULT_ABI == ABI_V4)
+	frame_reg_rtx = gen_rtx_REG (Pmode, 11);
+
+      emit_move_insn (frame_reg_rtx,
+		      gen_rtx_MEM (Pmode, sp_reg_rtx));
+    }
+  else if (info->push_p)
+    {
+      if (DEFAULT_ABI == ABI_V4
+	  || current_function_calls_eh_return)
+	sp_offset = info->total_size;
+      else
+	{
+	  emit_insn (TARGET_32BIT
+		     ? gen_addsi3 (sp_reg_rtx, sp_reg_rtx,
+				   GEN_INT (info->total_size))
+		     : gen_adddi3 (sp_reg_rtx, sp_reg_rtx,
+				   GEN_INT (info->total_size)));
+	}
+    }
+
   /* Get the old lr if we saved it.  */
   if (info->lr_save_p)
     {

Modified: projects/sendfile/contrib/gcc/cp/ChangeLog.gcc43
==============================================================================
--- projects/sendfile/contrib/gcc/cp/ChangeLog.gcc43	Sat Nov 30 07:04:35 2013	(r258763)
+++ projects/sendfile/contrib/gcc/cp/ChangeLog.gcc43	Sat Nov 30 08:49:52 2013	(r258764)
@@ -1,3 +1,12 @@
+2007-07-09  Geoffrey Keating  <geoffk@apple.com>
+
+	PR 32617
+	* decl.c (cxx_init_decl_processing): Don't set

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201311300849.rAU8nrAZ057142>