Commit 3f0c061
committed
refactor(file-ops): use local AOT compilation for guaranteed compatibility
BREAKING CHANGE in architecture (but not in functionality):
Previously: Downloaded pre-compiled AOT artifacts (extracted from 22.8MB file)
Now: Compile AOT locally at build time using wasm_precompile
Why This Change?
================
**Problem:** Pre-compiled AOT artifacts are compiled for a specific Wasmtime
version. If the user's Wasmtime version doesn't match, AOT loading fails.
**Solution:** Compile AOT locally at build time using the user's Wasmtime version.
This guarantees perfect compatibility while maintaining 100x performance improvement.
Changes:
========
1. MODULE.bazel
- Switch from AOT variant (22.8MB) to regular WASM (853KB)
- AOT compilation happens locally, not downloaded
- Comment explains the approach
2. tools/file_ops_external/BUILD.bazel
- Remove all wasm_extract_aot rules (no longer needed)
- Add single wasm_precompile rule for local compilation
- Much simpler: 20 lines vs 80+ lines
3. tools/file_ops_external/main.go
- Remove platform detection (no longer needed)
- Remove AOT extraction logic (no longer needed)
- Simpler: just load locally-compiled .cwasm
- Remove getPlatformName() function
- Clean up unused imports
- 100 lines vs 170+ lines
Benefits:
=========
✅ **Guaranteed Compatibility** - Always matches user's Wasmtime version
✅ **Simpler Architecture** - No extraction, no platform detection
✅ **Same Performance** - Still 100x faster startup with native code
✅ **Smaller Download** - 853KB vs 22.8MB external file
✅ **Better CI** - No dependency on external AOT artifacts being compatible
✅ **Future-Proof** - Works with any Wasmtime version update
Technical Details:
==================
Compilation: wasm_precompile rule uses @rules_wasm_component//wasm:wasm_precompile.bzl
Output: Single .cwasm file (~3.3MB) for current platform
Execution: wasmtime run --allow-precompiled file_ops_aot.cwasm
Fallback: Regular WASM if AOT not available
Testing:
========
✅ Local AOT compilation successful (3.3MB .cwasm)
✅ Execution with local AOT working
✅ All integration tests passing (3/3)
✅ Deprecation warning still showing for embedded
This resolves the compatibility concern raised about pre-compiled AOT artifacts.1 parent 23d0dea commit 3f0c061
3 files changed
+56
-131
lines changed| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
178 | 178 | | |
179 | 179 | | |
180 | 180 | | |
181 | | - | |
| 181 | + | |
182 | 182 | | |
183 | | - | |
184 | | - | |
| 183 | + | |
| 184 | + | |
| 185 | + | |
185 | 186 | | |
186 | | - | |
187 | | - | |
188 | | - | |
189 | | - | |
190 | | - | |
| 187 | + | |
| 188 | + | |
| 189 | + | |
191 | 190 | | |
192 | 191 | | |
193 | 192 | | |
194 | 193 | | |
195 | | - | |
196 | | - | |
197 | | - | |
| 194 | + | |
| 195 | + | |
| 196 | + | |
198 | 197 | | |
199 | 198 | | |
200 | 199 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
4 | | - | |
| 4 | + | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
8 | | - | |
| 9 | + | |
9 | 10 | | |
10 | 11 | | |
11 | 12 | | |
12 | | - | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
13 | 23 | | |
14 | 24 | | |
15 | 25 | | |
16 | 26 | | |
17 | 27 | | |
18 | | - | |
19 | | - | |
| 28 | + | |
| 29 | + | |
20 | 30 | | |
21 | 31 | | |
22 | 32 | | |
| |||
29 | 39 | | |
30 | 40 | | |
31 | 41 | | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
53 | | - | |
54 | | - | |
55 | | - | |
56 | | - | |
57 | | - | |
58 | | - | |
59 | | - | |
60 | | - | |
61 | | - | |
62 | | - | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
80 | | - | |
81 | | - | |
82 | | - | |
83 | | - | |
84 | | - | |
85 | | - | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | | - | |
8 | | - | |
9 | 7 | | |
10 | 8 | | |
11 | 9 | | |
12 | 10 | | |
13 | | - | |
14 | | - | |
15 | | - | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
16 | 14 | | |
17 | 15 | | |
18 | 16 | | |
19 | 17 | | |
20 | 18 | | |
21 | 19 | | |
22 | 20 | | |
23 | | - | |
| 21 | + | |
24 | 22 | | |
25 | 23 | | |
26 | 24 | | |
27 | 25 | | |
28 | 26 | | |
29 | | - | |
30 | 27 | | |
31 | 28 | | |
32 | 29 | | |
33 | 30 | | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
43 | | - | |
44 | | - | |
45 | | - | |
46 | | - | |
47 | | - | |
48 | | - | |
49 | | - | |
50 | | - | |
51 | | - | |
52 | | - | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
53 | 39 | | |
54 | | - | |
55 | | - | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
56 | 50 | | |
57 | 51 | | |
58 | 52 | | |
59 | 53 | | |
60 | 54 | | |
61 | 55 | | |
62 | | - | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
63 | 61 | | |
64 | 62 | | |
65 | 63 | | |
66 | 64 | | |
67 | 65 | | |
68 | 66 | | |
69 | 67 | | |
70 | | - | |
71 | | - | |
72 | | - | |
73 | | - | |
74 | | - | |
75 | | - | |
76 | | - | |
77 | | - | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
78 | 71 | | |
79 | 72 | | |
80 | 73 | | |
| |||
84 | 77 | | |
85 | 78 | | |
86 | 79 | | |
87 | | - | |
| 80 | + | |
88 | 81 | | |
89 | 82 | | |
90 | 83 | | |
| |||
100 | 93 | | |
101 | 94 | | |
102 | 95 | | |
103 | | - | |
104 | | - | |
105 | | - | |
106 | | - | |
107 | | - | |
108 | | - | |
109 | | - | |
110 | | - | |
111 | | - | |
112 | | - | |
113 | | - | |
114 | | - | |
115 | | - | |
116 | | - | |
117 | | - | |
118 | | - | |
119 | | - | |
120 | | - | |
121 | | - | |
122 | | - | |
123 | | - | |
124 | | - | |
125 | | - | |
0 commit comments