aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/vdbeInt.h4
-rw-r--r--src/vdbeapi.c2
-rw-r--r--src/vdbeaux.c20
3 files changed, 8 insertions, 18 deletions
diff --git a/src/vdbeInt.h b/src/vdbeInt.h
index dc284fb0b..657c6f8cf 100644
--- a/src/vdbeInt.h
+++ b/src/vdbeInt.h
@@ -199,10 +199,6 @@ struct VdbeFrame {
** Internally, the vdbe manipulates nearly all SQL values as Mem
** structures. Each Mem struct may cache multiple representations (string,
** integer etc.) of the same value.
-**
-** Code uses offsetof() on this object. Order of the fields is important.
-** Search for tag-20220228a to find all places that need to change when the
-** field order changes.
*/
struct sqlite3_value {
union MemValue {
diff --git a/src/vdbeapi.c b/src/vdbeapi.c
index 69f3d7b12..83f7b0fd6 100644
--- a/src/vdbeapi.c
+++ b/src/vdbeapi.c
@@ -1087,8 +1087,6 @@ int sqlite3_data_count(sqlite3_stmt *pStmt){
/*
** Return a pointer to static memory containing an SQL NULL value.
-**
-** Must be revised if column order for Mem changes. tag-20220228a.
*/
static const Mem *columnNullValue(void){
/* Even though the Mem structure contains an element
diff --git a/src/vdbeaux.c b/src/vdbeaux.c
index 0d91124c9..54332caa3 100644
--- a/src/vdbeaux.c
+++ b/src/vdbeaux.c
@@ -1839,28 +1839,24 @@ void sqlite3VdbePrintOp(FILE *pOut, int pc, VdbeOp *pOp){
/*
** Initialize an array of N Mem element.
**
-** This is a high-runner, so it is optimized by taking advantage of the
-** order of the fields in a Mem object and using memcpy() rather than
-** individually setting each field. For each Mem, we need to set:
+** This is a high-runner, so only those fields that really do need to
+** be initialized are set. The Mem structure is organized so that
+** the fields that get initialized are nearby and hopefully on the same
+** cache line.
**
** Mem.flags = flags
** Mem.db = db
** Mem.szMalloc = 0
**
** All other fields of Mem can safely remain uninitialized for now. They
-** will be initialized before use. The fields that are initialized by this
-** routine are grouped together so that they can be set using memcpy().
-**
-** tag-20220228a
+** will be initialized before use.
*/
static void initMemArray(Mem *p, int N, sqlite3 *db, u16 flags){
if( N>0 ){
- Mem x;
- x.flags = flags;
- x.db = db;
- x.szMalloc = 0;
do{
- memcpy(&p->flags, &x.flags, offsetof(Mem,uTemp)-offsetof(Mem,flags));
+ p->flags = flags;
+ p->db = db;
+ p->szMalloc = 0;
#ifdef SQLITE_DEBUG
p->pScopyFrom = 0;
#endif