Skip to content

Commit 07c53a2

Browse files
committed
update
1 parent d5f966d commit 07c53a2

File tree

3 files changed

+22
-26
lines changed

3 files changed

+22
-26
lines changed

common/wasm_utils/wasm_utils.go

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,18 @@ func ExtractPtrSize(ptrSize uint64) (uint32, uint32) {
4545
return uint32(ptrSize >> 32), uint32(ptrSize)
4646
}
4747

48+
// BytesToPtr returns a pointer and size pair for the given byte slice in a way
49+
// compatible with WebAssembly numeric types.
50+
// The returned pointer aliases the slice hence the slice must be kept alive
51+
// until ptr is no longer needed.
52+
func BytesToPtr(b []byte) (uint32, uint32) {
53+
if len(b) == 0 {
54+
return 0, 0
55+
}
56+
ptr := unsafe.Pointer(unsafe.SliceData(b))
57+
return uint32(uintptr(ptr)), uint32(len(b))
58+
}
59+
4860
// PtrSize64 packs a 64-bit pointer and size into a uint128-like structure
4961
// We use two uint64 values to represent a 128-bit pointer+size pair
5062
type PtrSize64 struct {

scripts/build-rocksdb.sh

Lines changed: 7 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -25,32 +25,24 @@ ROCKSDB_SRC_DIR="$ROCKSDB_DIR/src"
2525
# 7.10.2 is a stable 7.x version compatible with grocksdb v1.7.16
2626
ROCKSDB_VERSION="${ROCKSDB_VERSION:-7.10.2}"
2727

28-
# Color output
29-
RED='\033[0;31m'
30-
GREEN='\033[0;32m'
31-
YELLOW='\033[1;33m'
32-
BLUE='\033[0;34m'
33-
CYAN='\033[0;36m'
34-
NC='\033[0m' # No Color
35-
3628
# Timing related variables
3729
START_TIME=0
3830
STEP_START_TIME=0
3931

4032
echo_info() {
41-
echo -e "${GREEN}[INFO]${NC} $1"
33+
echo "[INFO] $1"
4234
}
4335

4436
echo_warn() {
45-
echo -e "${YELLOW}[WARN]${NC} $1"
37+
echo "[WARN] $1"
4638
}
4739

4840
echo_error() {
49-
echo -e "${RED}[ERROR]${NC} $1"
41+
echo "[ERROR] $1"
5042
}
5143

5244
echo_time() {
53-
echo -e "${CYAN}[TIME]${NC} $1"
45+
echo "[TIME] $1"
5446
}
5547

5648
# Start timer
@@ -114,8 +106,7 @@ detect_os() {
114106

115107
OS=$(detect_os)
116108

117-
# Set library file extension (Unix systems)
118-
LIB_EXT=".a"
109+
# Set library file name
119110
STATIC_LIB_NAME="librocksdb.a"
120111

121112
# Check dependencies
@@ -356,9 +347,9 @@ build_rocksdb_unix() {
356347
# - USE_ZLIB=0: Disable Zlib compression
357348
# - USE_BZIP2=0: Disable BZip2 compression
358349
# - OPT="-Os": Optimize for size
359-
echo_info "Executing: make -j${CPU_COUNT} ROCKSDB_LITE=1 PORTABLE=1 USE_RTTI=1 DEBUG_LEVEL=0 DISABLE_WARNING_AS_ERROR=1 OPT=\"-Os\" WITH_JEMALLOC=0 WITH_MD_LIBRARY=0 WITH_NUMA=0 WITH_TBB=0 ROCKSDB_BUILD_SHARED=0 WITH_TOOLS=0 WITH_EXAMPLES=0 WITH_TESTS=0 USE_SNAPPY=0 USE_LZ4=0 USE_ZSTD=0 USE_ZLIB=0 USE_BZIP2=0 static_lib"
350+
echo_info "Executing: make -j\"${CPU_COUNT}\" ROCKSDB_LITE=1 PORTABLE=1 USE_RTTI=1 DEBUG_LEVEL=0 DISABLE_WARNING_AS_ERROR=1 OPT=\"-Os\" WITH_JEMALLOC=0 WITH_MD_LIBRARY=0 WITH_NUMA=0 WITH_TBB=0 ROCKSDB_BUILD_SHARED=0 WITH_TOOLS=0 WITH_EXAMPLES=0 WITH_TESTS=0 USE_SNAPPY=0 USE_LZ4=0 USE_ZSTD=0 USE_ZLIB=0 USE_BZIP2=0 static_lib"
360351

361-
if ! make -j${CPU_COUNT} ROCKSDB_LITE=1 PORTABLE=1 USE_RTTI=1 DEBUG_LEVEL=0 DISABLE_WARNING_AS_ERROR=1 OPT="-Os" WITH_JEMALLOC=0 WITH_MD_LIBRARY=0 WITH_NUMA=0 WITH_TBB=0 ROCKSDB_BUILD_SHARED=0 WITH_TOOLS=0 WITH_EXAMPLES=0 WITH_TESTS=0 USE_SNAPPY=0 USE_LZ4=0 USE_ZSTD=0 USE_ZLIB=0 USE_BZIP2=0 static_lib; then
352+
if ! make -j"${CPU_COUNT}" ROCKSDB_LITE=1 PORTABLE=1 USE_RTTI=1 DEBUG_LEVEL=0 DISABLE_WARNING_AS_ERROR=1 OPT="-Os" WITH_JEMALLOC=0 WITH_MD_LIBRARY=0 WITH_NUMA=0 WITH_TBB=0 ROCKSDB_BUILD_SHARED=0 WITH_TOOLS=0 WITH_EXAMPLES=0 WITH_TESTS=0 USE_SNAPPY=0 USE_LZ4=0 USE_ZSTD=0 USE_ZLIB=0 USE_BZIP2=0 static_lib; then
362353
echo_error "❌ Build failed"
363354
echo_error "Debug information:"
364355
echo_error " Working directory: $(pwd)"

scripts/setup-rocksdb-deps.sh

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,23 +13,16 @@
1313

1414
set -e
1515

16-
# Color output
17-
RED='\033[0;31m'
18-
GREEN='\033[0;32m'
19-
YELLOW='\033[1;33m'
20-
BLUE='\033[0;34m'
21-
NC='\033[0m' # No Color
22-
2316
echo_info() {
24-
echo -e "${GREEN}[INFO]${NC} $1"
17+
echo "[INFO] $1"
2518
}
2619

2720
echo_warn() {
28-
echo -e "${YELLOW}[WARN]${NC} $1"
21+
echo "[WARN] $1"
2922
}
3023

3124
echo_error() {
32-
echo -e "${RED}[ERROR]${NC} $1"
25+
echo "[ERROR] $1"
3326
}
3427

3528
# Detect operating system

0 commit comments

Comments
 (0)