numbl 0.3.3 → 0.4.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/binding.gyp +6 -5
- package/dist-cli/cli.js +63077 -42047
- package/dist-lib/graphics/types.d.ts +40 -1
- package/dist-lib/lib.d.ts +0 -1
- package/dist-lib/lib.js +78446 -57671
- package/dist-lib/numbl-core/executeCode.d.ts +10 -12
- package/dist-lib/numbl-core/executors/classification.d.ts +134 -0
- package/dist-lib/numbl-core/executors/handleInline.d.ts +42 -0
- package/dist-lib/numbl-core/executors/index.d.ts +0 -3
- package/dist-lib/numbl-core/executors/jit/cJitCallExecutor.d.ts +35 -0
- package/dist-lib/numbl-core/executors/jit/cJitLoopExecutor.d.ts +31 -0
- package/dist-lib/numbl-core/executors/jit/cJitTopLevelExecutor.d.ts +29 -0
- package/dist-lib/numbl-core/executors/jit/callExecutor.d.ts +45 -0
- package/dist-lib/numbl-core/executors/jit/compileC.d.ts +51 -0
- package/dist-lib/numbl-core/executors/jit/compileC.node.d.ts +25 -0
- package/dist-lib/numbl-core/executors/jit/hostHelpers.d.ts +27 -0
- package/dist-lib/numbl-core/executors/jit/loopExecutor.d.ts +41 -0
- package/dist-lib/numbl-core/executors/jit/session.d.ts +17 -0
- package/dist-lib/numbl-core/executors/jit/topLevelExecutor.d.ts +36 -0
- package/dist-lib/numbl-core/executors/jit/typeAdapter.d.ts +28 -0
- package/dist-lib/numbl-core/executors/jit/typeAdapterC.d.ts +73 -0
- package/dist-lib/numbl-core/executors/jit/valueAdapter.d.ts +48 -0
- package/dist-lib/numbl-core/executors/jit/valueAdapterC.d.ts +108 -0
- package/dist-lib/numbl-core/executors/lowering.d.ts +31 -77
- package/dist-lib/numbl-core/executors/plugins.d.ts +14 -21
- package/dist-lib/numbl-core/helpers/reduction-helpers.d.ts +4 -1
- package/dist-lib/numbl-core/interpreter/builtins/index.d.ts +1 -1
- package/dist-lib/numbl-core/interpreter/builtins/types.d.ts +0 -18
- package/dist-lib/numbl-core/interpreter/interpreter.d.ts +37 -21
- package/dist-lib/numbl-core/interpreter/interpreterExec.d.ts +6 -0
- package/dist-lib/numbl-core/interpreter/interpreterFunctions.d.ts +13 -1
- package/dist-lib/numbl-core/interpreter/interpreterSpecialBuiltins.d.ts +1 -1
- package/dist-lib/numbl-core/jit/builtins/defs/_shared.d.ts +43 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/_elemwise.d.ts +123 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/minus.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mpower.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mrdivide.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/mtimes.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/plus.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/power.d.ts +30 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/rdivide.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/times.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/arithmetic/uminus.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/_compare.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/eq.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/ge.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/gt.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/le.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/lt.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/compare/ne.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/diag/assert.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/_format_args.d.ts +17 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/disp.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/error.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/fprintf.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/sprintf.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/io/warning.d.ts +15 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/_shortcircuit.d.ts +30 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/_unary_pred.d.ts +30 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/and.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/andand.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/boolconst.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/classBuiltin.d.ts +21 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/fieldnames.d.ts +15 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isa.d.ts +13 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/iscell.d.ts +8 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isempty.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isequal.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isfield.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isinf.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isnan.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isnumeric.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isreal.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isscalar.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/isstruct.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/logical.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/not.d.ts +15 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/or.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/oror.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/strcmp.d.ts +21 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/typequery.d.ts +10 -0
- package/dist-lib/numbl-core/jit/builtins/defs/logical/xor.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/_complex_fold.d.ts +34 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/_unary_real.d.ts +51 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/abs.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/angle.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/asinh.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/atan.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/atan2.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/besselh.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/ceil.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/conj.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/constants.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/cos.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/cosh.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/dot.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/double.d.ts +28 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/exp.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/fix.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/floor.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/hypot.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/imag.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/linspace.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/log.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/log10.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/log2.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/logspace.d.ts +8 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/mod.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/norm.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/real.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/rem.d.ts +3 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/round.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/sign.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/sin.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/sinh.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/sqrt.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/tan.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/tanh.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/math/uniquetol.d.ts +22 -0
- package/dist-lib/numbl-core/jit/builtins/defs/plot/dispatch.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/_cumulative.d.ts +49 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/_shape.d.ts +126 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/_variance.d.ts +17 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/all.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/any.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/cummax.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/cummin.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/cumprod.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/cumsum.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/diff.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/length.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/max.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/mean.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/min.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/numel.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/prod.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/std.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/sum.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/reduction/var.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/_construct.d.ts +67 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/_triangular.d.ts +34 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/cat.d.ts +33 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/diag.d.ts +29 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/eye.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/flip.d.ts +7 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/meshgrid.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/ones.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/repmat.d.ts +37 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/reshape.d.ts +39 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/size.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/sort.d.ts +19 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/transpose.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/tril.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/triu.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/defs/shape/zeros.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/deal.d.ts +20 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/feval.d.ts +36 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/pathBuiltins.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/tic.d.ts +8 -0
- package/dist-lib/numbl-core/jit/builtins/defs/system/toc.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/index.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/registry.d.ts +138 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/cell/cell.d.ts +24 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/indexing/loop_count.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/indexing/range_value.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/indexing/scalar_index.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/indexing/tensor_make_range.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/assert_fmt.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_complex.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_double.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_struct.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_tensor.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/disp_tensor_complex.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/error_fmt.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/format_complex.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/format_double.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/format_engine.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/fprintf.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/sprintf.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/io/warning_fmt.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/plot/plot_dispatch.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/snippets.gen.d.ts +86 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/system/cdiv.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/system/cscalar.d.ts +103 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/system/deep_clone.d.ts +1 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/system/isequal.d.ts +2 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/system/tictoc.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_nd.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_alloc_nd_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_copy_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_matrix.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_matrix_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_row.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor/tensor_from_row_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_cat.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_cumulative.d.ts +32 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_diag.d.ts +33 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_diff.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_dot.d.ts +16 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_complex.d.ts +90 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real.d.ts +75 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_elemwise_real_fn.d.ts +95 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_eye.d.ts +10 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_fill_nd.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_fill_square.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_flip.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_linspace.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_logical_real.d.ts +10 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_logspace.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_meshgrid.d.ts +29 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_mtimes_complex.d.ts +10 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_mtimes_real.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_norm.d.ts +4 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_ones_nd.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_ones_square.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_predicate.d.ts +42 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_complex.d.ts +53 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reduce_real.d.ts +42 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_repmat.d.ts +11 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reshape_nd.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_reshape_nd_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_size.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_sort_real.d.ts +36 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_transpose.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_transpose_complex.d.ts +6 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_triangular.d.ts +22 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_complex_math.d.ts +128 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_unary_real_math.d.ts +95 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_uniquetol.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_var.d.ts +12 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_zeros_nd.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/tensor_ops/tensor_zeros_square.d.ts +5 -0
- package/dist-lib/numbl-core/jit/builtins/runtime/text/strcmp.d.ts +2 -0
- package/dist-lib/numbl-core/jit/codegen/cFormat.d.ts +36 -0
- package/dist-lib/numbl-core/jit/codegen/cHelpers.d.ts +48 -0
- package/dist-lib/numbl-core/jit/codegen/emit.d.ts +55 -0
- package/dist-lib/numbl-core/jit/codegen/emitCellTypedef.d.ts +23 -0
- package/dist-lib/numbl-core/jit/codegen/emitExpr.d.ts +33 -0
- package/dist-lib/numbl-core/jit/codegen/emitIndex.d.ts +56 -0
- package/dist-lib/numbl-core/jit/codegen/emitJs.d.ts +64 -0
- package/dist-lib/numbl-core/jit/codegen/emitNamedTypedef.d.ts +58 -0
- package/dist-lib/numbl-core/jit/codegen/emitStmt.d.ts +76 -0
- package/dist-lib/numbl-core/jit/codegen/emitTensorConcat.d.ts +23 -0
- package/dist-lib/numbl-core/jit/codegen/emitTensorConcatJs.d.ts +16 -0
- package/dist-lib/numbl-core/jit/codegen/emitTensorFused.d.ts +77 -0
- package/dist-lib/numbl-core/jit/codegen/inlinePass.d.ts +66 -0
- package/dist-lib/numbl-core/jit/codegen/liveness.d.ts +58 -0
- package/dist-lib/numbl-core/jit/codegen/prettyIR.d.ts +24 -0
- package/dist-lib/numbl-core/jit/codegen/runtime.d.ts +150 -0
- package/dist-lib/numbl-core/jit/compileSpec.d.ts +84 -0
- package/dist-lib/numbl-core/jit/compileSpecC.d.ts +93 -0
- package/dist-lib/numbl-core/jit/index.d.ts +15 -0
- package/dist-lib/numbl-core/jit/lowering/classDefs.d.ts +109 -0
- package/dist-lib/numbl-core/jit/lowering/errors.d.ts +35 -0
- package/dist-lib/numbl-core/jit/lowering/indexFold.d.ts +31 -0
- package/dist-lib/numbl-core/jit/lowering/indexResolve.d.ts +100 -0
- package/dist-lib/numbl-core/jit/lowering/ir.d.ts +584 -0
- package/dist-lib/numbl-core/jit/lowering/lower.d.ts +271 -0
- package/dist-lib/numbl-core/jit/lowering/lowerCellIndex.d.ts +41 -0
- package/dist-lib/numbl-core/jit/lowering/lowerCellLit.d.ts +19 -0
- package/dist-lib/numbl-core/jit/lowering/lowerClassConstructor.d.ts +55 -0
- package/dist-lib/numbl-core/jit/lowering/lowerFuncCall.d.ts +34 -0
- package/dist-lib/numbl-core/jit/lowering/lowerHandle.d.ts +57 -0
- package/dist-lib/numbl-core/jit/lowering/lowerIndexLoad.d.ts +16 -0
- package/dist-lib/numbl-core/jit/lowering/lowerIndexSlice.d.ts +29 -0
- package/dist-lib/numbl-core/jit/lowering/lowerIndexSliceStore.d.ts +19 -0
- package/dist-lib/numbl-core/jit/lowering/lowerIndexStore.d.ts +14 -0
- package/dist-lib/numbl-core/jit/lowering/lowerMethodCall.d.ts +45 -0
- package/dist-lib/numbl-core/jit/lowering/lowerMultiAssign.d.ts +36 -0
- package/dist-lib/numbl-core/jit/lowering/lowerTensorLit.d.ts +25 -0
- package/dist-lib/numbl-core/jit/lowering/rangeCount.d.ts +19 -0
- package/dist-lib/numbl-core/jit/lowering/specialize.d.ts +93 -0
- package/dist-lib/numbl-core/jit/lowering/types.d.ts +503 -0
- package/dist-lib/numbl-core/jit/lowering/walk.d.ts +17 -0
- package/dist-lib/numbl-core/jit/numbl/index.d.ts +30 -0
- package/dist-lib/numbl-core/jit/parser/astUtils.d.ts +43 -0
- package/dist-lib/numbl-core/jit/parser/index.d.ts +12 -0
- package/dist-lib/numbl-core/jit/parser/sourceLoc.d.ts +12 -0
- package/dist-lib/numbl-core/jit/runtime/context.d.ts +23 -0
- package/dist-lib/numbl-core/jit/runtime/inferType.d.ts +10 -0
- package/dist-lib/numbl-core/jit/runtime/value.d.ts +101 -0
- package/dist-lib/numbl-core/jit/workspace/driverPrologue.d.ts +59 -0
- package/dist-lib/numbl-core/jit/workspace/mtoc2UserFunctionLoader.d.ts +62 -0
- package/dist-lib/numbl-core/jit/workspace/workspace.d.ts +243 -0
- package/dist-lib/numbl-core/jitTypes.d.ts +7 -321
- package/dist-lib/numbl-core/jsUserFunctions.d.ts +2 -2
- package/dist-lib/numbl-core/parser/ClassParser.d.ts +3 -0
- package/dist-lib/numbl-core/runtime/index.d.ts +1 -1
- package/dist-lib/numbl-core/runtime/indexing.d.ts +11 -1
- package/dist-lib/numbl-core/runtime/plotUtils.d.ts +28 -2
- package/dist-lib/numbl-core/runtime/runtime.d.ts +16 -1
- package/dist-lib/numbl-core/runtime/runtimePlot.d.ts +5 -0
- package/dist-lib/numbl-core/runtime/types.d.ts +19 -3
- package/dist-lib/numbl-core/version.d.ts +1 -1
- package/dist-lib/numbl-core/workspace/types.d.ts +8 -0
- package/dist-plot-viewer/assets/index-DfxsWeyf.js +4426 -0
- package/dist-plot-viewer/index.html +1 -1
- package/dist-site-viewer/404.html +33 -0
- package/dist-site-viewer/assets/index-C5c2lKAx.js +4748 -0
- package/dist-site-viewer/assets/index-D5YY8PKx.css +1 -0
- package/dist-site-viewer/assets/numbl-worker-CkoM4MUa.js +11836 -0
- package/dist-site-viewer/coi-serviceworker.js +70 -0
- package/dist-site-viewer/favicon.svg +23 -0
- package/dist-site-viewer/index.html +16 -0
- package/dist-site-viewer/logo.svg +26 -0
- package/dist-site-viewer/numbl-embed.js +111 -0
- package/dist-site-viewer/vite.svg +1 -0
- package/native/ops/real_unary_elemwise.c +3 -1
- package/package.json +15 -9
- package/dist-lib/numbl-core/executors/cJit/builtins.d.ts +0 -30
- package/dist-lib/numbl-core/executors/cJit/chainCodegen.d.ts +0 -59
- package/dist-lib/numbl-core/executors/cJit/chainExecutor.d.ts +0 -27
- package/dist-lib/numbl-core/executors/cJit/chainPass.d.ts +0 -42
- package/dist-lib/numbl-core/executors/cJit/codegen.d.ts +0 -44
- package/dist-lib/numbl-core/executors/cJit/compile.d.ts +0 -45
- package/dist-lib/numbl-core/executors/cJit/elemwiseCodegen.d.ts +0 -23
- package/dist-lib/numbl-core/executors/cJit/elemwiseStructural.d.ts +0 -33
- package/dist-lib/numbl-core/executors/cJit/fuseAnalyze.d.ts +0 -39
- package/dist-lib/numbl-core/executors/cJit/fuseCodegen.d.ts +0 -16
- package/dist-lib/numbl-core/executors/cJit/fuseExecutor.d.ts +0 -28
- package/dist-lib/numbl-core/executors/cJit/loopExecutor.d.ts +0 -32
- package/dist-lib/numbl-core/executors/cJit/register.d.ts +0 -10
- package/dist-lib/numbl-core/executors/cJit/whitelist.d.ts +0 -15
- package/dist-lib/numbl-core/executors/jsJit/callExecutor.d.ts +0 -25
- package/dist-lib/numbl-core/executors/jsJit/codegen/jitCodegen.d.ts +0 -7
- package/dist-lib/numbl-core/executors/jsJit/codegen/jitCodegenHoist.d.ts +0 -70
- package/dist-lib/numbl-core/executors/jsJit/codegen/jsMultiReduction.d.ts +0 -67
- package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpers.d.ts +0 -34
- package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersComplex.d.ts +0 -21
- package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersIndex.d.ts +0 -33
- package/dist-lib/numbl-core/executors/jsJit/helpers/jitHelpersTensor.d.ts +0 -34
- package/dist-lib/numbl-core/executors/jsJit/jitCall.d.ts +0 -59
- package/dist-lib/numbl-core/executors/jsJit/jitLoop.d.ts +0 -53
- package/dist-lib/numbl-core/executors/jsJit/jitTopLevel.d.ts +0 -44
- package/dist-lib/numbl-core/executors/jsJit/loopExecutor.d.ts +0 -15
- package/dist-lib/numbl-core/executors/jsJit/lower/blockAnalysis.d.ts +0 -37
- package/dist-lib/numbl-core/executors/jsJit/lower/jitBailSafety.d.ts +0 -41
- package/dist-lib/numbl-core/executors/jsJit/lower/jitLower.d.ts +0 -136
- package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerExpr.d.ts +0 -36
- package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerStmt.d.ts +0 -9
- package/dist-lib/numbl-core/executors/jsJit/lower/jitLowerTypes.d.ts +0 -29
- package/dist-lib/numbl-core/executors/jsJit/lower/scalarEmit.d.ts +0 -58
- package/dist-lib/numbl-core/executors/jsJit/shared.d.ts +0 -120
- package/dist-lib/numbl-core/executors/jsJit/topLevelExecutor.d.ts +0 -17
- package/dist-plot-viewer/assets/index-COAM8o1E.js +0 -4426
- /package/dist-lib/numbl-core/{executors/jsJit/helpers → runtime}/alloc.d.ts +0 -0
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Static AST analysis to determine input/output variables for loop JIT.
|
|
3
|
-
*
|
|
4
|
-
* Walks the loop body (and condition for while) to collect:
|
|
5
|
-
* - assigned: variables written inside the loop
|
|
6
|
-
* - referenced: variables read inside the loop
|
|
7
|
-
* - hasReturn: whether the loop body contains a return statement
|
|
8
|
-
*/
|
|
9
|
-
import type { Stmt } from "../../../parser/types.js";
|
|
10
|
-
export interface BlockVarInfo {
|
|
11
|
-
/** Variables referenced in the loop that must come from enclosing scope */
|
|
12
|
-
inputs: string[];
|
|
13
|
-
/** Variables assigned in the loop body (written back after JIT execution) */
|
|
14
|
-
outputs: string[];
|
|
15
|
-
/** Whether the loop body contains a return statement (skip JIT if true) */
|
|
16
|
-
hasReturn: boolean;
|
|
17
|
-
}
|
|
18
|
-
/** Analyze a for loop statement for JIT compilation. */
|
|
19
|
-
export declare function analyzeForLoop(stmt: Stmt & {
|
|
20
|
-
type: "For";
|
|
21
|
-
}): BlockVarInfo;
|
|
22
|
-
/**
|
|
23
|
-
* Collect the names of all variables read in a sibling-tail starting at
|
|
24
|
-
* `startIdx` of the given stmt list. Used by the loop JIT to filter the
|
|
25
|
-
* loop's output set so that loop-internal temporaries don't get written
|
|
26
|
-
* back when no later code reads them.
|
|
27
|
-
*/
|
|
28
|
-
export declare function collectReadsFromSiblings(stmts: Stmt[], startIdx: number, out: Set<string>): void;
|
|
29
|
-
/**
|
|
30
|
-
* Analyze a top-level script body (list of statements) for JIT compilation.
|
|
31
|
-
* Used by `tryJitTopLevel` to wrap the whole main script as a synthetic fn.
|
|
32
|
-
*/
|
|
33
|
-
export declare function analyzeTopLevel(stmts: Stmt[]): BlockVarInfo;
|
|
34
|
-
/** Analyze a while loop statement for JIT compilation. */
|
|
35
|
-
export declare function analyzeWhileLoop(stmt: Stmt & {
|
|
36
|
-
type: "While";
|
|
37
|
-
}): BlockVarInfo;
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Bail-safety gate for JIT bodies that contain I/O side effects.
|
|
3
|
-
*
|
|
4
|
-
* Mid-execution bails (JitBailToInterpreter / JitFuncHandleBailError)
|
|
5
|
-
* cause the interpreter to re-run the body from the top. If the body
|
|
6
|
-
* already emitted I/O before the bail, that output gets duplicated —
|
|
7
|
-
* which the user would notice.
|
|
8
|
-
*
|
|
9
|
-
* Rule: a body with any I/O statement may only be JIT-compiled if we
|
|
10
|
-
* can prove no bail can happen during execution. If there's no I/O,
|
|
11
|
-
* the body can be JIT'd normally (a bail just restarts silently).
|
|
12
|
-
*
|
|
13
|
-
* Walkers are IR-level — they see the actual lowered constructs that
|
|
14
|
-
* map 1:1 to runtime bail sites. The walkers recurse into the bodies
|
|
15
|
-
* of `UserCall`-ed functions (via `generatedIRBodies`), since a bail
|
|
16
|
-
* inside a callee still forces the caller to re-run.
|
|
17
|
-
*/
|
|
18
|
-
import type { JitStmt } from "../../../jitTypes.js";
|
|
19
|
-
import type { GeneratedFn } from "./jitLower.js";
|
|
20
|
-
/**
|
|
21
|
-
* Names of I/O-emitting builtins that the JIT is willing to lower as
|
|
22
|
-
* ExprStmt calls. Any `Call` to one of these in the lowered IR marks
|
|
23
|
-
* the body as having observable I/O.
|
|
24
|
-
*/
|
|
25
|
-
export declare const JIT_IO_BUILTINS: Set<string>;
|
|
26
|
-
/**
|
|
27
|
-
* Walk a body + its transitively called function bodies and return
|
|
28
|
-
* whether the combined execution graph contains an I/O call.
|
|
29
|
-
*/
|
|
30
|
-
export declare function irHasIO(body: JitStmt[], generatedIRBodies: Map<string, GeneratedFn>): boolean;
|
|
31
|
-
/**
|
|
32
|
-
* Walk a body + its transitively called function bodies and return
|
|
33
|
-
* whether any construct exists that can throw `JitBailToInterpreter`
|
|
34
|
-
* or `JitFuncHandleBailError` at runtime.
|
|
35
|
-
*
|
|
36
|
-
* Bail-risky constructs:
|
|
37
|
-
* - AssignIndex / AssignIndexCol: may bail on out-of-bounds grow.
|
|
38
|
-
* - FuncHandleCall / UserDispatchCall: return-type check may bail.
|
|
39
|
-
* - UserCall: recurse into callee body.
|
|
40
|
-
*/
|
|
41
|
-
export declare function irHasBailRisk(body: JitStmt[], generatedIRBodies: Map<string, GeneratedFn>): boolean;
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* AST -> JIT IR lowering with type propagation. Orchestrator that owns
|
|
3
|
-
* the shared context types (LowerCtx, SliceAlias), the public result
|
|
4
|
-
* types (GeneratedFn, LoweringResult), and the `lowerFunction` entry
|
|
5
|
-
* point. Actual statement and expression lowering lives in
|
|
6
|
-
* jitLowerStmt.ts and jitLowerExpr.ts; type-level helpers are in
|
|
7
|
-
* jitLowerTypes.ts.
|
|
8
|
-
*
|
|
9
|
-
* Returns null if any unsupported construct is encountered, causing the
|
|
10
|
-
* entire function to fall back to interpretation.
|
|
11
|
-
*/
|
|
12
|
-
import type { FunctionDef } from "../../../interpreter/types.js";
|
|
13
|
-
import type { Interpreter } from "../../../interpreter/interpreter.js";
|
|
14
|
-
import type { JitType, JitExpr, JitStmt } from "../../../jitTypes.js";
|
|
15
|
-
import { type TypeEnv } from "./jitLowerTypes.js";
|
|
16
|
-
/**
|
|
17
|
-
* Lowered IR for a user function reached during a top-level lowering.
|
|
18
|
-
*
|
|
19
|
-
* JS-JIT caches the callee as generated JS source in `generatedFns` and
|
|
20
|
-
* is done. C-JIT needs to re-analyze the callee's IR (for recursive
|
|
21
|
-
* feasibility + emitting a static C function per callee), so we also
|
|
22
|
-
* cache the raw IR here. One entry per unique `jitName`; matches the
|
|
23
|
-
* JS-JIT specialization key.
|
|
24
|
-
*/
|
|
25
|
-
export interface GeneratedFn {
|
|
26
|
-
fn: FunctionDef;
|
|
27
|
-
argTypes: JitType[];
|
|
28
|
-
outputNames: string[];
|
|
29
|
-
outputTypes: JitType[];
|
|
30
|
-
body: JitStmt[];
|
|
31
|
-
localVars: Set<string>;
|
|
32
|
-
nargout: number;
|
|
33
|
-
}
|
|
34
|
-
export interface LoweringResult {
|
|
35
|
-
body: JitStmt[];
|
|
36
|
-
outputNames: string[];
|
|
37
|
-
localVars: Set<string>;
|
|
38
|
-
hasTensorOps: boolean;
|
|
39
|
-
/** Generated JS code for called user functions: jitName → code */
|
|
40
|
-
generatedFns: Map<string, string>;
|
|
41
|
-
/** Lowered IR for called user functions: jitName → IR + metadata.
|
|
42
|
-
* Populated alongside `generatedFns` by `lowerUserFuncCall`; the
|
|
43
|
-
* C-JIT uses it for recursive feasibility and per-callee C emission. */
|
|
44
|
-
generatedIRBodies: Map<string, GeneratedFn>;
|
|
45
|
-
/** Type of the first output variable after lowering */
|
|
46
|
-
outputType: JitType | null;
|
|
47
|
-
/** Types of all output variables in outputNames order. Mirrors the
|
|
48
|
-
* shape of JS-JIT's `return [out0, out1, ...]`. */
|
|
49
|
-
outputTypes: JitType[];
|
|
50
|
-
/** Final typed environment after lowering the body. The hybrid
|
|
51
|
-
* loop-extraction pass uses this to look up live-in/live-out var
|
|
52
|
-
* types without re-running type inference. */
|
|
53
|
-
endEnv: TypeEnv;
|
|
54
|
-
}
|
|
55
|
-
/**
|
|
56
|
-
* A "slice alias" records that a MATLAB local was bound to a colon-slice of
|
|
57
|
-
* a real tensor (e.g. `pt = pts(:, i)`). Rather than materializing the slice
|
|
58
|
-
* as a RuntimeTensor per iteration, we remember the base tensor and a
|
|
59
|
-
* per-dim "template" of indices — scalar expressions captured at bind time
|
|
60
|
-
* for the non-colon dims, and `"colon"` placeholders for the colon dims.
|
|
61
|
-
* Subsequent reads like `pt(k)` substitute `k` into the colon positions and
|
|
62
|
-
* emit a direct scalar read on the base tensor, which compiles cleanly
|
|
63
|
-
* through the existing hoisted `idx{1,2,3}r_h` fast path.
|
|
64
|
-
*/
|
|
65
|
-
export interface SliceAlias {
|
|
66
|
-
baseName: string;
|
|
67
|
-
baseType: JitType;
|
|
68
|
-
/**
|
|
69
|
-
* One entry per index of the original bind expression, in source order.
|
|
70
|
-
* A `"colon"` slot expects to be filled by the read-site's colon indices.
|
|
71
|
-
* An `"expr"` slot carries a JitExpr that will be substituted as-is.
|
|
72
|
-
*/
|
|
73
|
-
template: ({
|
|
74
|
-
kind: "colon";
|
|
75
|
-
} | {
|
|
76
|
-
kind: "expr";
|
|
77
|
-
expr: JitExpr;
|
|
78
|
-
})[];
|
|
79
|
-
/** Sizes of the slice's colon dimensions, in source order. */
|
|
80
|
-
sliceShape: number[];
|
|
81
|
-
/** Indices into `template` where colon slots live, in source order. */
|
|
82
|
-
colonPositions: number[];
|
|
83
|
-
}
|
|
84
|
-
export interface LowerCtx {
|
|
85
|
-
env: TypeEnv;
|
|
86
|
-
localVars: Set<string>;
|
|
87
|
-
params: Set<string>;
|
|
88
|
-
/** First bail reason encountered during lowering; lets callers surface
|
|
89
|
-
* a hint for why JS-JIT declined a function (purely diagnostic, only
|
|
90
|
-
* consulted by the `NUMBL_LOG_CJIT_MISSES` tally). Writes should use
|
|
91
|
-
* `setBailReason()` which is idempotent — only the first reason sticks. */
|
|
92
|
-
bailReason?: string;
|
|
93
|
-
bailLine?: number;
|
|
94
|
-
/** Type of the deepest expr whose lowering was attempted — used as a
|
|
95
|
-
* last-resort bail reason hint when no more specific reason was set. */
|
|
96
|
-
lastExprType?: string;
|
|
97
|
-
lastExprLine?: number;
|
|
98
|
-
/** Variables that are actually assigned in the function body. */
|
|
99
|
-
assignedVars: Set<string>;
|
|
100
|
-
/**
|
|
101
|
-
* Map from a MATLAB local name to its slice alias, if any. A name is
|
|
102
|
-
* present here iff the most recent assignment to it was a whole-tensor
|
|
103
|
-
* colon slice. Reads of the name as a plain Ident bail; reads of
|
|
104
|
-
* `name(...)` substitute through the template and emit a direct scalar
|
|
105
|
-
* read of the base tensor. See `tryLowerAsSliceBind`.
|
|
106
|
-
*/
|
|
107
|
-
sliceAliases: Map<string, SliceAlias>;
|
|
108
|
-
_hasTensorOps?: boolean;
|
|
109
|
-
interp?: Interpreter;
|
|
110
|
-
/** The nargout this specialization was requested with — inlined wherever
|
|
111
|
-
* the body reads the `nargout` identifier, since the JIT specializes per
|
|
112
|
-
* nargout already. */
|
|
113
|
-
nargout?: number;
|
|
114
|
-
/** The nargin this specialization was requested with. Set whenever the
|
|
115
|
-
* function is varargin (the call shape pins down nargin per spec).
|
|
116
|
-
* Reads of bare `nargin` get inlined to this constant; `nargin > K`
|
|
117
|
-
* guards then constant-fold so dead branches don't have to lower. */
|
|
118
|
-
nargin?: number;
|
|
119
|
-
/** Number of variadic args bound for this specialization (0 for
|
|
120
|
-
* non-varargin callees). Used by `varargin{i}` lowering to redirect to
|
|
121
|
-
* the synthetic `$va_*` param holding the i-th variadic arg. The
|
|
122
|
-
* varargin lowering only needs the count — the synthetic name is
|
|
123
|
-
* derived from the literal index alone. */
|
|
124
|
-
nVarargin?: number;
|
|
125
|
-
generatedFns: Map<string, string>;
|
|
126
|
-
generatedIRBodies: Map<string, GeneratedFn>;
|
|
127
|
-
loweringInProgress: Set<string>;
|
|
128
|
-
/** Pre-built line break table for offset→line lookup. */
|
|
129
|
-
lineTable?: number[];
|
|
130
|
-
}
|
|
131
|
-
/** Idempotent bail-reason setter. Only the first reason per function sticks. */
|
|
132
|
-
export declare function setBailReason(ctx: LowerCtx, reason: string, line?: number): void;
|
|
133
|
-
export declare function lowerFunction(fn: FunctionDef, argTypes: JitType[], nargout: number, interp?: Interpreter, generatedFns?: Map<string, string>, loweringInProgress?: Set<string>, generatedIRBodies?: Map<string, GeneratedFn>, varargs?: {
|
|
134
|
-
effectiveParams: string[];
|
|
135
|
-
nVarargin: number;
|
|
136
|
-
}): LoweringResult | null;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Expression lowering for the JIT. Paired with jitLowerStmt.ts; the two
|
|
3
|
-
* sides are mutually recursive (stmt bodies contain exprs; function-call
|
|
4
|
-
* exprs may trigger nested lowering of a callee's body). jitLower.ts is
|
|
5
|
-
* the orchestrator that ties them together via LowerCtx + lowerFunction.
|
|
6
|
-
*/
|
|
7
|
-
import type { Expr } from "../../../parser/types.js";
|
|
8
|
-
import type { Interpreter } from "../../../interpreter/interpreter.js";
|
|
9
|
-
import { type JitType, type JitExpr } from "../../../jitTypes.js";
|
|
10
|
-
import type { LowerCtx } from "./jitLower.js";
|
|
11
|
-
export declare function lowerExpr(ctx: LowerCtx, expr: Expr): JitExpr | null;
|
|
12
|
-
/**
|
|
13
|
-
* Stage 21: lower `src(a:b)` on a real-tensor base into a
|
|
14
|
-
* `RangeSliceRead` IR node producing a fresh column-vector tensor.
|
|
15
|
-
*
|
|
16
|
-
* Accepts `Range` with no step (default step 1). `start` and `end`
|
|
17
|
-
* must lower to numeric/boolean scalar exprs. The result is a real
|
|
18
|
-
* tensor with shape `[?, 1]` — the exact length is runtime-dependent.
|
|
19
|
-
*
|
|
20
|
-
* Caller responsibility: match the parent expression shape
|
|
21
|
-
* `Index(Ident(src), [Range])` or `FuncCall(src, [Range])` before
|
|
22
|
-
* calling. Returns null if the source isn't a real tensor or the
|
|
23
|
-
* range isn't the expected shape.
|
|
24
|
-
*/
|
|
25
|
-
export declare function tryLowerRangeSliceRead(ctx: LowerCtx, baseName: string, rangeExpr: Expr): JitExpr | null;
|
|
26
|
-
export declare function lowerIBuiltinCall(ctx: LowerCtx, expr: Expr & {
|
|
27
|
-
type: "FuncCall";
|
|
28
|
-
}): JitExpr | null;
|
|
29
|
-
/**
|
|
30
|
-
* Multi-output variant of probeFuncHandleReturnType. Calls the handle
|
|
31
|
-
* with the requested nargout and returns one JitType per output. Bails
|
|
32
|
-
* (returns null) on the same conditions as the single-output probe
|
|
33
|
-
* (handle without jsFn, args we can't synthesize, output containing
|
|
34
|
-
* unknown), or when the result isn't an array of the expected length.
|
|
35
|
-
*/
|
|
36
|
-
export declare function probeFuncHandleMultiReturnTypes(interp: Interpreter, fnName: string, loweredArgs: JitExpr[], nargout: number): JitType[] | null;
|
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Statement lowering for the JIT. Paired with jitLowerExpr.ts; the two
|
|
3
|
-
* sides are mutually recursive. jitLower.ts is the orchestrator that ties
|
|
4
|
-
* them together via LowerCtx + lowerFunction.
|
|
5
|
-
*/
|
|
6
|
-
import type { Stmt } from "../../../parser/types.js";
|
|
7
|
-
import { type JitStmt } from "../../../jitTypes.js";
|
|
8
|
-
import type { LowerCtx } from "./jitLower.js";
|
|
9
|
-
export declare function lowerStmts(ctx: LowerCtx, stmts: Stmt[]): JitStmt[] | null;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Type-level helpers for the JIT lowering pass.
|
|
3
|
-
*
|
|
4
|
-
* Pure functions for:
|
|
5
|
-
* - Sign algebra (how signs combine through arithmetic)
|
|
6
|
-
* - Binary/unary operation result type inference
|
|
7
|
-
* - Type environment management (clone, merge, equality)
|
|
8
|
-
* - Known MATLAB constants
|
|
9
|
-
*
|
|
10
|
-
* These have no dependency on LowerCtx or the lowering state.
|
|
11
|
-
*/
|
|
12
|
-
import { BinaryOperation, UnaryOperation } from "../../../parser/types.js";
|
|
13
|
-
import { type JitExpr, type JitType, type SignCategory } from "../../../jitTypes.js";
|
|
14
|
-
export declare const KNOWN_CONSTANTS: Record<string, number>;
|
|
15
|
-
export type TypeEnv = Map<string, JitType>;
|
|
16
|
-
export declare function cloneEnv(env: TypeEnv): TypeEnv;
|
|
17
|
-
/** Merge two type environments at a join point. Returns null if any type becomes unknown. */
|
|
18
|
-
export declare function mergeEnvs(a: TypeEnv, b: TypeEnv): TypeEnv | null;
|
|
19
|
-
/** Check if two type environments are identical (by JSON comparison). */
|
|
20
|
-
export declare function envsEqual(a: TypeEnv, b: TypeEnv): boolean;
|
|
21
|
-
export declare function addSigns(a: SignCategory, b: SignCategory): SignCategory | undefined;
|
|
22
|
-
export declare function mulSigns(a: SignCategory, b: SignCategory): SignCategory | undefined;
|
|
23
|
-
export declare function combineSigns(a: SignCategory | undefined, b: SignCategory | undefined, op: BinaryOperation): SignCategory | undefined;
|
|
24
|
-
export declare function binaryResultType(op: BinaryOperation, left: JitType, right: JitType,
|
|
25
|
-
/** Lowered operand exprs. Optional because tests / older callers pass
|
|
26
|
-
* only types. When provided, enables structural nonneg detection for
|
|
27
|
-
* patterns like `x .* x` that the type-only path can't see. */
|
|
28
|
-
leftExpr?: JitExpr, rightExpr?: JitExpr): JitType | null;
|
|
29
|
-
export declare function unaryResultType(op: UnaryOperation, operand: JitType): JitType | null;
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared scalar-expression emission used by both the JS-JIT and C-JIT
|
|
3
|
-
* backends.
|
|
4
|
-
*
|
|
5
|
-
* The value-form switches for scalar Binary/Unary and the truthiness
|
|
6
|
-
* walker have identical IR traversal between the two backends — only
|
|
7
|
-
* the leaf syntax (operator spelling, coercion rules) differs. A
|
|
8
|
-
* backend supplies a `ScalarOpTarget` describing how to spell each op,
|
|
9
|
-
* and the shared functions below handle the dispatch.
|
|
10
|
-
*
|
|
11
|
-
* Complex-scalar and tensor ops are *not* covered here — those remain
|
|
12
|
-
* backend-specific (JS uses `$h.cAdd` etc.; C-JIT bails on complex).
|
|
13
|
-
*/
|
|
14
|
-
import { BinaryOperation, UnaryOperation } from "../../../parser/types.js";
|
|
15
|
-
import type { JitExpr } from "../../../jitTypes.js";
|
|
16
|
-
export interface ScalarOpTarget {
|
|
17
|
-
binAdd(l: string, r: string): string;
|
|
18
|
-
binSub(l: string, r: string): string;
|
|
19
|
-
binMul(l: string, r: string): string;
|
|
20
|
-
binDiv(l: string, r: string): string;
|
|
21
|
-
binPow(l: string, r: string): string;
|
|
22
|
-
binEq(l: string, r: string): string;
|
|
23
|
-
binNe(l: string, r: string): string;
|
|
24
|
-
binLt(l: string, r: string): string;
|
|
25
|
-
binLe(l: string, r: string): string;
|
|
26
|
-
binGt(l: string, r: string): string;
|
|
27
|
-
binGe(l: string, r: string): string;
|
|
28
|
-
binAnd(l: string, r: string): string;
|
|
29
|
-
binOr(l: string, r: string): string;
|
|
30
|
-
unaryPlus(operand: string): string;
|
|
31
|
-
unaryMinus(operand: string): string;
|
|
32
|
-
unaryNot(operand: string): string;
|
|
33
|
-
toTruthy(valueExpr: string): string;
|
|
34
|
-
condEq(l: string, r: string): string;
|
|
35
|
-
condNe(l: string, r: string): string;
|
|
36
|
-
condLt(l: string, r: string): string;
|
|
37
|
-
condLe(l: string, r: string): string;
|
|
38
|
-
condGt(l: string, r: string): string;
|
|
39
|
-
condGe(l: string, r: string): string;
|
|
40
|
-
condNot(truthyExpr: string): string;
|
|
41
|
-
condAnd(l: string, r: string): string;
|
|
42
|
-
condOr(l: string, r: string): string;
|
|
43
|
-
}
|
|
44
|
-
/** Dispatch a scalar Binary op to the target. Throws on unsupported ops. */
|
|
45
|
-
export declare function emitScalarBinaryOp(op: BinaryOperation, left: string, right: string, target: ScalarOpTarget): string;
|
|
46
|
-
/** Dispatch a scalar Unary op to the target. Transpose is scalar-identity. */
|
|
47
|
-
export declare function emitScalarUnaryOp(op: UnaryOperation, operand: string, target: ScalarOpTarget): string;
|
|
48
|
-
/**
|
|
49
|
-
* Emit a condition expression for `if` / `while` / `&&` / `||` operands.
|
|
50
|
-
*
|
|
51
|
-
* Recurses through nested comparison / logical operators so that the
|
|
52
|
-
* whole condition emits as a native boolean/condition expression rather
|
|
53
|
-
* than being wrapped in a trailing `!= 0` on every nested result.
|
|
54
|
-
*
|
|
55
|
-
* `emitValue` is the backend's value-form expression emitter — it is
|
|
56
|
-
* called for the leaf operands of comparisons and for the fallback path.
|
|
57
|
-
*/
|
|
58
|
-
export declare function emitScalarTruthiness(expr: JitExpr, emitValue: (e: JitExpr) => string, target: ScalarOpTarget): string;
|
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Shared helpers for the JS-JIT shape modules.
|
|
3
|
-
*
|
|
4
|
-
* The three shape modules (`jitTopLevel.ts`, `jitLoop.ts`,
|
|
5
|
-
* `jitCall.ts`) all do the same handful of things — type inference
|
|
6
|
-
* with `exact` pruning, progressive type widening, JS body assembly,
|
|
7
|
-
* `new Function` instantiation, env writeback. Those bits live here
|
|
8
|
-
* so the shape modules can stay focused on what's actually different
|
|
9
|
-
* between them (synthetic-fn shape, cacheKey scheme, run-time entry).
|
|
10
|
-
*/
|
|
11
|
-
import type { Interpreter } from "../../interpreter/interpreter.js";
|
|
12
|
-
import type { Runtime } from "../../runtime/runtime.js";
|
|
13
|
-
import type { JitType } from "../../jitTypes.js";
|
|
14
|
-
import { type LoweringResult } from "./lower/jitLower.js";
|
|
15
|
-
import type { Stmt } from "../../parser/types.js";
|
|
16
|
-
/** Names that look like variables but never resolve to env values
|
|
17
|
-
* inside the JIT (constants, literals, the special `end` slot, the
|
|
18
|
-
* imaginary unit). Skipped when collecting env inputs. */
|
|
19
|
-
export declare const KNOWN_CONSTANTS: ReadonlySet<string>;
|
|
20
|
-
/**
|
|
21
|
-
* Drop `exact` from a numeric scalar `JitType`. Numeric `exact` only
|
|
22
|
-
* survives unification when two consecutive specializations see the
|
|
23
|
-
* *same* literal — almost never the case for variables — so stripping
|
|
24
|
-
* up front means the first specialization's cacheKey already matches
|
|
25
|
-
* later calls.
|
|
26
|
-
*/
|
|
27
|
-
export declare function pruneArgType(t: JitType): JitType;
|
|
28
|
-
/**
|
|
29
|
-
* Progressive type widening: in-place unify each entry of `types`
|
|
30
|
-
* with the corresponding entry of `prev`. No-op when shapes don't
|
|
31
|
-
* match (different arity → different specialization, no widening).
|
|
32
|
-
*
|
|
33
|
-
* Widening that would collapse a known type to `unknown` is rejected
|
|
34
|
-
* — keep this call's concrete type so a fresh, specific spec gets
|
|
35
|
-
* built. Without this, a 1st call with (number, …) followed by a 2nd
|
|
36
|
-
* call with (tensor, …) would unify the first arg to `unknown` and
|
|
37
|
-
* poison every subsequent specialization with the same arg shape
|
|
38
|
-
* (chunkie hits this with `fcurve(ta)` (scalar discovery) followed
|
|
39
|
-
* by `fcurve(ts)` (tensor)).
|
|
40
|
-
*/
|
|
41
|
-
export declare function widenAgainst(types: JitType[], prev: readonly JitType[] | undefined): void;
|
|
42
|
-
/**
|
|
43
|
-
* Gather env inputs for the synthetic FunctionDef of a top-level or
|
|
44
|
-
* loop block. For each candidate name: skip known constants, skip
|
|
45
|
-
* names not in env (likely fn names), infer the JIT type, prune
|
|
46
|
-
* `exact`. Returns null if any candidate has an unknown type — that's
|
|
47
|
-
* a structural blocker for lowering.
|
|
48
|
-
*/
|
|
49
|
-
export declare function gatherTypedEnvInputs(interp: Interpreter, candidates: readonly string[]): {
|
|
50
|
-
inputs: string[];
|
|
51
|
-
inputTypes: JitType[];
|
|
52
|
-
} | null;
|
|
53
|
-
/**
|
|
54
|
-
* Build a `// File: …` + indented source-slice comment block for the
|
|
55
|
-
* code being JIT-compiled. Used by `--dump-js` so each emitted JS
|
|
56
|
-
* section is annotated with the .m source it came from. Falls back
|
|
57
|
-
* gracefully when the source isn't in `interp.fileSources`.
|
|
58
|
-
*
|
|
59
|
-
* `start` is rewound to the beginning of its line so the first line
|
|
60
|
-
* keeps its original indentation (Stmt spans start at the first
|
|
61
|
-
* non-whitespace char, which would otherwise leave the first line
|
|
62
|
-
* dedented relative to the rest).
|
|
63
|
-
*/
|
|
64
|
-
export declare function buildJitSourceComment(interp: Interpreter, file: string, start: number, end: number): string;
|
|
65
|
-
/**
|
|
66
|
-
* Read the live env values for `inputs` in order. Used at run time
|
|
67
|
-
* to bind the compiled fn's parameters before invocation.
|
|
68
|
-
*/
|
|
69
|
-
export declare function gatherEnvValues(interp: Interpreter, inputs: readonly string[]): unknown[];
|
|
70
|
-
/**
|
|
71
|
-
* Build the JS body for a synthetic FunctionDef: prepend each
|
|
72
|
-
* generated callee body (indented 2 spaces to nest inside the
|
|
73
|
-
* outer function), then append the main body.
|
|
74
|
-
*/
|
|
75
|
-
export declare function assembleJsBody(result: LoweringResult, mainBody: string): string;
|
|
76
|
-
/**
|
|
77
|
-
* Wrap a JS body string in a `new Function(...)` and bind it to the
|
|
78
|
-
* runtime's helpers and `$rt`. Returns null when the body fails to
|
|
79
|
-
* parse (defensive — should not happen for IR that lowering accepted).
|
|
80
|
-
*/
|
|
81
|
-
export declare function instantiateJsFn(rt: Runtime, paramNames: readonly string[], jsBody: string): ((...args: unknown[]) => unknown) | null;
|
|
82
|
-
/**
|
|
83
|
-
* Write a compiled fn's return value back into the interpreter env.
|
|
84
|
-
* The compiled fn returns either a single value (for one-output fns)
|
|
85
|
-
* or an array of values (for multi-output) — matching the JS-JIT
|
|
86
|
-
* convention used in the wrapper layer.
|
|
87
|
-
*/
|
|
88
|
-
export declare function writeBackOutputs(interp: Interpreter, outputs: readonly string[], result: unknown): void;
|
|
89
|
-
/**
|
|
90
|
-
* Build a synthetic `FunctionDef` from (name, inputs, outputs, body)
|
|
91
|
-
* and lower it through `lowerFunction`. Returns null when lowering
|
|
92
|
-
* declines (constructs the JS-JIT IR doesn't model).
|
|
93
|
-
*/
|
|
94
|
-
export declare function lowerSyntheticFn(interp: Interpreter, name: string, inputs: readonly string[], inputTypes: readonly JitType[], outputs: readonly string[], body: Stmt[]): LoweringResult | null;
|
|
95
|
-
/**
|
|
96
|
-
* Generate JS for a synthetic-fn lowered IR and instantiate it.
|
|
97
|
-
* Returns null when `new Function` throws (defensive — should not
|
|
98
|
-
* happen for IR that lowering accepted). Both top-level and loop
|
|
99
|
-
* codegen use this; the shape module then wraps the returned fn in
|
|
100
|
-
* its `*Compiled` shape and emits its own source/diagnostics.
|
|
101
|
-
*/
|
|
102
|
-
export declare function generateSyntheticFnJS(interp: Interpreter, result: LoweringResult, inputs: readonly string[], outputCount: number): {
|
|
103
|
-
fn: (...args: unknown[]) => unknown;
|
|
104
|
-
jsBody: string;
|
|
105
|
-
} | null;
|
|
106
|
-
/** Outcome of `runSyntheticFnAgainstEnv`. `transient` distinguishes
|
|
107
|
-
* the recoverable JitBailToInterpreter case (cache preserved) from
|
|
108
|
-
* the hard JitFuncHandleBailError case (cache invalidated). */
|
|
109
|
-
export type SyntheticFnRunResult = {
|
|
110
|
-
ok: true;
|
|
111
|
-
} | {
|
|
112
|
-
ok: false;
|
|
113
|
-
transient: boolean;
|
|
114
|
-
};
|
|
115
|
-
/**
|
|
116
|
-
* Gather input values from env, invoke the compiled fn, write back
|
|
117
|
-
* outputs. Translates JIT bails to a SyntheticFnRunResult. Used by
|
|
118
|
-
* both top-level and loop run phases.
|
|
119
|
-
*/
|
|
120
|
-
export declare function runSyntheticFnAgainstEnv(interp: Interpreter, fn: (...args: unknown[]) => unknown, inputs: readonly string[], outputs: readonly string[]): SyntheticFnRunResult;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* js-jit-top-level — JS codegen executor for the top-level shape.
|
|
3
|
-
*
|
|
4
|
-
* - `propose()` filters on `lowered.kind === "top-level"`, applies
|
|
5
|
-
* JIT-feasibility checks (hasReturn, display mode + unsuppressed
|
|
6
|
-
* assigns, IO+bail-risk).
|
|
7
|
-
*
|
|
8
|
-
* - `compile()` calls `generateTopLevelJS`. Cached by the registry
|
|
9
|
-
* under the classification's cacheKey.
|
|
10
|
-
*
|
|
11
|
-
* - `run()` calls `runTopLevelCompiled`. JitBailToInterpreter →
|
|
12
|
-
* transient bail; JitFuncHandleBailError → permanent bail.
|
|
13
|
-
* `consumed` claims the entire script body.
|
|
14
|
-
*/
|
|
15
|
-
import type { Executor } from "../types.js";
|
|
16
|
-
import { type TopLevelLowered, type TopLevelCompiled } from "./jitTopLevel.js";
|
|
17
|
-
export declare const jsJitTopLevelExecutor: Executor<TopLevelLowered, TopLevelCompiled | null>;
|