Граф коммитов

18 Коммитов

Автор SHA1 Сообщение Дата
Alan Wu 6a9e2b3cc3 YJIT: Show GCC that the mmap probing loop runs at least once
Fixes:
    ./src/yjit_asm.c:196:8: warning: 'mem_block' may be used uninitialized [-Wmaybe-uninitialized]
2021-10-20 19:04:22 -04:00
Alan Wu 00be5846e4 Fix non RUBY_DEBUG build warnings
On non RUBY_DEBUG builds, assert() compiles to nothing and the compiler
warns about uninitialized variables in those code paths. Replace
those asserts with rb_bug() to fix the warnings and do the assert in
all builds. Since yjit_asm_tests.c compiles outside of Ruby, it needed
a distinct version of rb_bug().

Also put YJIT_STATS check for function delcaration that is only defined
in YJIT_STATS builds.
2021-10-20 18:19:43 -04:00
Alan Wu f6da559d5b Put YJIT into a single compilation unit
For upstreaming, we want functions we export either prefixed with "rb_"
or made static. Historically we haven't been following this rule, so we
were "leaking" a lot of symbols as `make leak-globals` would tell us.

This change unifies everything YJIT into a single compilation unit,
yjit.o, and makes everything unprefixed static to pass `make leak-globals`.
This manual "unified build" setup is similar to that of vm.o.

Having everything in one compilation unit allows static functions to
be visible across YJIT files and removes the need for declarations in
headers in some cases. Unnecessary declarations were removed.

Other changes of note:
  - switched to MJIT_SYMBOL_EXPORT_BEGIN which indicates stuff as being
    off limits for native extensions
  - the first include of each YJIT file is change to be "internal.h"
  - undefined MAP_STACK before explicitly redefining it since it
    collide's with a definition in system headers. Consider renaming?
2021-10-20 18:19:42 -04:00
Alan Wu f36a5a98c0 style: line break before "else" 2021-10-20 18:19:41 -04:00
Alan Wu ec4998bd69 style: switch statements indent
Case labels get half an indent and the opening brace is on the same line
as "switch".
2021-10-20 18:19:41 -04:00
Alan Wu a10cf74e5c style: align pointer "*" to the right 2021-10-20 18:19:41 -04:00
Maxime Chevalier-Boisvert 0385ca2e97 Try to break the code page refactoring into smaller steps 2021-10-20 18:19:41 -04:00
Jean Boussier 217f7cb16f Include errno message in mmap failure output
It might help figure out why it is failing.
2021-10-20 18:19:40 -04:00
Maxime Chevalier-Boisvert 350b686a2c First pass at code page GC object. 2021-10-20 18:19:37 -04:00
Maxime Chevalier-Boisvert 51c84f0033 Code page allocation code 2021-10-20 18:19:37 -04:00
Maxime Chevalier-Boisvert 6b5d26dc78 Implement basic encodings for xchg 2021-10-20 18:19:35 -04:00
Maxime Chevalier-Boisvert 5c2f74fc32 Fix encoding of test x86 instruction 2021-10-20 18:19:35 -04:00
Maxime Chevalier-Boisvert cf2b508375 Try to alloc executable memory within rel32 range on Linux machines (#12)
* Use INT32_MIN, INT32_MAX, etc. constants in yjit_asm.c

* Print warning on stderr when code past rel32 jump range

* Fix preprocessor snafu

* Move rel32 warning into --yjit-stats

* Try to allocate within rel32 offset on Linux machines

* Update yjit_asm.c

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>

* On Linux, use sysconf to get the page size

Co-authored-by: Alan Wu <XrXr@users.noreply.github.com>
2021-10-20 18:19:34 -04:00
Maxime Chevalier-Boisvert d1e9e4566f Update yjit_asm.c 2021-10-20 18:19:32 -04:00
Maxime Chevalier-Boisvert 3d53ee1761 Fill uninitialized memory with int3 2021-10-20 18:19:32 -04:00
Alan Wu d03b7f77d4 Fix GCC warnings
Mostly unused and uninitialized warnings here and there
2021-10-20 18:19:32 -04:00
Dylan Thacker-Smith 4b80358e5d Fix condition in cb_align_pos which should return early when aligned 2021-10-20 18:19:32 -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