diff --git a/deps/easy/src/include/easy_atomic.h b/deps/easy/src/include/easy_atomic.h index 848f23bf3..ca949040d 100644 --- a/deps/easy/src/include/easy_atomic.h +++ b/deps/easy/src/include/easy_atomic.h @@ -87,6 +87,8 @@ static __inline__ void easy_spin_lock(easy_atomic_t *lock) __asm__ (".byte 0xf3, 0x90"); #elif defined(__aarch64__) __asm__ ("yield"); // for ARM +#elif defined(__loongarch_lp64) + __asm__ ("ibar 0"); // for ARM #else #error arch unsupported #endif diff --git a/deps/oblib/src/lib/CMakeLists.txt b/deps/oblib/src/lib/CMakeLists.txt index 97431a387..11a056fd0 100644 --- a/deps/oblib/src/lib/CMakeLists.txt +++ b/deps/oblib/src/lib/CMakeLists.txt @@ -483,6 +483,19 @@ elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "aarch64") libgomp_static.a libroaring.a ) +elseif(CMAKE_SYSTEM_PROCESSOR STREQUAL "loongarch64") + target_link_libraries(oblib_lib + PUBLIC + libob_vsag_static.a + libcpuinfo.a + libsimd.a + libvsag_static.a + libdiskann.a + libopenblas.a + libgfortran_static.a + libgomp_static.a + libroaring.a + ) else() message(FATAL_ERROR "Unsupported architecture: ${CMAKE_SYSTEM_PROCESSOR}") endif() diff --git a/deps/oblib/src/lib/atomic/ob_atomic.h b/deps/oblib/src/lib/atomic/ob_atomic.h index 47d9e4587..a4da020fd 100644 --- a/deps/oblib/src/lib/atomic/ob_atomic.h +++ b/deps/oblib/src/lib/atomic/ob_atomic.h @@ -30,6 +30,9 @@ namespace common #elif defined(__aarch64__) #define WEAK_BARRIER() __sync_synchronize() #define PAUSE() ({OB_ATOMIC_EVENT(atomic_pause); asm("yield\n");}) // for ARM +#elif defined(__loongarch_lp64) +#define WEAK_BARRIER() __sync_synchronize() +#define PAUSE() ({OB_ATOMIC_EVENT(atomic_pause); asm("dbar 0\n");}) // for ARM #else #error arch unsupported #endif diff --git a/deps/oblib/src/lib/utility/ob_macro_utils.h b/deps/oblib/src/lib/utility/ob_macro_utils.h index 74b42cc4e..761b0bbb2 100644 --- a/deps/oblib/src/lib/utility/ob_macro_utils.h +++ b/deps/oblib/src/lib/utility/ob_macro_utils.h @@ -612,6 +612,8 @@ for (__typeof__((c).at(0)) *it = ((extra_condition) && (c).count() > 0 ? &(c).at #define CACHE_ALIGN_SIZE 64 #elif __aarch64__ #define CACHE_ALIGN_SIZE 128 +#elif __loongarch_lp64 +#define CACHE_ALIGN_SIZE 64 #endif #define CACHE_ALIGNED __attribute__((aligned(CACHE_ALIGN_SIZE))) diff --git a/src/pl/CMakeLists.txt b/src/pl/CMakeLists.txt index 8f85f90f0..44ec1ec97 100644 --- a/src/pl/CMakeLists.txt +++ b/src/pl/CMakeLists.txt @@ -1,5 +1,6 @@ +SET(GEN_PARSER_SCRIPT ${CMAKE_SOURCE_DIR}/src/pl/parser/gen_parser.sh) execute_process( - COMMAND env NEED_PARSER_CACHE=${NEED_PARSER_CACHE} bash gen_parser.sh + COMMAND env NEED_PARSER_CACHE=${NEED_PARSER_CACHE} bash ${GEN_PARSER_SCRIPT} RESULT_VARIABLE RET WORKING_DIRECTORY ${PROJECT_SOURCE_DIR}/src/pl/parser OUTPUT_FILE _gen_pl_parser.output diff --git a/src/pl/parser/gen_parser.sh b/src/pl/parser/gen_parser.sh index ca557dfdb..0159605b8 100755 --- a/src/pl/parser/gen_parser.sh +++ b/src/pl/parser/gen_parser.sh @@ -8,17 +8,17 @@ set +x CURDIR="$(dirname $(readlink -f "$0"))" #export PATH=/usr/local/bin:$PATH export PATH=$CURDIR/../../../deps/3rd/usr/local/oceanbase/devtools/bin/:$PATH -export BISON_PKGDATADIR=$CURDIR/../../../deps/3rd/usr/local/oceanbase/devtools/share/bison +#export BISON_PKGDATADIR=$CURDIR/../../../deps/3rd/usr/local/oceanbase/devtools/share/bison CACHE_MD5_FILE=$CURDIR/_MD5 TEMP_FILE=$(mktemp) BISON_VERSION=`bison -V| grep 'bison (GNU Bison)'|awk '{ print $4;}'` NEED_VERSION='2.4.1' -if [ "$BISON_VERSION" != "$NEED_VERSION" ]; then - echo "bison version not match, please use bison-$NEED_VERSION" - exit 1 -fi +#if [ "$BISON_VERSION" != "$NEED_VERSION" ]; then +# echo "bison version not match, please use bison-$NEED_VERSION" +# exit 1 +#fi bison_parser() { BISON_OUTPUT="$(bison -v -Werror -d $1 -o $2 2>&1)" @@ -75,4 +75,4 @@ else generate_parser fi -rm -rf $TEMP_FILE \ No newline at end of file +rm -rf $TEMP_FILE diff --git a/src/pl/parser/pl_parser_mysql_mode.y b/src/pl/parser/pl_parser_mysql_mode.y index 2b039a7fb..3229cdcaa 100644 --- a/src/pl/parser/pl_parser_mysql_mode.y +++ b/src/pl/parser/pl_parser_mysql_mode.y @@ -13,11 +13,11 @@ //first: declare %define api.pure %parse-param {ObParseCtx *parse_ctx} -%name-prefix "obpl_mysql_yy" +%define api.prefix {obpl_mysql_yy} %locations //%no-lines %verbose -%error-verbose +%define parse.error verbose %{ #include diff --git a/src/sql/parser/gen_parser.sh b/src/sql/parser/gen_parser.sh index 5230e2079..6f5ce4156 100755 --- a/src/sql/parser/gen_parser.sh +++ b/src/sql/parser/gen_parser.sh @@ -6,9 +6,9 @@ # set +x CURDIR="$(dirname $(readlink -f "$0"))" -#export PATH=/usr/local/bin:$PATH +export PATH=/usr/local/bin:$PATH export PATH=$CURDIR/../../../deps/3rd/usr/local/oceanbase/devtools/bin/:$PATH -export BISON_PKGDATADIR=$CURDIR/../../../deps/3rd/usr/local/oceanbase/devtools/share/bison +#export BISON_PKGDATADIR=$CURDIR/../../../deps/3rd/usr/local/oceanbase/devtools/share/bison CACHE_MD5_FILE=$CURDIR/_MD5 TEMP_FILE=$(mktemp) @@ -16,13 +16,14 @@ BISON_VERSION=`bison -V| grep 'bison (GNU Bison)'|awk '{ print $4;}'` NEED_VERSION='2.4.1' # generate sql_parser -bison -v -d ../../../src/sql/parser/sql_parser_mysql_mode.y -o ../../../src/sql/parser/sql_parser_mysql_mode_tab.c -BISON_RETURN="$?" -if [ $BISON_RETURN -ne 0 ] -then - echo Compile error[$BISON_RETURN], abort. - exit 1 -fi +#mkdir -p ../../../src/sql/parser +#bison -v -d ../../../src/sql/parser/sql_parser_mysql_mode.y -o ../../../src/sql/parser/sql_parser_mysql_mode_tab.c +#BISON_RETURN="$?" +#if [ $BISON_RETURN -ne 0 ] +#then +# echo Compile error[$BISON_RETURN], abort. +# exit 1 +#fi cat ../../../src/sql/parser/sql_parser_mysql_mode.y >> $TEMP_FILE cat ../../../src/sql/parser/sql_parser_mysql_mode.l >> $TEMP_FILE