This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "Tarantool -- an efficient key/value data store".

The branch core-save-rbp has been created
        at  4e2a054c745a6bc87637df0b2dbc7b213e5a4fa5 (commit)


commit 4e2a054c745a6bc87637df0b2dbc7b213e5a4fa5
Author: Yuriy Vostrikov <[email protected]>
Date:   Fri Dec 10 15:52:37 2010 +0300

    [core] Fix rbp printing.

diff --git a/core/fiber.c b/core/fiber.c
index 328e4d0..5dbb599 100644
--- a/core/fiber.c
+++ b/core/fiber.c
@@ -102,9 +102,8 @@ fiber_call(struct fiber *callee)
        fiber = callee;
        *sp++ = caller;
 
-#if CORO_ASM
-       save_rbp(&caller->rbp);
-#endif
+       save_rbp(caller->rbp);
+
        callee->csw++;
        coro_transfer(&caller->coro.ctx, &callee->coro.ctx);
 }
@@ -120,9 +119,8 @@ fiber_raise(struct fiber *callee, jmp_buf exc, int value)
        fiber = callee;
        *sp++ = caller;
 
-#if CORO_ASM
-       save_rbp(&caller->rbp);
-#endif
+       save_rbp(caller->rbp);
+
        callee->csw++;
        coro_save_and_longjmp(&caller->coro.ctx, exc, value);
 }
@@ -134,9 +132,8 @@ yield(void)
        struct fiber *caller = fiber;
 
        fiber = callee;
-#if CORO_ASM
-       save_rbp(&caller->rbp);
-#endif
+       save_rbp(caller->rbp);
+
        callee->csw++;
        coro_transfer(&caller->coro.ctx, &callee->coro.ctx);
 }
diff --git a/core/tarantool.c b/core/tarantool.c
index 4a7f79c..061e9f6 100644
--- a/core/tarantool.c
+++ b/core/tarantool.c
@@ -231,9 +231,8 @@ main(int argc, char **argv)
        int n_accepted, n_skipped;
        FILE *f;
 
-#if CORO_ASM
-       save_rbp(&main_stack_frame);
-#endif
+       save_rbp(main_stack_frame);
+
        master_pid = getpid();
        stat_init();
        palloc_init();
diff --git a/core/util.c b/core/util.c
index 0c7ba4e..a4949d6 100644
--- a/core/util.c
+++ b/core/util.c
@@ -95,26 +95,13 @@ xrealloc(void *ptr, size_t size)
        return ret;
 }
 
-#if CORO_ASM
-void
-save_rbp(void **rbp)
-{
-#  if __amd64
-       asm("movq %%rbp, %0"::"m"(*rbp));
-#  elif __i386
-       asm("movl %%ebp, %0"::"m"(*rbp));
-#  else
-#  error unsupported architecture
-#  endif
-}
-
 void *main_stack_frame;
 static void
 print_trace(FILE *f)
 {
        void *dummy;
        struct frame *frame;
-       save_rbp(&dummy);
+       save_rbp(dummy);
        frame = dummy;
 
        void *stack_top = fiber->coro.stack + fiber->coro.stack_size;
@@ -129,7 +116,6 @@ print_trace(FILE *f)
                frame = frame->rbp;
        }
 }
-#endif
 
 void __attribute__ ((noreturn))
     assert_fail(const char *assertion, const char *file, unsigned int line, 
const char *function)
diff --git a/include/util.h b/include/util.h
index bc7e6f5..fe10daa 100644
--- a/include/util.h
+++ b/include/util.h
@@ -117,7 +117,18 @@ struct frame {
        void *ret;
 };
 
-void save_rbp(void **rbp);
+#if CORO_ASM
+#  if __amd64
+#    define save_rbp(rbp) asm("movq %%rbp, %0"::"m"(rbp))
+#  elif __i386
+#    define save_rbp(rbp) asm("movl %%ebp, %0"::"m"(rbp))
+#  else
+#  error unsupported architecture
+#  endif
+# else
+#   define save_rbp(rbp) (void)0
+#endif
+
 extern void *main_stack_frame;
 
 #ifdef NDEBUG


-- 
Tarantool -- an efficient key/value data store

_______________________________________________
Mailing list: https://launchpad.net/~tarantool-developers
Post to     : [email protected]
Unsubscribe : https://launchpad.net/~tarantool-developers
More help   : https://help.launchpad.net/ListHelp

Reply via email to