aboutsummaryrefslogtreecommitdiffstats
path: root/mjit_compile.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-11 02:41:50 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2018-02-11 02:41:50 +0000
commitba30c0c9302600b78dd4e123c654c3819fc007f3 (patch)
tree05d2484c95c23ab9ee6129ad4544177c00440f64 /mjit_compile.c
parentf2a9d05bbe078bdbdcd831b8bfb92fb796bf120d (diff)
downloadruby-ba30c0c9302600b78dd4e123c654c3819fc007f3.tar.gz
_mjit_compile_insn.erb: comment_id
* tool/ruby_vm/views/_mjit_compile_insn.erb: comment ID of constant, calling method, and Symbol literal. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62354 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit_compile.c')
-rw-r--r--mjit_compile.c22
1 files changed, 22 insertions, 0 deletions
diff --git a/mjit_compile.c b/mjit_compile.c
index 4e4ca39e7f..c00ca85338 100644
--- a/mjit_compile.c
+++ b/mjit_compile.c
@@ -75,6 +75,28 @@ compile_case_dispatch_each(VALUE key, VALUE value, VALUE arg)
return ST_CONTINUE;
}
+static void
+comment_id(FILE *f, ID id)
+{
+ VALUE name = rb_id2str(id);
+ const char *p, *e;
+ char c, prev = '\0';
+
+ if (!name) return;
+ p = RSTRING_PTR(name);
+ e = RSTRING_END(name);
+ fputs("/* :\"", f);
+ for (; p < e; ++p) {
+ switch (c = *p) {
+ case '*': case '/': if (prev != (c ^ ('/' ^ '*'))) break;
+ case '\\': case '"': fputc('\\', f);
+ }
+ fputc(c, f);
+ prev = c;
+ }
+ fputs("\" */", f);
+}
+
static void compile_insns(FILE *f, const struct rb_iseq_constant_body *body, unsigned int stack_size,
unsigned int pos, struct compile_status *status);