3 Commits

Author SHA1 Message Date
b996bd5c5c revert 65531c5ec8cd5c6dd23a4c02bbb41b0288a3da16
Some checks failed
CodeQL / codeql (push) Has been cancelled
Farm / Farm (push) Has been cancelled
revert 	修改:     cmake/Env.cmake
	修改:     src/objit/CMakeLists.txt
2025-01-13 17:45:19 +08:00
65531c5ec8 修改: cmake/Env.cmake
修改:     src/objit/CMakeLists.txt
2025-01-13 17:42:16 +08:00
e82f7aff60 fix build error 2025-01-11 18:49:09 +08:00
7 changed files with 43 additions and 12 deletions

View File

@ -87,8 +87,8 @@ static __inline__ void easy_spin_lock(easy_atomic_t *lock)
__asm__ (".byte 0xf3, 0x90"); __asm__ (".byte 0xf3, 0x90");
#elif defined(__aarch64__) #elif defined(__aarch64__)
__asm__ ("yield"); // for ARM __asm__ ("yield"); // for ARM
#elif defined(__loongarch_lp64) #elif defined(__loongarch__)
__asm__ ("ibar 0"); // for ARM __asm__ ("ibar 0"); // for LOONGARCH
#else #else
#error arch unsupported #error arch unsupported
#endif #endif
@ -148,6 +148,8 @@ static __inline__ int easy_spinrwlock_rdlock(easy_spinrwlock_t *lock)
asm("pause"); asm("pause");
#elif defined(__aarch64__) #elif defined(__aarch64__)
asm("yield"); // for ARM asm("yield"); // for ARM
#elif defined(__loongarch__)
asm("ibar 0"); // loongarch
#else #else
#error arch unsupported #error arch unsupported
#endif #endif
@ -189,6 +191,8 @@ static __inline__ int easy_spinrwlock_wrlock(easy_spinrwlock_t *lock)
asm("pause"); asm("pause");
#elif defined(__aarch64__) #elif defined(__aarch64__)
asm("yield"); // for ARM asm("yield"); // for ARM
#elif defined(__loongarch__)
asm("ibar 0"); // loongarch
#else #else
#error arch unsupported #error arch unsupported
#endif #endif

View File

@ -451,7 +451,6 @@ static int easy_ssl_handshake(easy_connection_t *c)
return EASY_OK; return EASY_OK;
} }
#endif
sslerr = SSL_get_error(c->sc->connection, n); sslerr = SSL_get_error(c->sc->connection, n);
easy_debug_log("SSL_get_error: %d %s errno=%d", sslerr, easy_connection_str(c), errno); easy_debug_log("SSL_get_error: %d %s errno=%d", sslerr, easy_connection_str(c), errno);

View File

@ -531,6 +531,8 @@ EV_CPP(extern "C" {
#define ev_mb() __asm__ __volatile ("mfence" ::: "memory") #define ev_mb() __asm__ __volatile ("mfence" ::: "memory")
#elif defined(__aarch64__) #elif defined(__aarch64__)
#define ev_mb() __asm__ __volatile ("dsb sy" ::: "memory") //for ARM #define ev_mb() __asm__ __volatile ("dsb sy" ::: "memory") //for ARM
#elif defined(__loongarch__)
#define ev_mb() __asm__ __volatile ("dbar 0" :: : "memory") //for loongarch
#else #else
#error arch unsupported #error arch unsupported
#endif #endif

View File

@ -135,7 +135,7 @@ static __inline__ uint64_t rdtscp()
__asm__ __volatile__("rdtscp" : "=a"(rax), "=d"(rdx) :: "%rcx"); __asm__ __volatile__("rdtscp" : "=a"(rax), "=d"(rdx) :: "%rcx");
return (rdx << 32) + rax; return (rdx << 32) + rax;
} }
#else #elif defined(__aarch64__)
static __inline__ uint64_t rdtscp() static __inline__ uint64_t rdtscp()
{ {
int64_t virtual_timer_value; int64_t virtual_timer_value;
@ -147,9 +147,21 @@ static __inline__ uint64_t rdtsc()
return rdtscp(); return rdtscp();
} }
#elif defined(__loongarch__)
static __inline__ uint64_t rdtscp()
{
uint64_t count;
asm volatile("rdtime.d %[cycles], $zero\n" : [cycles] "=r" (count) ::);
return count;
}
static __inline__ uint64_t rdtsc()
{
return rdtscp();
}
#endif #endif
#if defined(__x86_64__) #if defined(__x86_64__) || defined(__loongarch__)
// 读取cpu频率 // 读取cpu频率
uint64_t get_cpufreq_khz() uint64_t get_cpufreq_khz()
{ {
@ -172,13 +184,17 @@ uint64_t get_cpufreq_khz()
return freq_khz; return freq_khz;
} }
#else #elif defined(__aarch64__)
uint64_t get_cpufreq_khz(void) uint64_t get_cpufreq_khz(void)
{ {
uint64_t timer_frequency; uint64_t timer_frequency;
asm volatile("mrs %0, cntfrq_el0":"=r"(timer_frequency)); asm volatile("mrs %0, cntfrq_el0":"=r"(timer_frequency));
return timer_frequency / 1000; return timer_frequency / 1000;
} }
//#elif defined(__loongarch__)
//uint64_t get_cpufreq_khz(void)
//{
//}
#endif #endif
// 初始化tsc时钟 // 初始化tsc时钟

View File

@ -19,7 +19,17 @@ static inline cycles_t easy_get_cycles()
return val; return val;
} }
#else #elif defined(__loongarch__)
static inline cycles_t easy_get_cycles()
{
uint64_t count;
asm volatile("rdtime.d %[cycles], $zero\n" : [cycles] "=r" (count) ::);
return count;
}
#elif defined(__aarch64__)
static inline uint64_t easy_rdtscp() static inline uint64_t easy_rdtscp()
{ {

View File

@ -568,7 +568,7 @@ inline bool is_cpu_support_sse42()
: "a"(1) : "a"(1)
:); :);
return 0 != (data & CPUID_STD_SSE4_2); return 0 != (data & CPUID_STD_SSE4_2);
#elif defined(__aarch64__) #elif defined(__aarch64__) || defined(__loongarch__)
return 0; return 0;
#else #else
#error arch unsupported #error arch unsupported

View File

@ -56,7 +56,7 @@ extern int easy_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
%} %}
%destructor {destroy_tree($$);}<node> %destructor {destroy_tree($$);}<node>
%destructor {oceanbase::common::ob_free($$);}<str_value_> //%destructor {oceanbase::common::ob_free($$);}<str_value_>
%token <node> NAME_OB %token <node> NAME_OB
%token <node> STRING_VALUE %token <node> STRING_VALUE
@ -124,7 +124,7 @@ extern int easy_vsnprintf(char *buf, size_t size, const char *fmt, va_list args)
%left AND AND_OP %left AND AND_OP
%left BETWEEN CASE WHEN THEN ELSE %left BETWEEN CASE WHEN THEN ELSE
%nonassoc LOWER_THAN_COMP %nonassoc LOWER_THAN_COMP
%left COMP_EQ COM P_NSEQ COMP_GE COMP_GT COMP_LE COMP_LT COMP_NE IS LIKE IN REGEXP SOUNDS %left COMP_EQ COMP_NSEQ COMP_GE COMP_GT COMP_LE COMP_LT COMP_NE IS LIKE IN REGEXP SOUNDS
%nonassoc STRING_VALUE %nonassoc STRING_VALUE
%right ESCAPE /*for conflict for escape*/ %right ESCAPE /*for conflict for escape*/
%left '|' %left '|'
@ -11271,11 +11271,11 @@ NAME_OB
{ {
$$ = $1; $$ = $1;
} }
| name_list NAME_OB %prec COMMA | name_list NAME_OB %prec LOWER_COMMA
{ {
malloc_non_terminal_node($$, result->malloc_pool_, T_LINK_NODE, 2, $1, $2); malloc_non_terminal_node($$, result->malloc_pool_, T_LINK_NODE, 2, $1, $2);
} }
| name_list ',' NAME_OB %prec COMMA | name_list ',' NAME_OB %prec LOWER_COMMA
{ {
malloc_non_terminal_node($$, result->malloc_pool_, T_LINK_NODE, 2, $1, $3); malloc_non_terminal_node($$, result->malloc_pool_, T_LINK_NODE, 2, $1, $3);
} }