haku: more cleanups: remove old unused VM
also remove some leftover TODOs
This commit is contained in:
parent
c80cd1c7fe
commit
8b464d50f4
17 changed files with 114 additions and 1167 deletions
|
@ -11,6 +11,7 @@ arrayvec = { version = "0.7.4", default-features = false }
|
|||
dlmalloc = { version = "0.2.6", features = ["global"] }
|
||||
haku.workspace = true
|
||||
log.workspace = true
|
||||
tiny-skia = { workspace = true, features = ["no-std-float"] }
|
||||
paste = "1.0.15"
|
||||
|
||||
[features]
|
||||
|
|
|
@ -12,15 +12,14 @@ use haku::{
|
|||
diagnostic::Diagnostic,
|
||||
lexer::{lex, Lexer},
|
||||
parser::{self, IntoAstError, Parser},
|
||||
render::tiny_skia::{
|
||||
BlendMode, Color, FillRule, LineCap, Paint, PathBuilder, Pixmap, PremultipliedColorU8,
|
||||
Rect, Shader, Stroke, Transform,
|
||||
},
|
||||
source::SourceCode,
|
||||
system::{System, SystemImage},
|
||||
token::Lexis,
|
||||
};
|
||||
use log::{debug, info};
|
||||
use tiny_skia::{
|
||||
BlendMode, Color, FillRule, LineCap, Paint, PathBuilder, Pixmap, PremultipliedColorU8, Rect,
|
||||
Shader, Stroke, Transform,
|
||||
};
|
||||
|
||||
pub mod logging;
|
||||
#[cfg(not(feature = "std"))]
|
||||
|
@ -124,8 +123,6 @@ limit_setter!(render_max_depth);
|
|||
struct Instance {
|
||||
limits: Limits,
|
||||
|
||||
system: System,
|
||||
system_image: SystemImage,
|
||||
defs: Defs,
|
||||
defs_image: DefsImage,
|
||||
|
||||
|
@ -152,20 +149,14 @@ unsafe extern "C" fn haku_instance_new(limits: *const Limits) -> *mut Instance {
|
|||
let limits = *limits;
|
||||
debug!("creating new instance with limits: {limits:?}");
|
||||
|
||||
let system = System::new(limits.max_chunks);
|
||||
|
||||
let defs = Defs::new(&DefsLimits {
|
||||
max_defs: limits.max_defs,
|
||||
max_tags: limits.max_tags,
|
||||
});
|
||||
|
||||
let system_image = system.image();
|
||||
let defs_image = defs.image();
|
||||
|
||||
let instance = Box::new(Instance {
|
||||
limits,
|
||||
system,
|
||||
system_image,
|
||||
defs,
|
||||
defs_image,
|
||||
compile_result2: None,
|
||||
|
@ -187,7 +178,6 @@ unsafe extern "C" fn haku_instance_destroy(instance: *mut Instance) {
|
|||
unsafe extern "C" fn haku_reset(instance: *mut Instance) {
|
||||
debug!("resetting instance: {instance:?}");
|
||||
let instance = &mut *instance;
|
||||
instance.system.restore_image(&instance.system_image);
|
||||
instance.defs.restore_image(&instance.defs_image);
|
||||
}
|
||||
|
||||
|
@ -430,11 +420,7 @@ unsafe extern "C" fn haku_compile_brush(
|
|||
ast.len()
|
||||
);
|
||||
|
||||
let src = Source {
|
||||
code,
|
||||
ast: &ast,
|
||||
system: &instance.system,
|
||||
};
|
||||
let src = Source { code, ast: &ast };
|
||||
|
||||
let mut chunk = Chunk::new(instance.limits.chunk_capacity).unwrap();
|
||||
let mut compiler = Compiler::new(&mut instance.defs, &mut chunk);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue