aboutsummaryrefslogtreecommitdiffstats
path: root/mjit.c
Commit message (Collapse)AuthorAgeFilesLines
* mjit.h: compare as pointernobu2018-02-141-1/+1
| | | | | | | | | * mjit.c (mjit_get_iseq_func), mjit.h (mjit_exec): do not compare a pointer as shorter type. by loosing the precision, different values can result in "equal" wrongly. enum type is an alias of `int`, and is often shorter than a pointer type nowadays. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62401 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* xmalloc never returns NULLkazu2018-02-131-2/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62390 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: print JIT failurek0kubun2018-02-121-2/+10
| | | | | | | | mjit_compile.inc.erb: show unsupported insn name on --jit-verbose=1 too. Also, removed osboleted workaround. Now some insn-related functions are declared with MAYBE_UNUSED. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62382 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: some flags are no longer for GCCk0kubun2018-02-111-15/+2
| | | | | | | | Obviously they are for clang. For simplicity, just inlined them. Also another obsoleted commant was removed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62369 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: alwasy -fPIC flag to gccnobu2018-02-111-4/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62365 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit_config.h: include trailing comma for empty listnobu2018-02-111-11/+5
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62362 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit_config.h: more macrosnobu2018-02-111-76/+49
| | | | | | | | | * Makefie.in, win32/Makefile.sub: add more macros for compiler to mjit_config.h. * mjit.c: unification VC and GCC in progress. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62356 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: constified command argumentsnobu2018-02-101-8/+8
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62346 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit_config.hnobu2018-02-101-62/+74
| | | | | | | | | | | * Makefie.in, win32/Makefile.sub: make mjit_config.h from configured variables, including necessary options, e.g., `-m32` for 32bit binary on 64bit platform. * mjit.c: always use configured CC command. as config.h depends on the compiler, different compilers cannot work. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62343 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: replaced magic numbersnobu2018-02-101-7/+10
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62341 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: chomp suffix firstnobu2018-02-101-6/+11
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62339 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: binary modenobu2018-02-101-1/+6
| | | | | | | * mjit.c (convert_unit_to_func): write source code in binary mode. not conversion is needed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62338 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* append_str don't look the length of stringusa2018-02-091-2/+4
| | | | | | | | | * mjit.c (compile_c_to_so): use append_str2() and pass the length of so_name. append_str() uses the size of the 2nd argument, not the length of it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62337 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: set umasknobu2018-02-091-0/+1
| | | | | | | * mjit.c (start_process): set umask so other users cannot access generated files. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62335 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: exclusively createnobu2018-02-091-3/+6
| | | | | | | * mjit.c (convert_unit_to_func): create new file exclusively. overwriting existing file could cause security issues. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62334 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* refoctoringusa2018-02-081-14/+16
| | | | | | | | | | | * mjit.c (compile_c_to_so): refactored. * mjit.c (init_header_filename): xmalloc never returns NULL. * mjit.c (init_header_filename): report the filename of the header if failed. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62325 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: rb_w32_system_tmpdir is not in headersnobu2018-02-081-0/+4
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62323 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: revert r62316 partiallynobu2018-02-081-1/+1
| | | | | | * mjit.c (compile_c_to_so): libs is not constant on Windows. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62322 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: ruby_version from version.cnobu2018-02-081-5/+9
| | | | | | | | * mjit.c (init_header_filename): get version name from the particular global variable, not from the macro in version.h. to get rid of re-compilation for each revision. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62318 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: argument arraysnobu2018-02-081-3/+3
| | | | | | | * mjit.c (compile_c_to_so): constified constat array and make variable arrays local. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62316 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* internal.h: moved ruby_null_device declarationnobu2018-02-081-2/+0
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62306 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: make filename in allocated buffernobu2018-02-081-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62298 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: untabified [ci skip]nobu2018-02-071-16/+16
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62289 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: fix -Wdiscarded-qualifiers warningk0kubun2018-02-071-1/+1
| | | | | | | | | | ../mjit.c: In function ‘system_tmpdir’: ../mjit.c:1231:9: warning: assignment discards ‘const’ qualifier from pointer target type [-Wdiscarded-qualifiers] tmpdir = "/tmp"; ^ ../mjit.c: At top level: git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62288 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: system_tmpdirnobu2018-02-071-6/+37
| | | | | | | * mjit.c (system_tmpdir): use system provided temporary directory, and TMPDIR as well as mktemp(1), before TMP and "/tmp". git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62283 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: fix buffer overflownobu2018-02-071-10/+30
| | | | | | | | | | | | | * mjit.c (sprint_uniq_filename): get rid of silent buffer overflow. * mjit.c (get_uniq_filename, convert_unit_to_func): allocate enough buffer before formatting. * mjit.c (convert_unit_to_func): use DLEXT instead of hard coded extension. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62281 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: windows should include fcntl.h took0kubun2018-02-071-3/+3
| | | | | | | | | | Fixing build failure on mswin by r62279 mjit.c ../mjit.c(1137) : error C2065: 'O_RDONLY' : undeclared identifier NMAKE : fatal error U1077: '"C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\BIN\amd64\cl.EXE"' : return code '0x2' git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62280 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: FD instead of FILEnobu2018-02-071-3/+3
| | | | | | | * mjit.c (init_header_filename): just FD instead of FILE to check file is accessible. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62279 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: fd is no longer valid after fclosenobu2018-02-071-3/+6
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62278 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: fix declaration of ruby_null_devicenobu2018-02-071-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62277 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit mswin support (WIP)usa2018-02-071-13/+16
| | | | | | | | | * mjit.c (compile_c_to_so): fixed broken xfree position. * mjit.c (init_header_filename): refactored. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62273 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* share ruby_null_devicenobu2018-02-061-8/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62268 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit mswin support (WIP)usa2018-02-061-8/+63
| | | | | | | | | | | | | | * win32/Makefile.sub (LIBRUBYARG_SHARED): define for MJIT because it is used in common.mk. * mjit.c (make_pch): skip temporary for mswin. * mjit.c (compile_c_to_so, init_header_filename, mjit_init): mswin support. * mjig_compile.c (mjit_compile): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62267 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: make null device portablek0kubun2018-02-061-1/+8
| | | | | | for future mswin support git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62266 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: prefix "_ruby" to precompiled header took0kubun2018-02-061-3/+5
| | | | | | for consistency and to clarify who created it. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62265 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: try installed header onlynobu2018-02-061-28/+7
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62262 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: handle fopen errork0kubun2018-02-061-0/+6
| | | | | | [Bug #14441] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62258 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* Fix wrong commentkazu2018-02-061-2/+1
| | | | | | | `ruby_strdup` does not return NULL. [ci skip] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62253 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: suppress unused-value warningnobu2018-02-061-1/+1
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62251 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: fixed missing variablenobu2018-02-061-0/+3
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62249 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: build dir prefixnobu2018-02-061-20/+34
| | | | | | | | * mjit.c (init_header_filename): prepend basedir to header build dir too, so that the header can be found when running not in the build directory. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62248 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* thread_pthread.c: cast inside rb_thread_create_mjit_threadnobu2018-02-061-1/+1
| | | | | | | | * thread_pthread.c (rb_thread_create_mjit_thread): cast worker_func pointer to void pointer inside. adjusted to the declaration in mjit.c and the definition in thread_win32.c. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62242 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: use ruby_strdup as get_stringnobu2018-02-061-9/+2
| | | | git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62241 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: fix MinGW warning by r62221k0kubun2018-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | mjit.c: In function 'worker': mjit.c:126:64: warning: passing argument 1 of '_InterlockedExchangePointer' from incompatible pointer type [-Wincompatible-pointer-types] # define MJIT_ATOMIC_SET(var, val) InterlockedExchangePointer(&(var), val) ^ mjit.c:828:17: note: in expansion of macro 'MJIT_ATOMIC_SET' MJIT_ATOMIC_SET(node->unit->iseq->body->jit_func, func); ^ In file included from C:/msys64/mingw64/x86_64-w64-mingw32/include/winnt.h:27:0, from C:/msys64/mingw64/x86_64-w64-mingw32/include/minwindef.h:163, from C:/msys64/mingw64/x86_64-w64-mingw32/include/windef.h:8, from C:/msys64/mingw64/x86_64-w64-mingw32/include/windows.h:69, from C:/msys64/mingw64/x86_64-w64-mingw32/include/winsock2.h:23, from ./include/ruby/win32.h:41, from ./include/ruby/defines.h:250, from ./include/ruby/ruby.h:29, from ./include/ruby.h:33, from internal.h:15, from mjit.c:76: C:/msys64/mingw64/x86_64-w64-mingw32/include/psdk_inc/intrin-impl.h:1420:7: note: expected 'void * volatile*' but argument is of type 'VALUE (**)(struct rb_execution_context_struct *, struct rb_control_frame_struct *) {aka long long unsigned int (**)(struct rb_execution_context_struct *, struct rb_control_frame_struct *)}' void *_InterlockedExchangePointer(void *volatile *Target,void *Value) { ^~~~~~~~~~~~~~~~~~~~~~~~~~~ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62239 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: determine prefix of MJIT header at runtimek0kubun2018-02-051-4/+31
| | | | | | | | | | | | | | | | | so that MJIT can work if Ruby is distributed as prebuilt binary. Now mjit_init() depends on the internal const TMP_RUBY_PREFIX which is only available after ruby_init_loadpath_safe() (L1608) and before ruby_init_prelude() (L1681). So the place of mjit_init() is moved. Makefile.in: Removed static prefix from MJIT_HEADER_ISNTALL_DIR macro. And this removes the unused LIBRUBY_LIBDIR macro as well. win32/Makefile.sub: ditto. Patch by: Lars Kanis <lars@greiz-reinsdorf.de> [Bug #14445] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62238 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: prefer using --jit-cc=clang if __clang__k0kubun2018-02-051-1/+1
| | | | | | | | | | | is defined. This is basically for OpenBSD. Failure on using the compiler which is not used for Ruby compilation is not supported. [Bug #14440] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62230 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: try changing the order of includesk0kubun2018-02-051-8/+9
| | | | | | | | | | | | | | | | | | | | | | | Hoping to fix the AIX's build failure like: In file included from ./include/ruby/defines.h:139:0, from ./include/ruby/ruby.h:29, from ./include/ruby.h:33, from internal.h:15, from mjit.c:81: /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/4.8.1/include-fixed/unistd.h:939:14: error: conflicting types for 'ftruncate64' extern int ftruncate64(int, off64_t); ^ In file included from ./include/ruby/defines.h:139:0, from ./include/ruby/ruby.h:29, from ./include/ruby.h:33, from internal.h:15, from mjit.c:81: /opt/freeware/lib/gcc/powerpc-ibm-aix7.1.0.0/4.8.1/include-fixed/unistd.h:937:14: note: previous declaration of 'ftruncate64' was here extern int ftruncate(int, off_t); ^ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62227 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* assigning void* to a function pointer is a POSIXismshyouhei2018-02-051-9/+9
| | | | | | | | No implicit cast is defined between these types. Should be explicit. Also, NULL is defined to be ((void*)0) so not usable as a function pointer value. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62221 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* va_copy is a C99ismshyouhei2018-02-051-4/+0
| | | | | | Should provide appropriate fallback implementation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62220 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
* mjit.c: define __EXTENSIONS__ earlierk0kubun2018-02-041-4/+4
| | | | | | | | | | | | | | | | | | Another try of r62204 and r62192. As far as I can see from solaris's signal.h and sys/procset.h, the only possibility that causes the following error would be that sys/procset.h is included without __EXTENSIONS__ and signal.h included it again but it doesn't define procset_t. Let's define __EXTENSIONS__ from first. --- In file included from vm_core.h:87:0, from mjit.c:85: /usr/include/signal.h:77:29: error: unknown type name 'procset_t' extern int sigsendset(const procset_t *, int); ^ git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@62211 b2dd03c8-39d4-4d8f-98ff-823fe69b080e