Commit graph

1652 commits

Author SHA1 Message Date
nagachika
d5fc3fa4db win32/win32.c Fix PROT_EXEC bit flag check for FlushInstrucitonCache() 2021-12-30 21:16:29 +09:00
U.Nakamura
4e007d705c Fix some bornheads 2021-12-27 17:15:09 +09:00
U.Nakamura
85a426dc86 Tiny mmap emulation for Windows
- prerequisite of supporting YJIT with VC++.
- note that now can specfily `--yjit` on mswin64, but not enabled
  YJIT'ed code because of YJIT requires `OPT_DIRECT_THREADED_CODE`
  or `OPT_CALL_THREADED_CODE` in `rb_yjit_compile_iseq`.
2021-12-27 15:56:23 +09:00
Takashi Kokubun
11b8aaa26a
Rename --jit to --mjit (#5248)
* Rename --jit to --mjit

[Feature #18349]

* Fix a few more --jit references

* Fix MJIT Actions

* More s/jit/mjit/ and re-introduce --disable-jit

* Update NEWS.md

* Fix test_bug_reporter_add
2021-12-13 16:08:01 -08:00
Nobuyoshi Nakada
fe506d7945
[MSWin] Stop passing non-numeric string to exit command 2021-12-02 16:07:17 +09:00
Nobuyoshi Nakada
1c4cf43480
[MSWin] Replace -Zi in DEBUGFLAGS with -Z7 to suppress warnings 2021-11-26 20:49:33 +09:00
Alan Wu
3d19c2900e No need to link and install .pdb anymore
With /Z7, no .pdb file is generated, so trying to link it during build
fails on my machine even though it's okay on CI.

By the way, in my local testing, no .pdb is generated in cwd at runtime
even without the /Fd option. I guess we can pass it just in case.
2021-11-24 23:45:57 +09:00
Alan Wu
e6f4a39a4d MJIT MSVC: Use /Z7 to avoid PDB write race
With MSVC, MJIT uses the /Fd option on an installed PDB file when
compiling. Combined with the /Zi option, this causes the PDB file to be
modified every time MJIT compiles. Concurrent modifications to the same
PDB file is known to cause problems. MSVC even has an option, /FS to
deal with it. When running MJIT tests in parallel, sometimes this leads
to corrupting the PDB file, breaking subsequent compilations. On CI,
we get messages like these:

    rb_mjit_header-3.1.0.pdb is not the pdb file that was used when this precompiled header was created, recreate the precompiled header.

To avoid this race, use the /Z7 option when building precompiled header,
which asks the compiler to put debug info into the .obj file,
eliminating the need for pointing the compiler to the PDB file for the
precompiled header.

The /Fd option is changed to use a unique path based on the name of the
dll output. Because of the /debug linker flag, we generate a PDB file
at runtime even though we use /Z7.

There are a couple things missing from this change:
 - Because MJIT uses the interpreter's CFLAGS build option and that
   contains /Zi, putting /Z7 at the end leads to a build warning
 - With /Z7 no PDB file is built anymore, so the code for installing
   the PDB file can be removed

There might also be other problems with this change I haven't noticed
while developing this change using Github Actions. I don't have a
Windows dev environment with Visual Studio so I can't finish this
change easily. Please feel free to complete this change if it makes
sense.

Note:
 - On master, you can see the PDB file changing with llvm-pdbutil or a
   simple checksum. There is an age field in the file that is bumped
 - I'm not sure if users can specify compile flags on MSVC. If they
   couldn't, maybe it's easier to change MJIT's compile options to
   use /Z7 when building the precompile header.
 - MJIT could pass different options at runtime to generate fewer
   files. Right now it inherits the /DEBUG linker flag which causes
   a PDB file to be generated at runtime even though /Z7 is used.

Relevant MSVC docs:
 - [/Zi,/Z7](https://docs.microsoft.com/en-us/cpp/build/reference/z7-zi-zi-debug-information-format?view=msvc-160)
 - [/DEBUG](https://docs.microsoft.com/en-us/cpp/build/reference/debug-generate-debug-info?view=msvc-160)
 - [/FS](https://docs.microsoft.com/en-us/cpp/build/reference/fs-force-synchronous-pdb-writes?view=msvc-160)
2021-11-24 23:45:57 +09:00
Yuta Saito
8590d61ea9 Select including thread impl file at config time 2021-10-30 10:18:33 +09:00
Aaron Patterson
41f405c486 Remove the scraper
Now that we're using the jit function entry point, we don't need the
scraper.  Thank you for your service, scraper. ❤️
2021-10-20 18:19:38 -04:00
Jose Narvaez
4e2eb7695e Yet Another Ruby JIT!
Renaming uJIT to YJIT. AKA s/ujit/yjit/g.
2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
e4c65ec49c Refactor uJIT code into more files for readability 2021-10-20 18:19:26 -04:00
Alan Wu
7e400ddc79 Try to fix Windows build 2021-10-20 18:19:24 -04:00
xtkoba
0cf9197988 Clang never evaluates expr in __builtin_assume 2021-10-04 08:13:37 +09:00
Nobuyoshi Nakada
e0ef4899f3 [Win32] Prefer Cryptography Next Generation API
[BCryptGenRandom] is available since Windows Vista / Windows
Server 2008.

Regarding [CryptGenRandom]:
> This API is deprecated. New and existing software should start
> using Cryptography Next Generation APIs. Microsoft may remove
> this API in future releases.

[BCryptGenRandom]: https://docs.microsoft.com/en-us/windows/win32/api/bcrypt/nf-bcrypt-bcryptgenrandom
[CryptGenRandom]: https://docs.microsoft.com/en-us/windows/win32/api/wincrypt/nf-wincrypt-cryptgenrandom
2021-10-02 21:22:33 +09:00
Nobuyoshi Nakada
845c017e08
Reminders of the Windows versions each API is available [ci skip] 2021-09-24 12:31:20 +09:00
Nobuyoshi Nakada
98c5907c65
Ripper source on mswin
* Get rid of command substitution for cmd.exe.
* Separate RM1 command to remove single file sans directory.
2021-09-21 13:05:27 +09:00
xtkoba (Tee KOBAYASHI)
e32fe3ce76 MINGW: _WIN64 is not defined on i386-mingw32 + ucrt. 2021-09-20 00:15:30 +09:00
xtkoba (Tee KOBAYASHI)
4705ebd907 MINGW: Fix build error on Windows UCRT 2021-09-20 00:15:30 +09:00
Nobuyoshi Nakada
c4c0b60d92
Add missing empty macro [ci skip] 2021-08-25 18:28:27 +09:00
Nobuyoshi Nakada
147bdcc436
[Win32] put a space before configure options [Bug #17588]
Not to be concatenated with the preceding `--with-`* option.
2021-08-15 01:01:24 +09:00
Nobuyoshi Nakada
6e60fc2945
Group commands on GitHub Actions 2021-08-07 18:32:24 +09:00
Yusuke Endoh
405644f38c Revert "Removed extinit.o from main programs"
This reverts commit ac86fcbfd0.

This change broke "--disable-shared --with-static-linked-ext".
2021-08-05 14:48:24 +09:00
Nobuyoshi Nakada
8a5e161cd9
Set ENCSTATIC in rbconfig.rb [Bug #17929] 2021-07-06 02:13:56 +09:00
Nobuyoshi Nakada
eaa1c3190a
[Win32] Fix assembler name when cross compiling
Hostx64\x86\nmake.exe sets AS to ml64 which targets amd64, but we
need assembler for x86.
2021-07-04 11:17:01 +09:00
Samuel Williams
71146bd4a3 Remove copy coroutine build rule. 2021-07-03 22:50:04 +12:00
Nobuyoshi Nakada
ac86fcbfd0
Removed extinit.o from main programs
It is included in libruby, which is linked into the main programs.
2021-07-03 12:52:46 +09:00
Jeremy Evans
7c31ecd3ac Add parentheses to avoid pointless condition
Pointed out by xtkoba (Tee KOBAYASHI).

Fixes [Bug #17946]
2021-06-23 21:48:42 +09:00
Nobuyoshi Nakada
9ba335e2eb
[Win32] fixed PACKED_STRUCT_UNALIGNED on x86
Use MACHINE for x86 CPU family, ARCH is CPU model name (i386) and
cannot be x86.
2021-06-09 18:49:14 +09:00
Gabriel Nagy
229cb0fcdb
[Win32] long path name support [Bug #12551]
Implement long path support on Windows by applying Microsoft's
recommended application manifest.

To make this work on both Visual C++ and MinGW, include the manifest as
a resource when generating the resource files. This way it will be
embedded into the executables generated by both compilers.

It's important for the manifest resource to have ID 1, otherwise GCC
will embed a default manifest.

Note that in addition to this, the user needs to have [long paths enabled]
either by modifying the registry or by enabling a group policy.

[long paths enabled]: https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later

Co-authored-by: Nobuyoshi Nakada <nobu@ruby-lang.org>
2021-05-17 08:33:08 +09:00
xtkoba
44cff500a0 _MSC_VER may not be defined 2021-05-04 20:38:25 -04:00
Nobuyoshi Nakada
0a93a3f4c6
win32: fix RUBY_RELEASE_DATE in Makefile
As it is overridden by the definition in common.mk, instead define
YEAR, MONTH and DAY which are used there.

This macro is useful for daily build&installation by the
combination with "relative-load", for example:
```sh
$ ./configure --prefix=/. --enable-load-relative \
  --with-destdir='$(HOME)/.rbenv/versions/$(RUBY_RELEASE_DATE)'
```
This can install images usable by rbenv per days.
2021-04-10 11:54:40 +09:00
Kazuhiro NISHIYAMA
5b54dc9ab2
Remove unused DEFAULT_KCODE 2021-03-17 21:00:46 +09:00
Nobuyoshi Nakada
e85bffc324
Increment global variables atomically 2021-03-08 17:46:07 +09:00
Nobuyoshi Nakada
b7d4dcf3a6
Make vm_exit_handler installation MT-safe 2021-03-08 17:46:07 +09:00
Nobuyoshi Nakada
9299703b39
Make uenvarea thread exclusive 2021-03-08 17:46:07 +09:00
Nobuyoshi Nakada
8c943e3be8
Make the flag in thread_exclusive unique 2021-03-08 17:46:07 +09:00
Nobuyoshi Nakada
1a00402987
Enclose crtitical sections in thread_exclusive block 2021-03-08 17:45:02 +09:00
Nobuyoshi Nakada
a12e950816
Revert "Enclose crtitical sections in thread_exclusive block"
19cc24b34b and fixups.
2021-02-24 03:13:07 +09:00
Nobuyoshi Nakada
7563d542d6
Use the system getenv in setup_debug_log
As ruby_set_debug_option() is called before ruby_sysinit(),
CRITICAL_SECTIONs are not initialized yet.
2021-02-23 23:11:44 +09:00
Nobuyoshi Nakada
819dd464de
Fixed commit miss at 41eb4fbf86 2021-02-23 21:23:46 +09:00
Nobuyoshi Nakada
5a4742a0b4
Make uenvarea thread exclusive 2021-02-23 21:19:25 +09:00
Nobuyoshi Nakada
41eb4fbf86
Fixed commit miss at 19cc24b34b 2021-02-23 20:46:40 +09:00
Nobuyoshi Nakada
da18d6f015
Constified possible data 2021-02-23 19:28:03 +09:00
Nobuyoshi Nakada
19cc24b34b Enclose crtitical sections in thread_exclusive block 2021-02-23 19:03:54 +09:00
Andrew Aladjev
0d76636117 added mutexes for socket and connection lists on win32 2021-02-23 16:20:01 +09:00
Nobuyoshi Nakada
67d2619463 Expand final path name buffer for namespace prefix
As final path name includes the namespace prefix, so expand room
for it in path name buffer.
2021-02-22 19:48:15 +09:00
Nobuyoshi Nakada
4e32a4ab81 Search subclasses from constants 2021-02-22 13:24:27 +09:00
Nobuyoshi Nakada
cc8e966e3c
MSys is a variant of Cygwin 2021-02-20 23:33:22 +09:00
Nobuyoshi Nakada
169c726f60
[Win32] Fixed preprocessed file path
Output preprocessed files under the corresponding directory to the
source files.
2021-02-20 21:05:57 +09:00