Skip to content

Commit a6b0be7

Browse files
committed
Removed optimizations to convert .wasm to .opt as signals are not supported by dynamic loading as of now
1 parent e0c6482 commit a6b0be7

File tree

2 files changed

+42
-34
lines changed

2 files changed

+42
-34
lines changed

cpython/build_python_wasm.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,3 +157,6 @@ fi
157157
echo
158158
echo "=> Build complete. Outputs generated in current directory."
159159
ls -lh python*.wasm python*.cwasm 2>/dev/null || true
160+
161+
#Copying python.cwasm to lindfs
162+
cp python.cwasm ${LINDFS}/usr/local/bin/python.cwasm

cpython/build_shared_python_wasm.sh

Lines changed: 39 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -72,41 +72,46 @@ mkdir -p "$LINDFS_ROOT/bin"
7272
cp "$BUILD_WASM/python_shared.wasm" "$LINDFS_ROOT/bin/python.wasm"
7373

7474

75-
# --- Optimization & Precompilation Pipeline ---
76-
echo "=> Running wasm-opt (best-effort)..."
77-
TARGET_WASM="python_shared.wasm"
78-
WASM_OPT="$LIND_WASM_ROOT/tools/binaryen/bin/wasm-opt"
79-
if [[ -x "$WASM_OPT" ]]; then
80-
"$WASM_OPT" --epoch-injection --asyncify -O2 --debuginfo \
81-
"$BUILD_WASM/python_shared.wasm" -o "$BUILD_WASM/python_shared.opt.wasm"
82-
83-
TARGET_WASM="python_shared.opt.wasm"
84-
else
85-
echo "=> NOTE: wasm-opt not found at '$WASM_OPT'; skipping optimization step."
86-
fi
87-
88-
89-
echo "=> Generating cwasm via lind-boot --precompile..."
90-
if [[ -x "$LIND_BOOT" ]]; then
91-
pushd "$BUILD_WASM" > /dev/null
75+
# Since currently dynamic loading doesn't support signals, we do not apply
76+
# optimizations and directly produce .cwasm from .wasm
9277

93-
if "$LIND_BOOT" --precompile "$TARGET_WASM"; then
94-
OPT_CWASM="${TARGET_WASM%.wasm}.cwasm"
95-
CLEAN_CWASM="${OPT_CWASM/.opt/}"
78+
"$LIND_BOOT" --precompile "$BUILD_WASM/python_shared.wasm"
79+
cp "$BUILD_WASM/python_shared.cwasm" "$LINDFS_ROOT/bin/python.cwasm"
9680

97-
if [[ "$OPT_CWASM" != "$CLEAN_CWASM" && -f "$OPT_CWASM" ]]; then
98-
mv "$OPT_CWASM" "$CLEAN_CWASM"
99-
fi
100-
101-
echo "=> Successfully generated $CLEAN_CWASM"
102-
cp "$CLEAN_CWASM" "$LINDFS_ROOT/bin/python.cwasm"
103-
else
104-
echo "=> WARNING: lind-boot --precompile failed."
105-
fi
106-
107-
popd > /dev/null
108-
else
109-
echo "=> NOTE: lind-boot not found at '$LIND_BOOT'; skipping cwasm generation."
110-
fi
81+
# --- Optimization & Precompilation Pipeline ---
82+
#echo "=> Running wasm-opt (best-effort)..."
83+
#TARGET_WASM="python_shared.wasm"
84+
#WASM_OPT="$LIND_WASM_ROOT/tools/binaryen/bin/wasm-opt"
85+
#if [[ -x "$WASM_OPT" ]]; then
86+
# "$WASM_OPT" --epoch-injection --asyncify -O2 --debuginfo \
87+
# "$BUILD_WASM/python_shared.wasm" -o "$BUILD_WASM/python_shared.opt.wasm"
88+
89+
# TARGET_WASM="python_shared.opt.wasm"
90+
#else
91+
# echo "=> NOTE: wasm-opt not found at '$WASM_OPT'; skipping optimization step."
92+
#fi
93+
94+
#echo "=> Generating cwasm via lind-boot --precompile..."
95+
#if [[ -x "$LIND_BOOT" ]]; then
96+
# pushd "$BUILD_WASM" > /dev/null
97+
98+
# if "$LIND_BOOT" --precompile "$TARGET_WASM"; then
99+
# OPT_CWASM="${TARGET_WASM%.wasm}.cwasm"
100+
# CLEAN_CWASM="${OPT_CWASM/.opt/}"
101+
102+
# if [[ "$OPT_CWASM" != "$CLEAN_CWASM" && -f "$OPT_CWASM" ]]; then
103+
# mv "$OPT_CWASM" "$CLEAN_CWASM"
104+
# fi
105+
106+
# echo "=> Successfully generated $CLEAN_CWASM"
107+
# cp "$CLEAN_CWASM" "$LINDFS_ROOT/bin/python.cwasm"
108+
# else
109+
# echo "=> WARNING: lind-boot --precompile failed."
110+
# fi
111+
112+
# popd > /dev/null
113+
#else
114+
# echo "=> NOTE: lind-boot not found at '$LIND_BOOT'; skipping cwasm generation."
115+
#fi
111116

112117
echo "=> Shared build and installation complete!"

0 commit comments

Comments
 (0)