Commit graph

75 commits

Author SHA1 Message Date
Maxime Chevalier-Boisvert
53ff2d791d Fix bug in ctx_set_local_type() 2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert
6164274c76 Re-enable local type tracking, until first call 2021-10-20 18:19:33 -04:00
Alan Wu
31acd22d3b Assert for running out of branches in all builds 2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert
f6e3f75c2b Introduce concept of YJIT instruction operands 2021-10-20 18:19:33 -04:00
Alan Wu
b626dd7211 YJIT: Fancier opt_getinlinecache
Make sure `opt_getinlinecache` is in a block all on its own, and
invalidate it from the interpreter when `opt_setinlinecache`.
It will recompile with a filled cache the second time around.
This lets YJIT runs well when the IC for constant is cold.
2021-10-20 18:19:33 -04:00
Alan Wu
e81d1f4ae3 Fix stack-use-after-scope in gen_direct_jump()
ASAN can catch these type of things for us, but the scraper can't
handle ASAN :/.

To be more resilient to refactoring, extend the lifetime of
`generic_ctx` in branch_stub_hit() too.
2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert
42af04efee Add flag bits to avoid compiling stubs multiple times.
Fixes bug involving ractors and branch stubs.
2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert
cbbae12a96 Keep track of local types in the context 2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert
e98d2c5ec8 Add ctcx_stack_push_local() 2021-10-20 18:19:33 -04:00
Maxime Chevalier-Boisvert
0881e018b5 Add comments and asserts for clarity 2021-10-20 18:19:32 -04:00
Maxime Chevalier-Boisvert
131fc9c074 Readd const arguments 2021-10-20 18:19:32 -04:00
Maxime Chevalier-Boisvert
5b613938eb Fix branch rewrite issue 2021-10-20 18:19:32 -04:00
Maxime Chevalier-Boisvert
2b522ad9f5 Update yjit_core.c 2021-10-20 18:19:32 -04:00
Alan Wu
21a6345023 YJIT: adjust branch shape properly when target already exists
The old code decides branch->shape based on the write position of the
native code block, which is unsound in case the block already exists
and no new code is written to the write position.

Make this decision with the start address of the target block instead.
Also handle when the branch becomes smaller after patching.
2021-10-20 18:19:32 -04:00
Maxime Chevalier-Boisvert
215a2f4010 Fix type_diff logic after Alan pointed out errors 2021-10-20 18:19:32 -04:00
Maxime Chevalier-Boisvert
aee44e4f2b Part 1 of improved type tracking logic 2021-10-20 18:19:32 -04:00
Alan Wu
9911f486a7 Stop all other ractors when patching machine code 2021-10-20 18:19:32 -04:00
Maxime Chevalier-Boisvert
5ec94e0d4a Fix issue with version matching logic 2021-10-20 18:19:32 -04:00
Alan Wu
a8f7eb2f35 Polymorphic opt_send_without_block 2021-10-20 18:19:32 -04:00
Alan Wu
ec1cbbb07d Get rid of dependency on rb_call_cache 2021-10-20 18:19:32 -04:00
Alan Wu
f4c04a9595 Tweak include order in yjit_core.c
This is playing it safe. Ruby headers rely on some macros generated by
autoconf that affect what system headers behave. We should take care to
bring in those configs before including systme headers to stay
consistent with the rest of Ruby.
2021-10-20 18:19:31 -04:00
Alan Wu
5d834bcf9f YJIT: lazy polymorphic getinstancevariable
Lazily compile out a chain of checks for different known classes and
whether `self` embeds its ivars or not.

* Remove trailing whitespaces

* Get proper addresss in Capstone disassembly

* Lowercase address in Capstone disassembly

Capstone uses lowercase for jump targets in generated listings. Let's
match it.

* Use the same successor in getivar guard chains

Cuts down on duplication

* Address reviews

* Fix copypasta error

* Add a comment
2021-10-20 18:19:31 -04:00
Alan Wu
cee597bd01 Include ruby/ruby.h before vm_core.h
This is how vm.c does it, and if we don't follow it in yjit
compilation units, rb_vm_t would have a conflicting size.
2021-10-20 18:19:31 -04:00
Maxime Chevalier-Boisvert
c6156e5113 Fix trailing spaces 2021-10-20 18:19:31 -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
Renamed from ujit_core.c (Browse further)