ruby-changes:60404
From: Takashi <ko1@a...>
Date: Sun, 15 Mar 2020 12:51:28 +0900 (JST)
Subject: [ruby-changes:60404] deb1c7b97d (master): Revert "Use a human-readable funcname with --jit-debug"
https://git.ruby-lang.org/ruby.git/commit/?id=deb1c7b97d From deb1c7b97d204016256a11bfa069ddb3e8fab9ea Mon Sep 17 00:00:00 2001 From: Takashi Kokubun <takashikkbn@g...> Date: Sat, 14 Mar 2020 20:50:53 -0700 Subject: Revert "Use a human-readable funcname with --jit-debug" This reverts commit cecebf55c476ae936f3e880477dfb62149143c46. debugging test failure... diff --git a/mjit_worker.c b/mjit_worker.c index 9df7bc6..e735045 100644 --- a/mjit_worker.c +++ b/mjit_worker.c @@ -92,7 +92,6 @@ https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L92 #include "ruby_assert.h" #include "ruby/debug.h" #include "ruby/thread.h" -#include "ruby/version.h" #ifdef _WIN32 #include <winsock2.h> @@ -689,40 +688,6 @@ remove_so_file(const char *so_file, struct rb_mjit_unit *unit) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L688 #endif } -// Print _mjitX, but make a human-readable funcname when --jit-debug is used -static void -sprint_funcname(char *funcname, const struct rb_mjit_unit *unit) -{ - const rb_iseq_t *iseq = unit->iseq; - if (iseq == NULL || (!mjit_opts.debug && !mjit_opts.debug_flags)) { - sprintf(funcname, "_mjit%d", unit->id); - return; - } - - // Generate a short path - const char *path = RSTRING_PTR(rb_iseq_path(iseq)); - const char *lib = "/lib/"; - const char *version = "/" STRINGIZE(RUBY_API_VERSION_MAJOR) "." STRINGIZE(RUBY_API_VERSION_MINOR) "." STRINGIZE(RUBY_API_VERSION_TEENY) "/"; - while (strstr(path, lib)) // skip "/lib/" - path = strstr(path, lib) + strlen(lib); - while (strstr(path, version)) // skip "/x.y.z/" - path = strstr(path, version) + strlen(version); - - // Annotate all-normalized method names - const char *method = RSTRING_PTR(iseq->body->location.label); - if (!strcmp(method, "[]")) method = "AREF"; - if (!strcmp(method, "[]=")) method = "ASET"; - - // Print and normalize - sprintf(funcname, "_mjit%d_%s_%s", unit->id, path, method); - for (size_t i = 0; i < strlen(funcname); i++) { - char c = funcname[i]; - if (!(('a' <= c && c <= 'z') || ('A' <= c && c <= 'Z') || ('0' <= c && c <= '9') || c == '_')) { - funcname[i] = '_'; - } - } -} - #define append_str2(p, str, len) ((char *)memcpy((p), str, (len))+(len)) #define append_str(p, str) append_str2(p, str, sizeof(str)-1) #define append_lit(p, str) append_str2(p, str, rb_strlen_lit(str)) @@ -947,8 +912,8 @@ compact_all_jit_code(void) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L912 CRITICAL_SECTION_START(3, "in compact_all_jit_code to read list"); list_for_each(&active_units.head, cur, unode) { void *func; - char funcname[MAXPATHLEN]; - sprint_funcname(funcname, unit); + char funcname[35]; // TODO: reconsider `35` + sprintf(funcname, "_mjit%d", cur->id); if ((func = dlsym(handle, funcname)) == NULL) { mjit_warning("skipping to reload '%s' from '%s': %s", funcname, so_file, dlerror()); @@ -1036,7 +1001,7 @@ compile_prelude(FILE *f) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L1001 static mjit_func_t convert_unit_to_func(struct rb_mjit_unit *unit) { - char c_file_buff[MAXPATHLEN], *c_file = c_file_buff, *so_file, funcname[MAXPATHLEN]; + char c_file_buff[MAXPATHLEN], *c_file = c_file_buff, *so_file, funcname[35]; // TODO: reconsider `35` int fd; FILE *f; void *func; @@ -1071,7 +1036,7 @@ convert_unit_to_func(struct rb_mjit_unit *unit) https://github.com/ruby/ruby/blob/trunk/mjit_worker.c#L1036 memcpy(so_file, c_file, c_file_len - sizeof(c_ext)); memcpy(&so_file[c_file_len - sizeof(c_ext)], so_ext, sizeof(so_ext)); - sprint_funcname(funcname, unit); + sprintf(funcname, "_mjit%d", unit->id); fd = rb_cloexec_open(c_file, access_mode, 0600); if (fd < 0 || (f = fdopen(fd, "w")) == NULL) { -- cgit v0.10.2 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/