Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove old interpreter #796

Merged
merged 5 commits into from
Nov 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
117 changes: 0 additions & 117 deletions .github/workflows/old_interpreter.yml

This file was deleted.

22 changes: 11 additions & 11 deletions c/src/metta.rs
Original file line number Diff line number Diff line change
Expand Up @@ -720,19 +720,19 @@ pub struct step_result_t {
result: *mut RustStepResult,
}

struct RustStepResult(InterpreterState<'static, DynSpace>);
struct RustStepResult(InterpreterState<DynSpace>);

impl From<InterpreterState<'static, DynSpace>> for step_result_t {
fn from(state: InterpreterState<'static, DynSpace>) -> Self {
impl From<InterpreterState<DynSpace>> for step_result_t {
fn from(state: InterpreterState<DynSpace>) -> Self {
Self{ result: Box::into_raw(Box::new(RustStepResult(state))) }
}
}

impl step_result_t {
fn into_inner(self) -> InterpreterState<'static, DynSpace> {
fn into_inner(self) -> InterpreterState<DynSpace> {
unsafe{ Box::from_raw(self.result).0 }
}
fn borrow(&self) -> &InterpreterState<'static, DynSpace> {
fn borrow(&self) -> &InterpreterState<DynSpace> {
&unsafe{ &*(&*self).result }.0
}
}
Expand Down Expand Up @@ -1210,22 +1210,22 @@ impl run_context_t {
}
}

struct RustRunContext(RunContext<'static, 'static, 'static>);
struct RustRunContext(RunContext<'static, 'static>);

impl From<&mut RunContext<'_, '_, '_>> for run_context_t {
fn from(context_ref: &mut RunContext<'_, '_, '_>) -> Self {
impl From<&mut RunContext<'_, '_>> for run_context_t {
fn from(context_ref: &mut RunContext<'_, '_>) -> Self {
Self {
context: (context_ref as *mut RunContext<'_, '_, '_>).cast(),
context: (context_ref as *mut RunContext<'_, '_>).cast(),
err_string: core::ptr::null_mut(),
}
}
}

impl run_context_t {
fn borrow(&self) -> &RunContext<'static, 'static, 'static> {
fn borrow(&self) -> &RunContext<'static, 'static> {
&unsafe{ &*self.context.cast::<RustRunContext>() }.0
}
fn borrow_mut(&mut self) -> &mut RunContext<'static, 'static, 'static> {
fn borrow_mut(&mut self) -> &mut RunContext<'static, 'static> {
&mut unsafe{ &mut *self.context.cast::<RustRunContext>() }.0
}
}
Expand Down
1 change: 0 additions & 1 deletion lib/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@ crate-type = ["lib"]
default = ["pkg_mgmt"]
# Add one of the features below into default list to enable.
# See https://doc.rust-lang.org/cargo/reference/features.html#the-features-section
old_interpreter = [] # enables old Rust interpreter
variable_operation = [] # enables evaluation of the expressions which have
# a variable on the first position
git = ["git2", "pkg_mgmt"]
Expand Down
1 change: 0 additions & 1 deletion lib/benches/interpreter_minimal.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#![feature(test)]
#[cfg(not(feature = "old_interpreter"))]
mod interpreter_minimal_bench {

extern crate test;
Expand Down
1 change: 0 additions & 1 deletion lib/src/atom/matcher.rs
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,6 @@ impl Bindings {
self.bindings.remove(from_binding_id);
}

#[allow(dead_code)] //TODO: MINIMAL only silence the warning until interpreter2 replaces interpreter
pub(crate) fn len(&self) -> usize {
self.binding_by_var.len()
}
Expand Down
1 change: 0 additions & 1 deletion lib/src/common/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
//! Common datastructures used in other modules. Common grounded atoms library.

pub mod plan;
pub mod collections;
pub mod shared;
pub mod assert;
Expand Down
Loading
Loading