Skip to content

Commit

Permalink
Explain macro to handle metadata for descibing the vdbe instructions.
Browse files Browse the repository at this point in the history
This includes p1, p2 and p3 mapped from a match table based on attribute
tags added to the enum variant fields.

A description attribute that is pulled from the enum variant and builds out
a const array for the .opcodes command that is generated from the descriptions.
  • Loading branch information
Chris Covington authored and Cluster444 committed Dec 21, 2024
1 parent 264b901 commit 53640de
Show file tree
Hide file tree
Showing 16 changed files with 1,750 additions and 1,502 deletions.
103 changes: 98 additions & 5 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 2 additions & 3 deletions cli/app.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use crate::opcodes_dictionary::OPCODE_DESCRIPTIONS;
use cli_table::{Cell, Table};
use limbo_core::{Database, LimboError, RowResult, Value};

Expand Down Expand Up @@ -434,13 +433,13 @@ impl Limbo {
}
Command::Opcodes => {
if args.len() > 1 {
for op in &OPCODE_DESCRIPTIONS {
for op in &limbo_core::INSN_DESCRIPTIONS {
if op.name.eq_ignore_ascii_case(args.get(1).unwrap().trim()) {
let _ = self.write_fmt(format_args!("{}", op));
}
}
} else {
for op in &OPCODE_DESCRIPTIONS {
for op in &limbo_core::INSN_DESCRIPTIONS {
let _ = self.write_fmt(format_args!("{}\n", op));
}
}
Expand Down
458 changes: 229 additions & 229 deletions cli/opcodes_dictionary.rs

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ pest = { version = "2.0", optional = true }
pest_derive = { version = "2.0", optional = true }
rand = "0.8.5"
bumpalo = { version = "3.16.0", features = ["collections", "boxed"] }
macros = { path = "../macros" }
limbo_macros = { path = "../macros" }

[target.'cfg(not(target_family = "windows"))'.dev-dependencies]
pprof = { version = "0.14.0", features = ["criterion", "flamegraph"] }
Expand Down
3 changes: 3 additions & 0 deletions core/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,9 @@ pub use storage::wal::CheckpointStatus;
pub use storage::wal::Wal;
pub use types::Value;

pub use vdbe::InsnDescription;
pub use vdbe::INSN_DESCRIPTIONS;

pub static DATABASE_VERSION: OnceLock<String> = OnceLock::new();

#[derive(Clone)]
Expand Down
Loading

0 comments on commit 53640de

Please sign in to comment.