Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

find cleaner way to implement execution tracing in clox #12

Open
zxul767 opened this issue Nov 8, 2022 · 0 comments
Open

find cleaner way to implement execution tracing in clox #12

zxul767 opened this issue Nov 8, 2022 · 0 comments

Comments

@zxul767
Copy link
Owner

zxul767 commented Nov 8, 2022

today we have a bunch of places that look like this:

    switch (OBJECT_TYPE(callee)) {
    case OBJECT_CLOSURE: {
#ifdef DEBUG_TRACE_EXECUTION
      if (vm->trace_execution) {
        debug__print_callframe_divider(vm);
      }
#endif
      bool result = call(AS_CLOSURE(callee), args_count, vm);

#ifdef DEBUG_TRACE_EXECUTION
      if (vm->trace_execution) {
      debug__show_callframe_names(vm);
#endif
      return result;
    }

one possibility might to follow the way of assert and make debug__ functions macros which hide all the ugliness behind them and which are compiled away when DEBUG_TRACE_EXECUTION is not defined.

@zxul767 zxul767 changed the title find cleaner way to add execution tracing in clox find cleaner way to enable execution tracing in clox Nov 9, 2022
@zxul767 zxul767 changed the title find cleaner way to enable execution tracing in clox find cleaner way to implement execution tracing in clox Nov 9, 2022
@zxul767 zxul767 added the p1 label Dec 7, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant