Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
07ea5d8
sew jet
dozreg-toplud Aug 6, 2024
3ce3103
get src_w from e once
dozreg-toplud Aug 6, 2024
441a0f3
remove redundant u3x_atom calls
dozreg-toplud Aug 6, 2024
0121b1c
refcount e in shortcut
dozreg-toplud Aug 7, 2024
5e249d6
init commit
dozreg-toplud Nov 12, 2024
3ba29c7
monadic jet
dozreg-toplud Nov 13, 2024
11dbc05
jet works in 3.0 but crashes in 3.2
dozreg-toplud Nov 14, 2024
54e6ff2
no sanitize
dozreg-toplud Nov 14, 2024
239d4b9
flags, cleanup
dozreg-toplud Nov 14, 2024
3e6ca96
cleanup, subroads, proper allocations
dozreg-toplud Nov 15, 2024
0bf4420
validation, deps, cleanup
dozreg-toplud Nov 27, 2024
551dafc
wasm3 dep update
dozreg-toplud Nov 28, 2024
6c6c1b6
call start function manually
dozreg-toplud Nov 29, 2024
cab281e
versioned jet tags
dozreg-toplud Nov 29, 2024
e5eac5a
wasm3 update dep
dozreg-toplud Nov 29, 2024
83f8c69
wasm3 update dep
dozreg-toplud Nov 29, 2024
0e2cb27
wasm3 dep update
dozreg-toplud Nov 30, 2024
6d30552
wasm3 update
dozreg-toplud Dec 1, 2024
9b27e3f
wasm3 update
dozreg-toplud Dec 3, 2024
eb540b4
polymorphic run-once jet and registration
dozreg-toplud Dec 4, 2024
6eb41c2
mug core, proper memory management, remove subroad
dozreg-toplud Dec 7, 2024
6db1584
more monadic ops, macros, printfs, deterministic traps, wasm3 update
dozreg-toplud Dec 11, 2024
88a411c
fix copypaste typo, update wasm3
dozreg-toplud Dec 12, 2024
1e060b4
plug leak
dozreg-toplud Dec 12, 2024
a7a4d76
137 registration
dozreg-toplud Dec 12, 2024
c6e8220
wasm3 update, exit on missing import
dozreg-toplud Dec 14, 2024
52b5af1
wasm3 update
dozreg-toplud Dec 14, 2024
2c5fd50
assert mutable global, correct fields
dozreg-toplud Dec 15, 2024
20c4917
wasm3 update
dozreg-toplud Dec 15, 2024
33c2990
noun state monad
dozreg-toplud Dec 15, 2024
56778c1
more global io
dozreg-toplud Dec 31, 2024
9a792fd
breaks duh
dozreg-toplud Jan 3, 2025
716f3ea
wasm3 update
dozreg-toplud Jan 21, 2025
7fe418d
Merge branch 'urbit:develop' into lia-monad
dozreg-toplud Feb 14, 2025
fdf54c7
mesa: remove unused xeno handles
pkova Feb 19, 2025
99a8837
mesa: delete request on authentication failure
pkova Feb 19, 2025
54f491d
mesa: _mesa_send_modal when resending or requesting new fragments
pkova Feb 19, 2025
cc7b6bf
mesa: do not confusingly bind the udp port in mesa also
pkova Feb 19, 2025
9818606
mesa: drop the jumbo cache if it exceeds 200mb
pkova Feb 19, 2025
b74c84d
mesa: remove unused uv_timer_t from the gage
pkova Feb 19, 2025
c3cd9b2
mesa: remove unused _mesa_add_our_to_pit, we use the req_map instead
pkova Feb 19, 2025
213345f
138 remove registration
dozreg-toplud Feb 24, 2025
44558f2
mesa: do memcpy in _mesa_send_modal
pkova Feb 24, 2025
82e01d0
mesa: clear the pit every 30 seconds
pkova Feb 24, 2025
1d20904
mesa: fixes (#763)
pkova Feb 24, 2025
1e05c46
mesa: zero-initialize car_u
pkova Feb 24, 2025
18b6fdd
mesa: don't put mug hash of now in %born wire
pkova Feb 24, 2025
40b7ace
disk: fix stack overflow on corrupt lockfile in _disk_acquire
pkova Feb 24, 2025
16e4013
bex: fix UB left shift
pkova Feb 24, 2025
98dca55
urbit org dependency
dozreg-toplud Feb 24, 2025
eb73f0f
misc: more fixes (#764)
pkova Feb 24, 2025
23cfd2f
Urwasm jet (#747)
pkova Feb 24, 2025
0fde990
Merge branch 'urbit:develop' into jet-sew
dozreg-toplud Feb 24, 2025
3111418
137 registration
dozreg-toplud Feb 24, 2025
e697a0c
mesa: fix pit clear timer cleanup
pkova Feb 25, 2025
500f774
mesa: fix pit clear timer cleanup (#765)
pkova Feb 25, 2025
b6e30e9
tree: 138 -> 137_two_sew_a
pkova Feb 25, 2025
a4562a6
tree: remove 138 sew jet
pkova Feb 25, 2025
2cbb6a0
build: add missing sew.c
pkova Feb 25, 2025
5fc005e
jets: newline at the end of sew.c
pkova Feb 25, 2025
50a2582
++sew jet (#698)
pkova Feb 25, 2025
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
6 changes: 6 additions & 0 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -363,6 +363,11 @@ fn buildBinary(
.optimize = optimize,
});

const wasm3 = b.dependency("wasm3", .{
.target = target,
.optimize = optimize,
});

//
// Build Artifact
//
Expand Down Expand Up @@ -418,6 +423,7 @@ fn buildBinary(
urbit.linkLibrary(sigsegv.artifact("sigsegv"));
urbit.linkLibrary(urcrypt.artifact("urcrypt"));
urbit.linkLibrary(whereami.artifact("whereami"));
urbit.linkLibrary(wasm3.artifact("wasm3"));

if (t.isDarwin()) {
// Requires llvm@18 homebrew installation
Expand Down
3 changes: 3 additions & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,9 @@
.url = "https://github.com/allyourcodebase/zlib/archive/0918e87b7629b9c6a50a08edd0ce30d849758faf.tar.gz",
.hash = "122034ab2a12adf8016ffa76e48b4be3245ffd305193edba4d83058adbcfa749c107",
},
.wasm3 = .{
.path = "./ext/wasm3",
},
},
.paths = .{
"",
Expand Down
87 changes: 87 additions & 0 deletions ext/wasm3/build.zig
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
const std = @import("std");

pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const t = target.result;

const softfloat = b.dependency("softfloat", .{
.target = target,
.optimize = optimize,
});

const wasm3_c = b.dependency("wasm3", .{
.target = target,
.optimize = optimize,
});

const wasm3 = b.addStaticLibrary(.{
.name = "wasm3",
.target = target,
.optimize = optimize,
});

wasm3.linkLibC();

wasm3.addIncludePath(wasm3_c.path("source/"));

const common_flags = [_][]const u8{
"-std=c99",
"-Wall",
"-Wextra",
"-Wparentheses",
"-Wundef",
"-Wpointer-arith",
"-Wstrict-aliasing=2",
"-Werror=implicit-function-declaration",
"-fno-sanitize=all",
// "-fsanitize=undefined",
// "-fno-sanitize-trap=undefined",
};

const mac_flags = common_flags ++ [_][]const u8{
"-fPIC",
"-c",
};

wasm3.addCSourceFiles(.{
.root = wasm3_c.path("source/"),
.files = &.{
"m3_bind.c",
"m3_code.c",
"m3_compile.c",
"m3_core.c",
"m3_emit.c",
"m3_env.c",
"m3_exec.c",
"m3_function.c",
"m3_info.c",
"m3_module.c",
"m3_parse.c",
"m3_validate.c",
},
.flags = if (t.os.tag == .macos) &mac_flags else &common_flags,
});

wasm3.installHeader(wasm3_c.path("source/m3_config_platforms.h"), "m3_config_platforms.h");
wasm3.installHeader(wasm3_c.path("source/m3_bind.h"), "m3_bind.h");
wasm3.installHeader(wasm3_c.path("source/m3_code.h"), "m3_code.h");
wasm3.installHeader(wasm3_c.path("source/m3_compile.h"), "m3_compile.h");
wasm3.installHeader(wasm3_c.path("source/m3_config.h"), "m3_config.h");
wasm3.installHeader(wasm3_c.path("source/m3_core.h"), "m3_core.h");
wasm3.installHeader(wasm3_c.path("source/m3_emit.h"), "m3_emit.h");
wasm3.installHeader(wasm3_c.path("source/m3_env.h"), "m3_env.h");
wasm3.installHeader(wasm3_c.path("source/m3_exception.h"), "m3_exception.h");
wasm3.installHeader(wasm3_c.path("source/m3_exec.h"), "m3_exec.h");
wasm3.installHeader(wasm3_c.path("source/m3_exec_defs.h"), "m3_exec_defs.h");
wasm3.installHeader(wasm3_c.path("source/m3_function.h"), "m3_function.h");
wasm3.installHeader(wasm3_c.path("source/m3_info.h"), "m3_info.h");
wasm3.installHeader(wasm3_c.path("source/m3_math_utils.h"), "m3_math_utils.h");
wasm3.installHeader(wasm3_c.path("source/wasm3.h"), "wasm3.h");
wasm3.installHeader(wasm3_c.path("source/wasm3_defs.h"), "wasm3_defs.h");
wasm3.installHeader(wasm3_c.path("source/m3_validate.h"), "m3_validate.h");

wasm3.linkLibrary(softfloat.artifact("softfloat"));

b.installArtifact(wasm3);
}
17 changes: 17 additions & 0 deletions ext/wasm3/build.zig.zon
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
.{
.name = "wasm3",
.version = "0.0.1",
.dependencies = .{
.softfloat = .{
.path = "../softfloat",
},
.wasm3 = .{
// .path = "../../../../wasm3"
.url = "https://github.com/urbit/wasm3/archive/5b74cbca01793cda71ebf707b0587616c32cc88c.tar.gz",
.hash = "12200fb06246d1956d73684cddbf84e819e4a0d7b1817bf5934b836466d194e3c60d",
},
},
.paths = .{
"",
},
}
4 changes: 4 additions & 0 deletions pkg/c3/motes.h
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,8 @@
# define c3__exit c3_s4('e','x','i','t')
# define c3__eyre c3_s4('e','y','r','e')
# define c3__f c3_s1('f')
# define c3__f32 c3_s3('f','3','2')
# define c3__f64 c3_s3('f','6','4')
# define c3__fx c3_s2('f','x')
# define c3__fab c3_s3('f','a','b')
# define c3__face c3_s4('f','a','c','e')
Expand Down Expand Up @@ -596,6 +598,8 @@
# define c3__hxtr c3_s4('h','x','t','r')
# define c3__hxts c3_s4('h','x','t','s')
# define c3__i c3_s1('i')
# define c3__i32 c3_s3('i','3','2')
# define c3__i64 c3_s3('i','6','4')
# define c3__ic c3_s2('i','c')
# define c3__ice c3_s3('i','c','e')
# define c3__iced c3_s4('i','c','e','d')
Expand Down
8 changes: 8 additions & 0 deletions pkg/noun/build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,11 @@ pub fn build(b: *std.Build) !void {
.optimize = optimize,
});

const wasm3 = b.dependency("wasm3", .{
.target = target,
.optimize = optimize,
});

pkg_noun.linkLibC();

pkg_noun.linkLibrary(pkg_c3.artifact("c3"));
Expand All @@ -123,6 +128,7 @@ pub fn build(b: *std.Build) !void {
pkg_noun.linkLibrary(urcrypt.artifact("urcrypt"));
pkg_noun.linkLibrary(whereami.artifact("whereami"));
pkg_noun.linkLibrary(zlib.artifact("z"));
pkg_noun.linkLibrary(wasm3.artifact("wasm3"));

pkg_noun.addIncludePath(b.path(""));
if (t.os.tag.isDarwin())
Expand Down Expand Up @@ -229,6 +235,7 @@ const c_source_files = [_][]const u8{
"jets/c/rig.c",
"jets/c/rip.c",
"jets/c/rsh.c",
"jets/c/sew.c",
"jets/c/sqt.c",
"jets/c/swp.c",
"jets/c/xeb.c",
Expand Down Expand Up @@ -315,6 +322,7 @@ const c_source_files = [_][]const u8{
"jets/e/slaw.c",
"jets/e/tape.c",
"jets/e/trip.c",
"jets/e/urwasm.c",
"jets/f/cell.c",
"jets/f/comb.c",
"jets/f/cons.c",
Expand Down
3 changes: 3 additions & 0 deletions pkg/noun/build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@
.url = "https://github.com/allyourcodebase/zlib/archive/0918e87b7629b9c6a50a08edd0ce30d849758faf.tar.gz",
.hash = "122034ab2a12adf8016ffa76e48b4be3245ffd305193edba4d83058adbcfa749c107",
},
.wasm3 = .{
.path = "../../ext/wasm3",
},
},
.paths = .{
"",
Expand Down
53 changes: 53 additions & 0 deletions pkg/noun/jets/137/tree.c
Original file line number Diff line number Diff line change
Expand Up @@ -874,6 +874,56 @@ static u3j_core _137_non_d[] =
};


static u3j_harm _137_hex_lia_run_a[] = {{".2", u3we_lia_run, c3y}, {}};

static u3j_harm _137_hex_lia_run_once_inner_a[] = {{".2", u3we_lia_run_once, c3y}, {}};

static u3j_core _137_hex_lia_run_once_d[] = {
{ "run-once-inner-v0", 15, _137_hex_lia_run_once_inner_a, 0, no_hashes },
{}
};

static u3j_core _137_hex_lia_monad_d[] = {
{ "run-v0", 7, _137_hex_lia_run_a, 0, no_hashes },
{ "run-once-v0", 7, 0, _137_hex_lia_run_once_d, no_hashes },
{}
};

static u3j_core _137_hex_wasm_engine_d[] = {
{ "monad-v0", 3, 0, _137_hex_lia_monad_d, no_hashes },
{}
};

static u3j_core _137_hex_wasm_op_def_d[] = {
{ "wasm-engine-v0", 3, 0, _137_hex_wasm_engine_d, no_hashes },
{}
};

static u3j_core _137_hex_wasm_validator_d[] = {
{ "wasm-op-def-v0", 3, 0, _137_hex_wasm_op_def_d, no_hashes },
{}
};

static u3j_core _137_hex_wasm_parser_d[] = {
{ "validator-v0", 3, 0, _137_hex_wasm_validator_d, no_hashes },
{}
};

static u3j_core _137_hex_lia_sur_d[] = {
{ "wasm-parser-v0", 3, 0, _137_hex_wasm_parser_d, no_hashes },
{}
};

static u3j_core _137_hex_wasm_engine_sur_d[] = {
{ "monad-sur-v0", 3, 0, _137_hex_lia_sur_d, no_hashes },
{}
};

static u3j_core _137_hex_wasm_sur_d[] = {
{ "engine-sur-v0", 3, 0, _137_hex_wasm_engine_sur_d, no_hashes },
{}
};

static u3j_core _137_hex_d[] =
{ { "non", 7, 0, _137_non_d, no_hashes },

Expand All @@ -900,6 +950,7 @@ static u3j_core _137_hex_d[] =
{ "secp", 6, 0, _137_hex_secp_d, no_hashes },
{ "mimes", 31, 0, _137_hex_mimes_d, no_hashes },
{ "json", 31, 0, _137_hex_json_d, no_hashes },
{ "wasm-sur-v0", 3, 0, _137_hex_wasm_sur_d, no_hashes },
{}
};

Expand Down Expand Up @@ -1033,6 +1084,7 @@ static u3j_core _137_two__in_d[] =
static u3j_harm _137_two_rig_a[] = {{".2", u3wc_rig, c3n}, {}};

static u3j_harm _137_two_mate_a[] = {{".2", u3wb_mate, c3y}, {}};
static u3j_harm _137_two_sew_a[] = {{".2", u3wc_sew, c3y}, {}};

static u3j_core _137_two_d[] =
{ { "tri", 3, 0, _137_tri_d, no_hashes, _137_tri_ho },
Expand Down Expand Up @@ -1091,6 +1143,7 @@ static u3j_core _137_two_d[] =
{ "swp", 7, _137_two_swp_a, 0, no_hashes },
{ "rub", 7, _137_two_rub_a, 0, no_hashes },
{ "pow", 7, _137_two_pow_a, 0, no_hashes },
{ "sew", 7, _137_two_sew_a, 0, no_hashes },
{ "sqt", 7, _137_two_sqt_a, 0, no_hashes },
{ "xeb", 7, _137_two_xeb_a, 0, no_hashes },

Expand Down
2 changes: 1 addition & 1 deletion pkg/noun/jets/c/bex.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ u3qc_bex(u3_atom a)

u3i_slab_init(&sab_u, 0, a_d + 1);

sab_u.buf_w[a_d >> 5] = 1 << (a_d & 31);
sab_u.buf_w[a_d >> 5] = (c3_d)1 << (a_d & 31);

return u3i_slab_moot(&sab_u);
}
Expand Down
74 changes: 74 additions & 0 deletions pkg/noun/jets/c/sew.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
/// @file

#include "jets/q.h"
#include "jets/w.h"

#include "noun.h"

u3_weak
u3qc_sew(u3_atom a,
u3_atom b,
u3_atom c,
u3_atom d,
u3_atom e
)
{
if (0 == c) return u3k(e);
if ( !_(u3a_is_cat(b)) ||
!_(u3a_is_cat(c)) ) {
return u3_none;
}
if ( !_(u3a_is_cat(a)) || (a >= 32) ) {
return u3m_bail(c3__fail);
}

c3_g a_g = a;
c3_w b_w = b, c_w = c;
c3_w len_e_w = u3r_met(a_g, e);
u3i_slab sab_u;
c3_w* src_w;
c3_w len_src_w;
if ( _(u3a_is_cat(e)) ) {
len_src_w = e ? 1 : 0;
src_w = &e;
}
else {
u3a_atom* src_u = u3a_to_ptr(e);
len_src_w = src_u->len_w;
src_w = src_u->buf_w;
}
u3i_slab_init(&sab_u, a_g, c3_max(len_e_w, b_w + c_w));
u3r_chop_words(a_g, 0, b_w, 0, sab_u.buf_w, len_src_w, src_w);
u3r_chop(a_g, 0, c_w, b_w, sab_u.buf_w, d);
if (len_e_w > b_w + c_w) {
u3r_chop_words(a_g,
b_w + c_w,
len_e_w - (b_w + c_w),
b_w + c_w,
sab_u.buf_w,
len_src_w,
src_w);
}
return u3i_slab_mint(&sab_u);
}

u3_weak
u3wc_sew(u3_noun cor)
{
u3_noun a, b, c, d, e;
if ( (c3n == u3r_mean(cor, u3x_sam_2, &a,
u3x_sam_12, &b,
106, &c,
107, &d,
u3x_sam_7, &e, 0)) ||
(c3n == u3ud(a)) ||
(c3n == u3ud(b)) ||
(c3n == u3ud(c)) ||
(c3n == u3ud(d)) ||
(c3n == u3ud(e)) )
{
return u3m_bail(c3__fail);
} else {
return u3qc_sew(a, b, c, d, e);
}
}
Loading