summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMichael Cahill <michael.cahill@mongodb.com>2017-05-11 21:19:55 -0400
committerAlex Gorrod <alexander.gorrod@mongodb.com>2017-06-19 17:28:04 +0000
commitf8ecea1883dce17924599673c330356b676465c8 (patch)
tree70a8f7b230bffe61ca14de40b24f1ce5a30f4f88
parent5eb54ef9bd2654159c1d8302879a0bd0e85de551 (diff)
downloadmongo-f8ecea1883dce17924599673c330356b676465c8.tar.gz
WT-3158 Fix structure layout on Windows. (#3416)
We use a pragma on Windows to force a struct to be packed, but were missing the "end" pragma that restores normal layout. The result was that most structs were being packed, leading to poor performance for workloads (particularly when accessing session structures).
-rwxr-xr-xdist/s_style10
-rw-r--r--src/include/btmem.h2
2 files changed, 7 insertions, 5 deletions
diff --git a/dist/s_style b/dist/s_style
index 388a481ef56..54a88bbeb4c 100755
--- a/dist/s_style
+++ b/dist/s_style
@@ -101,10 +101,12 @@ else
cat $t
fi
- # Alignment directive before "struct".
- egrep 'WT_COMPILER_TYPE_ALIGN.*struct' $f > $t
- test -s $t && {
- echo "$f: compiler alignment direction must precede \"struct\""
+ # If we don't have matching pack-begin and pack-end calls, we don't get
+ # an error, we just get a Windows performance regression.
+ egrep WT_PACKED_STRUCT $f > $t
+ cnt=`wc -l < $t`
+ test `expr "$cnt" % 2` -ne 0 && {
+ echo "$f: mismatched WT_PACKED_STRUCT_BEGIN/END lines"
cat $t
}
diff --git a/src/include/btmem.h b/src/include/btmem.h
index eb523c01ad7..d0b21b17965 100644
--- a/src/include/btmem.h
+++ b/src/include/btmem.h
@@ -930,7 +930,7 @@ WT_PACKED_STRUCT_BEGIN(__wt_update)
#define WT_UPDATE_MEMSIZE(upd) \
WT_ALIGN(sizeof(WT_UPDATE) + \
(WT_UPDATE_DELETED_ISSET(upd) ? 0 : (upd)->size), 32)
-};
+WT_PACKED_STRUCT_END
/*
* WT_INSERT --