1
0
This commit is contained in:
Jeff 2025-02-15 15:52:27 -05:00
parent 720f006d8c
commit afcc1874fe
7 changed files with 9 additions and 43 deletions

View File

@ -82,7 +82,7 @@ impl Type {
| (Type::Float, Type::Float) | (Type::Float, Type::Float)
| (Type::Integer, Type::Integer) | (Type::Integer, Type::Integer)
| (Type::None, Type::None) | (Type::None, Type::None)
| (Type::String { .. }, Type::String { .. }) => return Ok(()), | (Type::String, Type::String) => return Ok(()),
( (
Type::Generic(GenericType { Type::Generic(GenericType {
concrete_type: left, concrete_type: left,
@ -264,7 +264,7 @@ impl Ord for Type {
(Type::SelfFunction, Type::SelfFunction) => Ordering::Equal, (Type::SelfFunction, Type::SelfFunction) => Ordering::Equal,
(Type::SelfFunction, _) => Ordering::Greater, (Type::SelfFunction, _) => Ordering::Greater,
(Type::String, Type::String) => Ordering::Equal, (Type::String, Type::String) => Ordering::Equal,
(Type::String { .. }, _) => Ordering::Greater, (Type::String, _) => Ordering::Greater,
(Type::Struct(left_struct), Type::Struct(right_struct)) => { (Type::Struct(left_struct), Type::Struct(right_struct)) => {
left_struct.cmp(right_struct) left_struct.cmp(right_struct)
} }

View File

@ -1,12 +1,11 @@
use tracing::trace; use tracing::trace;
use crate::{ use crate::{
instruction::{InstructionFields, TypeCode}, instruction::InstructionFields,
vm::{call_frame::PointerCache, Register, Thread}, vm::{Register, Thread},
DustString,
}; };
pub fn add_integers(ip: &mut usize, instruction: &InstructionFields, thread: &mut Thread) { pub fn add_integers(_: &mut usize, instruction: &InstructionFields, thread: &mut Thread) {
trace!("ADD: Run and cache pointers"); trace!("ADD: Run and cache pointers");
let destination = instruction.a_field as usize; let destination = instruction.a_field as usize;

View File

@ -1,9 +1,6 @@
use tracing::trace; use tracing::trace;
use crate::{ use crate::{instruction::InstructionFields, vm::Thread};
instruction::InstructionFields,
vm::{call_frame::PointerCache, Thread},
};
pub fn jump(ip: &mut usize, instruction: &InstructionFields, _: &mut Thread) { pub fn jump(ip: &mut usize, instruction: &InstructionFields, _: &mut Thread) {
let offset = instruction.b_field as usize; let offset = instruction.b_field as usize;

View File

@ -1,9 +1,6 @@
use tracing::trace; use tracing::trace;
use crate::{ use crate::{instruction::InstructionFields, vm::Thread};
instruction::{InstructionFields, TypeCode},
vm::{call_frame::PointerCache, Thread},
};
pub fn less_integers(ip: &mut usize, instruction: &InstructionFields, thread: &mut Thread) { pub fn less_integers(ip: &mut usize, instruction: &InstructionFields, thread: &mut Thread) {
trace!("LESS unoptimized"); trace!("LESS unoptimized");

View File

@ -15,7 +15,6 @@ use std::{
use crate::{ use crate::{
instruction::{InstructionFields, TypeCode}, instruction::{InstructionFields, TypeCode},
vm::call_frame::PointerCache,
AbstractList, ConcreteValue, Operation, Value, AbstractList, ConcreteValue, Operation, Value,
}; };
@ -319,8 +318,6 @@ impl Display for Action {
pub type ActionLogic = fn(&mut usize, &InstructionFields, &mut Thread); pub type ActionLogic = fn(&mut usize, &InstructionFields, &mut Thread);
fn no_op(_: &mut usize, _: &InstructionFields, _: &mut Thread) {}
fn point(_: &mut usize, instruction: &InstructionFields, thread: &mut Thread) { fn point(_: &mut usize, instruction: &InstructionFields, thread: &mut Thread) {
let destination = instruction.a_field as usize; let destination = instruction.a_field as usize;
let to = instruction.b_field as usize; let to = instruction.b_field as usize;

View File

@ -1,10 +1,9 @@
use std::{ use std::{
fmt::{self, Debug, Display, Formatter}, fmt::{self, Debug, Display, Formatter},
ptr,
rc::Rc, rc::Rc,
}; };
use smallvec::{SmallVec, smallvec}; use smallvec::{smallvec, SmallVec};
use crate::{AbstractList, Chunk, DustString, Function}; use crate::{AbstractList, Chunk, DustString, Function};
@ -143,26 +142,3 @@ impl Display for Pointer {
} }
} }
} }
#[derive(Debug, Clone, Copy)]
pub struct PointerCache {
pub integer_mut: *mut i64,
pub integer_left: *const i64,
pub integer_right: *const i64,
}
impl PointerCache {
pub fn new() -> Self {
Self {
integer_mut: ptr::null_mut(),
integer_left: ptr::null(),
integer_right: ptr::null(),
}
}
}
impl Default for PointerCache {
fn default() -> Self {
Self::new()
}
}

View File

@ -4,7 +4,7 @@ use tracing::{info, trace};
use crate::{ use crate::{
instruction::InstructionFields, instruction::InstructionFields,
vm::{action::ActionSequence, Action, CallFrame}, vm::{action::ActionSequence, CallFrame},
AbstractList, Chunk, ConcreteValue, DustString, Span, Value, AbstractList, Chunk, ConcreteValue, DustString, Span, Value,
}; };