remove leftover limits from haku-wasm
This commit is contained in:
		
							parent
							
								
									64e2489979
								
							
						
					
					
						commit
						09f2292e62
					
				
					 2 changed files with 9 additions and 22 deletions
				
			
		| 
						 | 
				
			
			@ -6,7 +6,7 @@ use core::{alloc::Layout, mem, ptr, slice};
 | 
			
		|||
 | 
			
		||||
use alloc::{boxed::Box, string::String, vec::Vec};
 | 
			
		||||
use haku::{
 | 
			
		||||
    ast::Ast,
 | 
			
		||||
    ast::{self, Ast},
 | 
			
		||||
    bytecode::{Chunk, Defs, DefsImage, DefsLimits},
 | 
			
		||||
    compiler::{compile_expr, ClosureSpec, CompileError, Compiler, Source},
 | 
			
		||||
    diagnostic::Diagnostic,
 | 
			
		||||
| 
						 | 
				
			
			@ -48,12 +48,6 @@ struct Limits {
 | 
			
		|||
    max_parser_events: usize,
 | 
			
		||||
    ast_capacity: usize,
 | 
			
		||||
    chunk_capacity: usize,
 | 
			
		||||
    stack_capacity: usize,
 | 
			
		||||
    call_stack_capacity: usize,
 | 
			
		||||
    ref_capacity: usize,
 | 
			
		||||
    fuel: usize,
 | 
			
		||||
    memory: usize,
 | 
			
		||||
    render_max_depth: usize,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
impl Default for Limits {
 | 
			
		||||
| 
						 | 
				
			
			@ -67,12 +61,6 @@ impl Default for Limits {
 | 
			
		|||
            max_parser_events: 1024,
 | 
			
		||||
            ast_capacity: 1024,
 | 
			
		||||
            chunk_capacity: 65536,
 | 
			
		||||
            stack_capacity: 1024,
 | 
			
		||||
            call_stack_capacity: 256,
 | 
			
		||||
            ref_capacity: 2048,
 | 
			
		||||
            fuel: 65536,
 | 
			
		||||
            memory: 1024 * 1024,
 | 
			
		||||
            render_max_depth: 256,
 | 
			
		||||
        }
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -112,12 +100,6 @@ limit_setter!(max_tokens);
 | 
			
		|||
limit_setter!(max_parser_events);
 | 
			
		||||
limit_setter!(ast_capacity);
 | 
			
		||||
limit_setter!(chunk_capacity);
 | 
			
		||||
limit_setter!(stack_capacity);
 | 
			
		||||
limit_setter!(call_stack_capacity);
 | 
			
		||||
limit_setter!(ref_capacity);
 | 
			
		||||
limit_setter!(fuel);
 | 
			
		||||
limit_setter!(memory);
 | 
			
		||||
limit_setter!(render_max_depth);
 | 
			
		||||
 | 
			
		||||
#[derive(Debug, Clone)]
 | 
			
		||||
struct Instance {
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
| 
						 | 
				
			
			@ -217,9 +217,14 @@ export class Haku {
 | 
			
		|||
        console.groupCollapsed("construct Haku");
 | 
			
		||||
        {
 | 
			
		||||
            let pLimits = allocCheck(w.haku_limits_new());
 | 
			
		||||
            for (let name of Object.keys(limits)) {
 | 
			
		||||
                w[`haku_limits_set_${name}`](pLimits, limits[name]);
 | 
			
		||||
            }
 | 
			
		||||
            w.haku_limits_set_max_source_code_len(pLimits, limits.max_source_code_len);
 | 
			
		||||
            w.haku_limits_set_max_chunks(pLimits, limits.max_chunks);
 | 
			
		||||
            w.haku_limits_set_max_defs(pLimits, limits.max_defs);
 | 
			
		||||
            w.haku_limits_set_max_tags(pLimits, limits.max_tags);
 | 
			
		||||
            w.haku_limits_set_max_tokens(pLimits, limits.max_tokens);
 | 
			
		||||
            w.haku_limits_set_max_parser_events(pLimits, limits.max_parser_events);
 | 
			
		||||
            w.haku_limits_set_ast_capacity(pLimits, limits.ast_capacity);
 | 
			
		||||
            w.haku_limits_set_chunk_capacity(pLimits, limits.chunk_capacity);
 | 
			
		||||
 | 
			
		||||
            this.#pInstance = allocCheck(w.haku_instance_new(pLimits));
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue