[patches] [PATCH V3 10/10] sql: remove OP_Transaction
Bulat Niatshin
niatshin at tarantool.org
Mon Mar 5 14:53:29 MSK 2018
OP_Transaction in its current state was completely
unnecessary. In this patch it was removed, all
related code was refactored, opcodes set was
regenerated.
For #3119
---
extra/mkopcodeh.tcl | 1 -
src/box/sql/build.c | 4 -
src/box/sql/opcodes.c | 223 ++++++++++++++++++++++----------------------
src/box/sql/opcodes.h | 251 +++++++++++++++++++++++++-------------------------
src/box/sql/pragma.c | 7 +-
src/box/sql/vdbe.c | 47 ----------
6 files changed, 238 insertions(+), 295 deletions(-)
diff --git a/extra/mkopcodeh.tcl b/extra/mkopcodeh.tcl
index bd86ac69a..d3af56d2d 100644
--- a/extra/mkopcodeh.tcl
+++ b/extra/mkopcodeh.tcl
@@ -128,7 +128,6 @@ foreach name {OP_Noop OP_Explain} {
# The following are the opcodes that are processed by resolveP2Values()
#
set rp2v_ops {
- OP_Transaction
OP_AutoCommit
OP_Savepoint
OP_Checkpoint
diff --git a/src/box/sql/build.c b/src/box/sql/build.c
index 7a4a92dd5..cea6dea2c 100644
--- a/src/box/sql/build.c
+++ b/src/box/sql/build.c
@@ -99,10 +99,6 @@ sqlite3FinishCoding(Parse * pParse)
Schema *pSchema;
if (DbMaskTest(pParse->cookieMask, 0) != 0) {
pSchema = db->pSchema;
- sqlite3VdbeAddOp2(v, OP_Transaction, /* Opcode */
- 0, /* P1 */
- DbMaskTest(pParse->writeMask, 0) /* P2 */
- );
if (pParse->initiateTTrans)
sqlite3VdbeAddOp0(v, OP_TTransaction);
diff --git a/src/box/sql/opcodes.c b/src/box/sql/opcodes.c
index 2d5dc62ef..f95781191 100644
--- a/src/box/sql/opcodes.c
+++ b/src/box/sql/opcodes.c
@@ -13,17 +13,17 @@ const char *sqlite3OpcodeName(int i){
static const char *const azName[] = {
/* 0 */ "Savepoint" OpHelp(""),
/* 1 */ "AutoCommit" OpHelp(""),
- /* 2 */ "Transaction" OpHelp(""),
- /* 3 */ "SorterNext" OpHelp(""),
- /* 4 */ "PrevIfOpen" OpHelp(""),
+ /* 2 */ "SorterNext" OpHelp(""),
+ /* 3 */ "PrevIfOpen" OpHelp(""),
+ /* 4 */ "NextIfOpen" OpHelp(""),
/* 5 */ "Or" OpHelp("r[P3]=(r[P1] || r[P2])"),
/* 6 */ "And" OpHelp("r[P3]=(r[P1] && r[P2])"),
/* 7 */ "Not" OpHelp("r[P2]= !r[P1]"),
- /* 8 */ "NextIfOpen" OpHelp(""),
- /* 9 */ "Prev" OpHelp(""),
- /* 10 */ "Next" OpHelp(""),
- /* 11 */ "Goto" OpHelp(""),
- /* 12 */ "Gosub" OpHelp(""),
+ /* 8 */ "Prev" OpHelp(""),
+ /* 9 */ "Next" OpHelp(""),
+ /* 10 */ "Goto" OpHelp(""),
+ /* 11 */ "Gosub" OpHelp(""),
+ /* 12 */ "InitCoroutine" OpHelp(""),
/* 13 */ "IsNull" OpHelp("if r[P1]==NULL goto P2"),
/* 14 */ "NotNull" OpHelp("if r[P1]!=NULL goto P2"),
/* 15 */ "Ne" OpHelp("IF r[P3]!=r[P1]"),
@@ -43,113 +43,112 @@ const char *sqlite3OpcodeName(int i){
/* 29 */ "Divide" OpHelp("r[P3]=r[P2]/r[P1]"),
/* 30 */ "Remainder" OpHelp("r[P3]=r[P2]%r[P1]"),
/* 31 */ "Concat" OpHelp("r[P3]=r[P2]+r[P1]"),
- /* 32 */ "InitCoroutine" OpHelp(""),
+ /* 32 */ "Yield" OpHelp(""),
/* 33 */ "BitNot" OpHelp("r[P1]= ~r[P1]"),
- /* 34 */ "Yield" OpHelp(""),
- /* 35 */ "MustBeInt" OpHelp(""),
- /* 36 */ "Jump" OpHelp(""),
- /* 37 */ "Once" OpHelp(""),
- /* 38 */ "If" OpHelp(""),
- /* 39 */ "IfNot" OpHelp(""),
- /* 40 */ "SeekLT" OpHelp("key=r[P3 at P4]"),
- /* 41 */ "SeekLE" OpHelp("key=r[P3 at P4]"),
- /* 42 */ "SeekGE" OpHelp("key=r[P3 at P4]"),
- /* 43 */ "SeekGT" OpHelp("key=r[P3 at P4]"),
- /* 44 */ "NoConflict" OpHelp("key=r[P3 at P4]"),
- /* 45 */ "NotFound" OpHelp("key=r[P3 at P4]"),
- /* 46 */ "Found" OpHelp("key=r[P3 at P4]"),
- /* 47 */ "Last" OpHelp(""),
- /* 48 */ "SorterSort" OpHelp(""),
- /* 49 */ "Sort" OpHelp(""),
- /* 50 */ "Rewind" OpHelp(""),
- /* 51 */ "IdxLE" OpHelp("key=r[P3 at P4]"),
- /* 52 */ "IdxGT" OpHelp("key=r[P3 at P4]"),
- /* 53 */ "IdxLT" OpHelp("key=r[P3 at P4]"),
- /* 54 */ "IdxGE" OpHelp("key=r[P3 at P4]"),
- /* 55 */ "Program" OpHelp(""),
- /* 56 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
- /* 57 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
- /* 58 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
- /* 59 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
- /* 60 */ "Init" OpHelp("Start at P2"),
- /* 61 */ "Return" OpHelp(""),
- /* 62 */ "EndCoroutine" OpHelp(""),
- /* 63 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
- /* 64 */ "Halt" OpHelp(""),
- /* 65 */ "Integer" OpHelp("r[P2]=P1"),
- /* 66 */ "Bool" OpHelp("r[P2]=P1"),
- /* 67 */ "Int64" OpHelp("r[P2]=P4"),
- /* 68 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
- /* 69 */ "Null" OpHelp("r[P2..P3]=NULL"),
- /* 70 */ "SoftNull" OpHelp("r[P1]=NULL"),
- /* 71 */ "Blob" OpHelp("r[P2]=P4 (len=P1, subtype=P3)"),
- /* 72 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
- /* 73 */ "Move" OpHelp("r[P2 at P3]=r[P1 at P3]"),
- /* 74 */ "Copy" OpHelp("r[P2 at P3+1]=r[P1 at P3+1]"),
+ /* 34 */ "MustBeInt" OpHelp(""),
+ /* 35 */ "Jump" OpHelp(""),
+ /* 36 */ "Once" OpHelp(""),
+ /* 37 */ "If" OpHelp(""),
+ /* 38 */ "IfNot" OpHelp(""),
+ /* 39 */ "SeekLT" OpHelp("key=r[P3 at P4]"),
+ /* 40 */ "SeekLE" OpHelp("key=r[P3 at P4]"),
+ /* 41 */ "SeekGE" OpHelp("key=r[P3 at P4]"),
+ /* 42 */ "SeekGT" OpHelp("key=r[P3 at P4]"),
+ /* 43 */ "NoConflict" OpHelp("key=r[P3 at P4]"),
+ /* 44 */ "NotFound" OpHelp("key=r[P3 at P4]"),
+ /* 45 */ "Found" OpHelp("key=r[P3 at P4]"),
+ /* 46 */ "Last" OpHelp(""),
+ /* 47 */ "SorterSort" OpHelp(""),
+ /* 48 */ "Sort" OpHelp(""),
+ /* 49 */ "Rewind" OpHelp(""),
+ /* 50 */ "IdxLE" OpHelp("key=r[P3 at P4]"),
+ /* 51 */ "IdxGT" OpHelp("key=r[P3 at P4]"),
+ /* 52 */ "IdxLT" OpHelp("key=r[P3 at P4]"),
+ /* 53 */ "IdxGE" OpHelp("key=r[P3 at P4]"),
+ /* 54 */ "Program" OpHelp(""),
+ /* 55 */ "FkIfZero" OpHelp("if fkctr[P1]==0 goto P2"),
+ /* 56 */ "IfPos" OpHelp("if r[P1]>0 then r[P1]-=P3, goto P2"),
+ /* 57 */ "IfNotZero" OpHelp("if r[P1]!=0 then r[P1]--, goto P2"),
+ /* 58 */ "DecrJumpZero" OpHelp("if (--r[P1])==0 goto P2"),
+ /* 59 */ "Init" OpHelp("Start at P2"),
+ /* 60 */ "Return" OpHelp(""),
+ /* 61 */ "EndCoroutine" OpHelp(""),
+ /* 62 */ "HaltIfNull" OpHelp("if r[P3]=null halt"),
+ /* 63 */ "Halt" OpHelp(""),
+ /* 64 */ "Integer" OpHelp("r[P2]=P1"),
+ /* 65 */ "Bool" OpHelp("r[P2]=P1"),
+ /* 66 */ "Int64" OpHelp("r[P2]=P4"),
+ /* 67 */ "String" OpHelp("r[P2]='P4' (len=P1)"),
+ /* 68 */ "Null" OpHelp("r[P2..P3]=NULL"),
+ /* 69 */ "SoftNull" OpHelp("r[P1]=NULL"),
+ /* 70 */ "Blob" OpHelp("r[P2]=P4 (len=P1, subtype=P3)"),
+ /* 71 */ "Variable" OpHelp("r[P2]=parameter(P1,P4)"),
+ /* 72 */ "Move" OpHelp("r[P2 at P3]=r[P1 at P3]"),
+ /* 73 */ "Copy" OpHelp("r[P2 at P3+1]=r[P1 at P3+1]"),
+ /* 74 */ "SCopy" OpHelp("r[P2]=r[P1]"),
/* 75 */ "String8" OpHelp("r[P2]='P4'"),
- /* 76 */ "SCopy" OpHelp("r[P2]=r[P1]"),
- /* 77 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
- /* 78 */ "ResultRow" OpHelp("output=r[P1 at P2]"),
- /* 79 */ "CollSeq" OpHelp(""),
- /* 80 */ "Function0" OpHelp("r[P3]=func(r[P2 at P5])"),
- /* 81 */ "Function" OpHelp("r[P3]=func(r[P2 at P5])"),
- /* 82 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
- /* 83 */ "RealAffinity" OpHelp(""),
- /* 84 */ "Cast" OpHelp("affinity(r[P1])"),
- /* 85 */ "Permutation" OpHelp(""),
- /* 86 */ "Compare" OpHelp("r[P1 at P3] <-> r[P2 at P3]"),
- /* 87 */ "Column" OpHelp("r[P3]=PX"),
- /* 88 */ "Affinity" OpHelp("affinity(r[P1 at P2])"),
- /* 89 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1 at P2])"),
- /* 90 */ "Count" OpHelp("r[P2]=count()"),
- /* 91 */ "FkCheckCommit" OpHelp(""),
- /* 92 */ "TTransaction" OpHelp(""),
- /* 93 */ "ReadCookie" OpHelp(""),
- /* 94 */ "SetCookie" OpHelp(""),
- /* 95 */ "ReopenIdx" OpHelp("root=P2"),
- /* 96 */ "OpenRead" OpHelp("root=P2"),
- /* 97 */ "OpenWrite" OpHelp("root=P2"),
- /* 98 */ "OpenTEphemeral" OpHelp("nColumn = P2"),
- /* 99 */ "SorterOpen" OpHelp(""),
- /* 100 */ "SequenceTest" OpHelp("if (cursor[P1].ctr++) pc = P2"),
- /* 101 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
- /* 102 */ "Close" OpHelp(""),
- /* 103 */ "ColumnsUsed" OpHelp(""),
- /* 104 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
- /* 105 */ "NextId" OpHelp("r[P3]=get_max(space_index[P1]{Column[P2]})"),
- /* 106 */ "NextIdEphemeral" OpHelp("r[P3]=get_max(space_index[P1]{Column[P2]})"),
- /* 107 */ "FCopy" OpHelp("reg[P2 at cur_frame]= reg[P1 at root_frame(OPFLAG_SAME_FRAME)]"),
- /* 108 */ "Delete" OpHelp(""),
- /* 109 */ "ResetCount" OpHelp(""),
- /* 110 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
- /* 111 */ "SorterData" OpHelp("r[P2]=data"),
- /* 112 */ "RowData" OpHelp("r[P2]=data"),
- /* 113 */ "NullRow" OpHelp(""),
- /* 114 */ "SorterInsert" OpHelp("key=r[P2]"),
+ /* 76 */ "IntCopy" OpHelp("r[P2]=r[P1]"),
+ /* 77 */ "ResultRow" OpHelp("output=r[P1 at P2]"),
+ /* 78 */ "CollSeq" OpHelp(""),
+ /* 79 */ "Function0" OpHelp("r[P3]=func(r[P2 at P5])"),
+ /* 80 */ "Function" OpHelp("r[P3]=func(r[P2 at P5])"),
+ /* 81 */ "AddImm" OpHelp("r[P1]=r[P1]+P2"),
+ /* 82 */ "RealAffinity" OpHelp(""),
+ /* 83 */ "Cast" OpHelp("affinity(r[P1])"),
+ /* 84 */ "Permutation" OpHelp(""),
+ /* 85 */ "Compare" OpHelp("r[P1 at P3] <-> r[P2 at P3]"),
+ /* 86 */ "Column" OpHelp("r[P3]=PX"),
+ /* 87 */ "Affinity" OpHelp("affinity(r[P1 at P2])"),
+ /* 88 */ "MakeRecord" OpHelp("r[P3]=mkrec(r[P1 at P2])"),
+ /* 89 */ "Count" OpHelp("r[P2]=count()"),
+ /* 90 */ "FkCheckCommit" OpHelp(""),
+ /* 91 */ "TTransaction" OpHelp(""),
+ /* 92 */ "ReadCookie" OpHelp(""),
+ /* 93 */ "SetCookie" OpHelp(""),
+ /* 94 */ "ReopenIdx" OpHelp("root=P2"),
+ /* 95 */ "OpenRead" OpHelp("root=P2"),
+ /* 96 */ "OpenWrite" OpHelp("root=P2"),
+ /* 97 */ "OpenTEphemeral" OpHelp("nColumn = P2"),
+ /* 98 */ "SorterOpen" OpHelp(""),
+ /* 99 */ "SequenceTest" OpHelp("if (cursor[P1].ctr++) pc = P2"),
+ /* 100 */ "OpenPseudo" OpHelp("P3 columns in r[P2]"),
+ /* 101 */ "Close" OpHelp(""),
+ /* 102 */ "ColumnsUsed" OpHelp(""),
+ /* 103 */ "Sequence" OpHelp("r[P2]=cursor[P1].ctr++"),
+ /* 104 */ "NextId" OpHelp("r[P3]=get_max(space_index[P1]{Column[P2]})"),
+ /* 105 */ "NextIdEphemeral" OpHelp("r[P3]=get_max(space_index[P1]{Column[P2]})"),
+ /* 106 */ "FCopy" OpHelp("reg[P2 at cur_frame]= reg[P1 at root_frame(OPFLAG_SAME_FRAME)]"),
+ /* 107 */ "Delete" OpHelp(""),
+ /* 108 */ "ResetCount" OpHelp(""),
+ /* 109 */ "SorterCompare" OpHelp("if key(P1)!=trim(r[P3],P4) goto P2"),
+ /* 110 */ "SorterData" OpHelp("r[P2]=data"),
+ /* 111 */ "RowData" OpHelp("r[P2]=data"),
+ /* 112 */ "NullRow" OpHelp(""),
+ /* 113 */ "SorterInsert" OpHelp("key=r[P2]"),
+ /* 114 */ "IdxReplace" OpHelp("key=r[P2]"),
/* 115 */ "Real" OpHelp("r[P2]=P4"),
- /* 116 */ "IdxReplace" OpHelp("key=r[P2]"),
- /* 117 */ "IdxInsert" OpHelp("key=r[P2]"),
- /* 118 */ "IdxDelete" OpHelp("key=r[P2 at P3]"),
- /* 119 */ "Destroy" OpHelp(""),
- /* 120 */ "Clear" OpHelp(""),
- /* 121 */ "ResetSorter" OpHelp(""),
- /* 122 */ "ParseSchema2" OpHelp("rows=r[P1 at P2]"),
- /* 123 */ "ParseSchema3" OpHelp("name=r[P1] sql=r[P1+1]"),
- /* 124 */ "RenameTable" OpHelp("P1 = root, P4 = name"),
- /* 125 */ "LoadAnalysis" OpHelp(""),
- /* 126 */ "DropTable" OpHelp(""),
- /* 127 */ "DropIndex" OpHelp(""),
- /* 128 */ "DropTrigger" OpHelp(""),
- /* 129 */ "Param" OpHelp(""),
- /* 130 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
- /* 131 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
- /* 132 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2 at P5])"),
- /* 133 */ "AggStep" OpHelp("accum=r[P3] step(r[P2 at P5])"),
- /* 134 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
- /* 135 */ "Expire" OpHelp(""),
- /* 136 */ "IncMaxid" OpHelp(""),
- /* 137 */ "Noop" OpHelp(""),
- /* 138 */ "Explain" OpHelp(""),
+ /* 116 */ "IdxInsert" OpHelp("key=r[P2]"),
+ /* 117 */ "IdxDelete" OpHelp("key=r[P2 at P3]"),
+ /* 118 */ "Destroy" OpHelp(""),
+ /* 119 */ "Clear" OpHelp(""),
+ /* 120 */ "ResetSorter" OpHelp(""),
+ /* 121 */ "ParseSchema2" OpHelp("rows=r[P1 at P2]"),
+ /* 122 */ "ParseSchema3" OpHelp("name=r[P1] sql=r[P1+1]"),
+ /* 123 */ "RenameTable" OpHelp("P1 = root, P4 = name"),
+ /* 124 */ "LoadAnalysis" OpHelp(""),
+ /* 125 */ "DropTable" OpHelp(""),
+ /* 126 */ "DropIndex" OpHelp(""),
+ /* 127 */ "DropTrigger" OpHelp(""),
+ /* 128 */ "Param" OpHelp(""),
+ /* 129 */ "FkCounter" OpHelp("fkctr[P1]+=P2"),
+ /* 130 */ "OffsetLimit" OpHelp("if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1)"),
+ /* 131 */ "AggStep0" OpHelp("accum=r[P3] step(r[P2 at P5])"),
+ /* 132 */ "AggStep" OpHelp("accum=r[P3] step(r[P2 at P5])"),
+ /* 133 */ "AggFinal" OpHelp("accum=r[P1] N=P2"),
+ /* 134 */ "Expire" OpHelp(""),
+ /* 135 */ "IncMaxid" OpHelp(""),
+ /* 136 */ "Noop" OpHelp(""),
+ /* 137 */ "Explain" OpHelp(""),
};
return azName[i];
}
diff --git a/src/box/sql/opcodes.h b/src/box/sql/opcodes.h
index 3f60e4066..4d2da5216 100644
--- a/src/box/sql/opcodes.h
+++ b/src/box/sql/opcodes.h
@@ -2,17 +2,17 @@
/* See the tool/mkopcodeh.tcl script for details */
#define OP_Savepoint 0
#define OP_AutoCommit 1
-#define OP_Transaction 2
-#define OP_SorterNext 3
-#define OP_PrevIfOpen 4
+#define OP_SorterNext 2
+#define OP_PrevIfOpen 3
+#define OP_NextIfOpen 4
#define OP_Or 5 /* same as TK_OR, synopsis: r[P3]=(r[P1] || r[P2]) */
#define OP_And 6 /* same as TK_AND, synopsis: r[P3]=(r[P1] && r[P2]) */
#define OP_Not 7 /* same as TK_NOT, synopsis: r[P2]= !r[P1] */
-#define OP_NextIfOpen 8
-#define OP_Prev 9
-#define OP_Next 10
-#define OP_Goto 11
-#define OP_Gosub 12
+#define OP_Prev 8
+#define OP_Next 9
+#define OP_Goto 10
+#define OP_Gosub 11
+#define OP_InitCoroutine 12
#define OP_IsNull 13 /* same as TK_ISNULL, synopsis: if r[P1]==NULL goto P2 */
#define OP_NotNull 14 /* same as TK_NOTNULL, synopsis: if r[P1]!=NULL goto P2 */
#define OP_Ne 15 /* same as TK_NE, synopsis: IF r[P3]!=r[P1] */
@@ -32,113 +32,112 @@
#define OP_Divide 29 /* same as TK_SLASH, synopsis: r[P3]=r[P2]/r[P1] */
#define OP_Remainder 30 /* same as TK_REM, synopsis: r[P3]=r[P2]%r[P1] */
#define OP_Concat 31 /* same as TK_CONCAT, synopsis: r[P3]=r[P2]+r[P1] */
-#define OP_InitCoroutine 32
+#define OP_Yield 32
#define OP_BitNot 33 /* same as TK_BITNOT, synopsis: r[P1]= ~r[P1] */
-#define OP_Yield 34
-#define OP_MustBeInt 35
-#define OP_Jump 36
-#define OP_Once 37
-#define OP_If 38
-#define OP_IfNot 39
-#define OP_SeekLT 40 /* synopsis: key=r[P3 at P4] */
-#define OP_SeekLE 41 /* synopsis: key=r[P3 at P4] */
-#define OP_SeekGE 42 /* synopsis: key=r[P3 at P4] */
-#define OP_SeekGT 43 /* synopsis: key=r[P3 at P4] */
-#define OP_NoConflict 44 /* synopsis: key=r[P3 at P4] */
-#define OP_NotFound 45 /* synopsis: key=r[P3 at P4] */
-#define OP_Found 46 /* synopsis: key=r[P3 at P4] */
-#define OP_Last 47
-#define OP_SorterSort 48
-#define OP_Sort 49
-#define OP_Rewind 50
-#define OP_IdxLE 51 /* synopsis: key=r[P3 at P4] */
-#define OP_IdxGT 52 /* synopsis: key=r[P3 at P4] */
-#define OP_IdxLT 53 /* synopsis: key=r[P3 at P4] */
-#define OP_IdxGE 54 /* synopsis: key=r[P3 at P4] */
-#define OP_Program 55
-#define OP_FkIfZero 56 /* synopsis: if fkctr[P1]==0 goto P2 */
-#define OP_IfPos 57 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
-#define OP_IfNotZero 58 /* synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
-#define OP_DecrJumpZero 59 /* synopsis: if (--r[P1])==0 goto P2 */
-#define OP_Init 60 /* synopsis: Start at P2 */
-#define OP_Return 61
-#define OP_EndCoroutine 62
-#define OP_HaltIfNull 63 /* synopsis: if r[P3]=null halt */
-#define OP_Halt 64
-#define OP_Integer 65 /* synopsis: r[P2]=P1 */
-#define OP_Bool 66 /* synopsis: r[P2]=P1 */
-#define OP_Int64 67 /* synopsis: r[P2]=P4 */
-#define OP_String 68 /* synopsis: r[P2]='P4' (len=P1) */
-#define OP_Null 69 /* synopsis: r[P2..P3]=NULL */
-#define OP_SoftNull 70 /* synopsis: r[P1]=NULL */
-#define OP_Blob 71 /* synopsis: r[P2]=P4 (len=P1, subtype=P3) */
-#define OP_Variable 72 /* synopsis: r[P2]=parameter(P1,P4) */
-#define OP_Move 73 /* synopsis: r[P2 at P3]=r[P1 at P3] */
-#define OP_Copy 74 /* synopsis: r[P2 at P3+1]=r[P1 at P3+1] */
+#define OP_MustBeInt 34
+#define OP_Jump 35
+#define OP_Once 36
+#define OP_If 37
+#define OP_IfNot 38
+#define OP_SeekLT 39 /* synopsis: key=r[P3 at P4] */
+#define OP_SeekLE 40 /* synopsis: key=r[P3 at P4] */
+#define OP_SeekGE 41 /* synopsis: key=r[P3 at P4] */
+#define OP_SeekGT 42 /* synopsis: key=r[P3 at P4] */
+#define OP_NoConflict 43 /* synopsis: key=r[P3 at P4] */
+#define OP_NotFound 44 /* synopsis: key=r[P3 at P4] */
+#define OP_Found 45 /* synopsis: key=r[P3 at P4] */
+#define OP_Last 46
+#define OP_SorterSort 47
+#define OP_Sort 48
+#define OP_Rewind 49
+#define OP_IdxLE 50 /* synopsis: key=r[P3 at P4] */
+#define OP_IdxGT 51 /* synopsis: key=r[P3 at P4] */
+#define OP_IdxLT 52 /* synopsis: key=r[P3 at P4] */
+#define OP_IdxGE 53 /* synopsis: key=r[P3 at P4] */
+#define OP_Program 54
+#define OP_FkIfZero 55 /* synopsis: if fkctr[P1]==0 goto P2 */
+#define OP_IfPos 56 /* synopsis: if r[P1]>0 then r[P1]-=P3, goto P2 */
+#define OP_IfNotZero 57 /* synopsis: if r[P1]!=0 then r[P1]--, goto P2 */
+#define OP_DecrJumpZero 58 /* synopsis: if (--r[P1])==0 goto P2 */
+#define OP_Init 59 /* synopsis: Start at P2 */
+#define OP_Return 60
+#define OP_EndCoroutine 61
+#define OP_HaltIfNull 62 /* synopsis: if r[P3]=null halt */
+#define OP_Halt 63
+#define OP_Integer 64 /* synopsis: r[P2]=P1 */
+#define OP_Bool 65 /* synopsis: r[P2]=P1 */
+#define OP_Int64 66 /* synopsis: r[P2]=P4 */
+#define OP_String 67 /* synopsis: r[P2]='P4' (len=P1) */
+#define OP_Null 68 /* synopsis: r[P2..P3]=NULL */
+#define OP_SoftNull 69 /* synopsis: r[P1]=NULL */
+#define OP_Blob 70 /* synopsis: r[P2]=P4 (len=P1, subtype=P3) */
+#define OP_Variable 71 /* synopsis: r[P2]=parameter(P1,P4) */
+#define OP_Move 72 /* synopsis: r[P2 at P3]=r[P1 at P3] */
+#define OP_Copy 73 /* synopsis: r[P2 at P3+1]=r[P1 at P3+1] */
+#define OP_SCopy 74 /* synopsis: r[P2]=r[P1] */
#define OP_String8 75 /* same as TK_STRING, synopsis: r[P2]='P4' */
-#define OP_SCopy 76 /* synopsis: r[P2]=r[P1] */
-#define OP_IntCopy 77 /* synopsis: r[P2]=r[P1] */
-#define OP_ResultRow 78 /* synopsis: output=r[P1 at P2] */
-#define OP_CollSeq 79
-#define OP_Function0 80 /* synopsis: r[P3]=func(r[P2 at P5]) */
-#define OP_Function 81 /* synopsis: r[P3]=func(r[P2 at P5]) */
-#define OP_AddImm 82 /* synopsis: r[P1]=r[P1]+P2 */
-#define OP_RealAffinity 83
-#define OP_Cast 84 /* synopsis: affinity(r[P1]) */
-#define OP_Permutation 85
-#define OP_Compare 86 /* synopsis: r[P1 at P3] <-> r[P2 at P3] */
-#define OP_Column 87 /* synopsis: r[P3]=PX */
-#define OP_Affinity 88 /* synopsis: affinity(r[P1 at P2]) */
-#define OP_MakeRecord 89 /* synopsis: r[P3]=mkrec(r[P1 at P2]) */
-#define OP_Count 90 /* synopsis: r[P2]=count() */
-#define OP_FkCheckCommit 91
-#define OP_TTransaction 92
-#define OP_ReadCookie 93
-#define OP_SetCookie 94
-#define OP_ReopenIdx 95 /* synopsis: root=P2 */
-#define OP_OpenRead 96 /* synopsis: root=P2 */
-#define OP_OpenWrite 97 /* synopsis: root=P2 */
-#define OP_OpenTEphemeral 98 /* synopsis: nColumn = P2 */
-#define OP_SorterOpen 99
-#define OP_SequenceTest 100 /* synopsis: if (cursor[P1].ctr++) pc = P2 */
-#define OP_OpenPseudo 101 /* synopsis: P3 columns in r[P2] */
-#define OP_Close 102
-#define OP_ColumnsUsed 103
-#define OP_Sequence 104 /* synopsis: r[P2]=cursor[P1].ctr++ */
-#define OP_NextId 105 /* synopsis: r[P3]=get_max(space_index[P1]{Column[P2]}) */
-#define OP_NextIdEphemeral 106 /* synopsis: r[P3]=get_max(space_index[P1]{Column[P2]}) */
-#define OP_FCopy 107 /* synopsis: reg[P2 at cur_frame]= reg[P1 at root_frame(OPFLAG_SAME_FRAME)] */
-#define OP_Delete 108
-#define OP_ResetCount 109
-#define OP_SorterCompare 110 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
-#define OP_SorterData 111 /* synopsis: r[P2]=data */
-#define OP_RowData 112 /* synopsis: r[P2]=data */
-#define OP_NullRow 113
-#define OP_SorterInsert 114 /* synopsis: key=r[P2] */
+#define OP_IntCopy 76 /* synopsis: r[P2]=r[P1] */
+#define OP_ResultRow 77 /* synopsis: output=r[P1 at P2] */
+#define OP_CollSeq 78
+#define OP_Function0 79 /* synopsis: r[P3]=func(r[P2 at P5]) */
+#define OP_Function 80 /* synopsis: r[P3]=func(r[P2 at P5]) */
+#define OP_AddImm 81 /* synopsis: r[P1]=r[P1]+P2 */
+#define OP_RealAffinity 82
+#define OP_Cast 83 /* synopsis: affinity(r[P1]) */
+#define OP_Permutation 84
+#define OP_Compare 85 /* synopsis: r[P1 at P3] <-> r[P2 at P3] */
+#define OP_Column 86 /* synopsis: r[P3]=PX */
+#define OP_Affinity 87 /* synopsis: affinity(r[P1 at P2]) */
+#define OP_MakeRecord 88 /* synopsis: r[P3]=mkrec(r[P1 at P2]) */
+#define OP_Count 89 /* synopsis: r[P2]=count() */
+#define OP_FkCheckCommit 90
+#define OP_TTransaction 91
+#define OP_ReadCookie 92
+#define OP_SetCookie 93
+#define OP_ReopenIdx 94 /* synopsis: root=P2 */
+#define OP_OpenRead 95 /* synopsis: root=P2 */
+#define OP_OpenWrite 96 /* synopsis: root=P2 */
+#define OP_OpenTEphemeral 97 /* synopsis: nColumn = P2 */
+#define OP_SorterOpen 98
+#define OP_SequenceTest 99 /* synopsis: if (cursor[P1].ctr++) pc = P2 */
+#define OP_OpenPseudo 100 /* synopsis: P3 columns in r[P2] */
+#define OP_Close 101
+#define OP_ColumnsUsed 102
+#define OP_Sequence 103 /* synopsis: r[P2]=cursor[P1].ctr++ */
+#define OP_NextId 104 /* synopsis: r[P3]=get_max(space_index[P1]{Column[P2]}) */
+#define OP_NextIdEphemeral 105 /* synopsis: r[P3]=get_max(space_index[P1]{Column[P2]}) */
+#define OP_FCopy 106 /* synopsis: reg[P2 at cur_frame]= reg[P1 at root_frame(OPFLAG_SAME_FRAME)] */
+#define OP_Delete 107
+#define OP_ResetCount 108
+#define OP_SorterCompare 109 /* synopsis: if key(P1)!=trim(r[P3],P4) goto P2 */
+#define OP_SorterData 110 /* synopsis: r[P2]=data */
+#define OP_RowData 111 /* synopsis: r[P2]=data */
+#define OP_NullRow 112
+#define OP_SorterInsert 113 /* synopsis: key=r[P2] */
+#define OP_IdxReplace 114 /* synopsis: key=r[P2] */
#define OP_Real 115 /* same as TK_FLOAT, synopsis: r[P2]=P4 */
-#define OP_IdxReplace 116 /* synopsis: key=r[P2] */
-#define OP_IdxInsert 117 /* synopsis: key=r[P2] */
-#define OP_IdxDelete 118 /* synopsis: key=r[P2 at P3] */
-#define OP_Destroy 119
-#define OP_Clear 120
-#define OP_ResetSorter 121
-#define OP_ParseSchema2 122 /* synopsis: rows=r[P1 at P2] */
-#define OP_ParseSchema3 123 /* synopsis: name=r[P1] sql=r[P1+1] */
-#define OP_RenameTable 124 /* synopsis: P1 = root, P4 = name */
-#define OP_LoadAnalysis 125
-#define OP_DropTable 126
-#define OP_DropIndex 127
-#define OP_DropTrigger 128
-#define OP_Param 129
-#define OP_FkCounter 130 /* synopsis: fkctr[P1]+=P2 */
-#define OP_OffsetLimit 131 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
-#define OP_AggStep0 132 /* synopsis: accum=r[P3] step(r[P2 at P5]) */
-#define OP_AggStep 133 /* synopsis: accum=r[P3] step(r[P2 at P5]) */
-#define OP_AggFinal 134 /* synopsis: accum=r[P1] N=P2 */
-#define OP_Expire 135
-#define OP_IncMaxid 136
-#define OP_Noop 137
-#define OP_Explain 138
+#define OP_IdxInsert 116 /* synopsis: key=r[P2] */
+#define OP_IdxDelete 117 /* synopsis: key=r[P2 at P3] */
+#define OP_Destroy 118
+#define OP_Clear 119
+#define OP_ResetSorter 120
+#define OP_ParseSchema2 121 /* synopsis: rows=r[P1 at P2] */
+#define OP_ParseSchema3 122 /* synopsis: name=r[P1] sql=r[P1+1] */
+#define OP_RenameTable 123 /* synopsis: P1 = root, P4 = name */
+#define OP_LoadAnalysis 124
+#define OP_DropTable 125
+#define OP_DropIndex 126
+#define OP_DropTrigger 127
+#define OP_Param 128
+#define OP_FkCounter 129 /* synopsis: fkctr[P1]+=P2 */
+#define OP_OffsetLimit 130 /* synopsis: if r[P1]>0 then r[P2]=r[P1]+max(0,r[P3]) else r[P2]=(-1) */
+#define OP_AggStep0 131 /* synopsis: accum=r[P3] step(r[P2 at P5]) */
+#define OP_AggStep 132 /* synopsis: accum=r[P3] step(r[P2 at P5]) */
+#define OP_AggFinal 133 /* synopsis: accum=r[P1] N=P2 */
+#define OP_Expire 134
+#define OP_IncMaxid 135
+#define OP_Noop 136
+#define OP_Explain 137
/* Properties such as "out2" or "jump" that are specified in
** comments following the "case" for each opcode in the vdbe.c
@@ -151,24 +150,24 @@
#define OPFLG_OUT2 0x10 /* out2: P2 is an output */
#define OPFLG_OUT3 0x20 /* out3: P3 is an output */
#define OPFLG_INITIALIZER {\
-/* 0 */ 0x00, 0x00, 0x00, 0x01, 0x01, 0x26, 0x26, 0x12,\
+/* 0 */ 0x00, 0x00, 0x01, 0x01, 0x01, 0x26, 0x26, 0x12,\
/* 8 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x03, 0x03, 0x0b,\
/* 16 */ 0x0b, 0x0b, 0x0b, 0x0b, 0x0b, 0x01, 0x26, 0x26,\
/* 24 */ 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26, 0x26,\
-/* 32 */ 0x01, 0x12, 0x03, 0x03, 0x01, 0x01, 0x03, 0x03,\
-/* 40 */ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x01,\
+/* 32 */ 0x03, 0x12, 0x03, 0x01, 0x01, 0x03, 0x03, 0x09,\
+/* 40 */ 0x09, 0x09, 0x09, 0x09, 0x09, 0x09, 0x01, 0x01,\
/* 48 */ 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01,\
-/* 56 */ 0x01, 0x03, 0x03, 0x03, 0x01, 0x02, 0x02, 0x08,\
-/* 64 */ 0x00, 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10,\
-/* 72 */ 0x10, 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00,\
-/* 80 */ 0x00, 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00,\
-/* 88 */ 0x00, 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00,\
-/* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
-/* 104 */ 0x10, 0x20, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00,\
-/* 112 */ 0x00, 0x00, 0x04, 0x10, 0x00, 0x04, 0x00, 0x10,\
+/* 56 */ 0x03, 0x03, 0x03, 0x01, 0x02, 0x02, 0x08, 0x00,\
+/* 64 */ 0x10, 0x10, 0x10, 0x10, 0x10, 0x00, 0x10, 0x10,\
+/* 72 */ 0x00, 0x00, 0x10, 0x10, 0x10, 0x00, 0x00, 0x00,\
+/* 80 */ 0x00, 0x02, 0x02, 0x02, 0x00, 0x00, 0x00, 0x00,\
+/* 88 */ 0x00, 0x10, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00,\
+/* 96 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x10,\
+/* 104 */ 0x20, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00,\
+/* 112 */ 0x00, 0x04, 0x00, 0x10, 0x04, 0x00, 0x10, 0x00,\
/* 120 */ 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00,\
-/* 128 */ 0x00, 0x10, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00,\
-/* 136 */ 0x00, 0x00, 0x00,}
+/* 128 */ 0x10, 0x00, 0x1a, 0x00, 0x00, 0x00, 0x00, 0x00,\
+/* 136 */ 0x00, 0x00,}
/* The sqlite3P2Values() routine is able to run faster if it knows
** the value of the largest JUMP opcode. The smaller the maximum
@@ -176,4 +175,4 @@
** generated this include file strives to group all JUMP opcodes
** together near the beginning of the list.
*/
-#define SQLITE_MX_JUMP_OPCODE 60 /* Maximum JUMP opcode */
+#define SQLITE_MX_JUMP_OPCODE 59 /* Maximum JUMP opcode */
diff --git a/src/box/sql/pragma.c b/src/box/sql/pragma.c
index f969c2eea..7e5574c30 100644
--- a/src/box/sql/pragma.c
+++ b/src/box/sql/pragma.c
@@ -831,7 +831,6 @@ sqlite3Pragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
&& (pPragma->mPragFlg & PragFlg_ReadOnly) == 0) {
/* Write the specified cookie value */
static const VdbeOpList setCookie[] = {
- {OP_Transaction, 0, 1, 0}, /* 0 */
{OP_SetCookie, 0, 0, 0}, /* 1 */
};
VdbeOp *aOp;
@@ -845,13 +844,11 @@ sqlite3Pragma(Parse * pParse, Token * pId, /* First part of [schema.]id field */
if (ONLY_IF_REALLOC_STRESS(aOp == 0))
break;
aOp[0].p1 = 0;
- aOp[1].p1 = 0;
- aOp[1].p2 = iCookie;
- aOp[1].p3 = sqlite3Atoi(zRight);
+ aOp[0].p2 = iCookie;
+ aOp[0].p3 = sqlite3Atoi(zRight);
} else {
/* Read the specified cookie value */
static const VdbeOpList readCookie[] = {
- {OP_Transaction, 0, 0, 0}, /* 0 */
{OP_ReadCookie, 0, 1, 0}, /* 1 */
{OP_ResultRow, 1, 1, 0}
};
diff --git a/src/box/sql/vdbe.c b/src/box/sql/vdbe.c
index 7b4e0ae3b..14e6b3148 100644
--- a/src/box/sql/vdbe.c
+++ b/src/box/sql/vdbe.c
@@ -2997,58 +2997,11 @@ case OP_AutoCommit: {
break;
}
-/* Opcode: Transaction P1 P2 * * *
- *
- * Begin a transaction on database P1 if a transaction is not already
- * active.
- * If P2 is non-zero, then a write-transaction is started, or if a
- * read-transaction is already active, it is upgraded to a write-transaction.
- * If P2 is zero, then a read-transaction is started.
- *
- * P1 is the index of the database file on which the transaction is
- * started. Index 0 is the main database file and index 1 is the
- * file used for temporary tables. Indices of 2 or more are used for
- * attached databases.
- *
- * If a write-transaction is started and the Vdbe.usesStmtJournal flag is
- * true (this flag is set if the Vdbe may modify more than one row and may
- * throw an ABORT exception), a statement transaction may also be opened.
- * More specifically, a statement transaction is opened if the database
- * connection is currently not in autocommit mode, or if there are other
- * active statements. A statement transaction allows the changes made by this
- * VDBE to be rolled back after an error without having to roll back the
- * entire transaction. If no error is encountered, the statement transaction
- * will automatically commit when the VDBE halts.
- *
- */
-case OP_Transaction: {
- assert(pOp->p1==0);
- if (pOp->p2 && (user_session->sql_flags & SQLITE_QueryOnly)!=0) {
- rc = SQLITE_READONLY;
- goto abort_due_to_error;
- }
-
- testcase(rc == SQLITE_BUSY_SNAPSHOT);
- testcase(rc == SQLITE_BUSY_RECOVERY);
- if (rc != SQLITE_OK) {
- if ((rc&0xff) == SQLITE_BUSY) {
- p->pc = (int)(pOp - aOp);
- p->rc = rc;
- goto vdbe_return;
- }
- goto abort_due_to_error;
- }
-
- if (rc) goto abort_due_to_error;
- break;
-}
-
/* Opcode: TTransaction * * * * *
*
* Start Tarantool's transaction.
* Only do that if auto commit mode is on. This should be no-op
* if this opcode was emitted inside a transaction.
- * Auto commit mode is disabled by OP_Transaction.
*/
case OP_TTransaction: {
if (p->autoCommit) {
--
2.14.1
More information about the Tarantool-patches
mailing list