diff options
author | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-07 16:27:45 +0000 |
---|---|---|
committer | k0kubun <k0kubun@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2018-08-07 16:27:45 +0000 |
commit | 10bccf3465d3b268e4487ebcfb4d9c181d0fa5b2 (patch) | |
tree | 2ac882b49fcde849142328eaed7f7a36897ad455 /mjit.c | |
parent | 7fef588378e745a19231ab3503295ff51ccffa4c (diff) |
mjit.c: initial support for mswin MJIT
By this commit's changes in other files, now MJIT started to work on VC++.
Unfortunately some features are still broken and they'll be fixed later.
This also suppresses cl.exe's default output to stdout because there
seems to be no option to do it. Tweaking some log messages as well.
vm_core.h: declare `__declspec(dllimport)` to export them correctly on mswin.
vm_insnhelper.h: ditto
mjit.h: ditto
test_jit.rb: skipped some pending tests.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@64221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'mjit.c')
-rw-r--r-- | mjit.c | 21 |
1 files changed, 18 insertions, 3 deletions
@@ -765,7 +765,22 @@ compile_c_to_so(const char *c_file, const char *so_file) if (args == NULL) return FALSE; - exit_code = exec_process(cc_path, args); + { + int stdout_fileno = _fileno(stdout); + int orig_fd = dup(stdout_fileno); + int dev_null = rb_cloexec_open(ruby_null_device, O_WRONLY, 0); + + /* Discard cl.exe's outputs like: + _ruby_mjit_p12u3.c + Creating library C:.../_ruby_mjit_p12u3.lib and object C:.../_ruby_mjit_p12u3.exp + TODO: Don't discard them on --jit-verbose=2+ */ + dup2(dev_null, stdout_fileno); + exit_code = exec_process(cc_path, args); + dup2(orig_fd, stdout_fileno); + + close(orig_fd); + close(dev_null); + } free(args); if (exit_code != 0) @@ -1113,7 +1128,7 @@ convert_unit_to_func(struct rb_mjit_unit *unit) const char *label = RSTRING_PTR(unit->iseq->body->location.label); const char *path = RSTRING_PTR(s); int lineno = FIX2INT(unit->iseq->body->location.first_lineno); - verbose(2, "start compile: %s@%s:%d -> %s", label, path, lineno, c_file); + verbose(2, "start compilation: %s@%s:%d -> %s", label, path, lineno, c_file); fprintf(f, "/* %s@%s:%d */\n\n", label, path, lineno); } success = mjit_compile(f, unit->iseq->body, funcname); @@ -1812,7 +1827,7 @@ mjit_finish(void) return; /* Wait for pch finish */ - verbose(2, "Canceling worker thread"); + verbose(2, "Stopping worker thread"); CRITICAL_SECTION_START(3, "in mjit_finish to wakeup from pch"); /* As our threads are detached, we could just cancel them. But it is a bad idea because OS processes (C compiler) started by |