summaryrefslogtreecommitdiff
path: root/bootstraptest
Commit message (Collapse)AuthorAgeFilesLines
...
* allow to access ivars of classes/modulesKoichi Sasada2021-10-232-3/+50
| | | | | if an ivar of a class/module refer to a shareable object, this ivar can be read from non-main Ractors.
* Fix simple test on platforms where compaction is not supportedAlan Wu2021-10-221-1/+5
| | | | | | 844588f9157b364244a7d34ee0fcc70ccc2a7dd9 made it so that trying to call gc_verify_compaction_references on unsupported platform result in an exception rather than a crash. Rescue the exception in a YJIT btest that uses gc_verify_compaction_references.
* YJIT: don't compile attr_accessor methods when tracing (#4998)Alan Wu2021-10-211-0/+50
| | | | | | | | | | | | | | | | 2d98593bf54a37397c6e4886ccc7e3654c2eaf85 made it so that attr_accessor methods fire C method tracing events. Previously, we weren't checking for whether we are tracing before compiling, leading to missed events. Since global invalidation invalidates all code, and that attr_accessor methods can never enable tracing while running, events are only dropped when YJIT tries to compile when tracing is already enabled. Factor out the code for checking tracing and check it before generating code for attr_accessor methods. This change fixes TestSetTraceFunc#test_tracepoint_attr when it's ran in isolation.
* * append newline at EOF. [ci skip]git2021-10-212-2/+2
|
* Do kwarg shuffle after checking for interruptsAlan Wu2021-10-201-0/+39
| | | | | | | | | | | | Previously, we were shuffling keyword arguments before checking for interrupts. In the case that we side exit in the interrupt check, we left the interpreter with an already-shuffled argument list for the call, resulting in a double shuffle, leaving the locals in the wrong order for the callee. Do keyword shuffling after all the possible side exits. Co-authored-by: Kevin Newton <kddnewton@gmail.com>
* Extract yjit_force_iv_index and make it work when object is frozenAlan Wu2021-10-201-0/+15
| | | | | | | | | | | | | | | | | | In an effort to simplify the logic YJIT generates for accessing instance variable, YJIT ensures that a given name-to-index mapping exists at compile time. In the case that the mapping doesn't exist, it was created by using rb_ivar_set() with Qundef on the sample object we see at compile time. This hack isn't fine if the sample object happens to be frozen, in which case YJIT would raise a FrozenError unexpectedly. To deal with this, make a new function that only reserves the mapping but doesn't touch the object. This is rb_obj_ensure_iv_index_mapping(). This new function superceeds the functionality of rb_iv_index_tbl_lookup() so it was removed. Reported by and includes a test case from John Hawthorn <john@hawthorn.email> Fixes: GH-282
* More simple bootstrap tests for kwargsKevin Newton2021-10-201-0/+29
|
* Feedback, tests, and rebase for kwargsKevin Newton2021-10-201-27/+50
|
* Get kwargs reordering workingKevin Newton2021-10-201-0/+35
|
* Add specialization for String#to_s on plain stringsAlan Wu2021-10-201-0/+35
| | | | | | | | | | | | | | | When calling "to_s" on an instance of String, the method simply returns self. In this situation most of the work comes from setting up the method call. It turns out that both railsbench and liquid-render do this a lot. When generating code for opt_send_without_block, we already generate a known class guard, so we can detect when the receiver is a String instance. Since gen_send_cfunc() is also used for gen_invokesuper(), and gen_invokesuper() doesn't generate a known class guard, a new nullable parameter for specialized codegen function is added. Closes GH-245
* Reconstruct interpreter state before calling rb_ivar_get()Alan Wu2021-10-201-0/+20
| | | | | It could raise ractor exceptions. The included test didn't run properly before this change.
* Implement invokebuiltinJohn Hawthorn2021-10-201-0/+12
|
* Fix opt_aset comptime_key checkJohn Hawthorn2021-10-201-0/+10
|
* Fix opt_eq for overridden equalityJohn Hawthorn2021-10-201-3/+23
|
* String and fixnum equalityJohn Hawthorn2021-10-201-0/+26
|
* Exit when the object is frozenAaron Patterson2021-10-201-0/+22
| | | | Exit when the object is frozen, also add tests
* Additional invokesuper testsJohn Hawthorn2021-10-201-0/+79
|
* Add a small test for the code GCMaxime Chevalier-Boisvert2021-10-201-0/+23
|
* fix typoAlan Wu2021-10-201-1/+1
|
* TracePoint supportAlan Wu2021-10-201-0/+214
| | | | | | | | | | | | | | | | | | | | | | This change fixes some cases where YJIT fails to fire tracing events. Most of the situations YJIT did not handle correctly involves enabling tracing while running inside generated code. A new operation to invalidate all generated code is added, which uses patching to make generated code exit at the next VM instruction boundary. A new routine called `jit_prepare_routine_call()` is introduced to facilitate this and should be used when generating code that could allocate, or could otherwise use `RB_VM_LOCK_ENTER()`. The `c_return` event is fired in the middle of an instruction as opposed to at an instruction boundary, so it requires special handling. C method call return points are patched to go to a fucntion which does everything the interpreter does, including firing the `c_return` event. The generated code for C method calls normally does not fire the event. Invalided code should not change after patching so the exits are not clobbered. A new variable is introduced to track the region of code that should not change.
* Detach mapping to local in ctx_set_local_typeJohn Hawthorn2021-10-201-0/+13
| | | | | Similar to the previous fix to ctx_clear_local_types, we must detach mappings to a local if we are changing its value.
* Save PC and SP before accessing globalsAlan Wu2021-10-201-0/+32
| | | | | These instructions are marked as not leaf in insns.def, which indicate that they could raise exceptions and/or call Ruby methods.
* Add setglobal to yjiteileencodes2021-10-201-1/+9
| | | | | | | Adds yjit support for setting global variables. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org> Co-authored-by: John Hawthorn <john@hawthorn.email>
* Add getglobal to yjiteileencodes2021-10-201-0/+12
| | | | | | Adds getglobal to yjit and a test for it. Co-authored-by: Aaron Patterson <tenderlove@ruby-lang.org>
* Clear JIT code when tracepoints get enabledAaron Patterson2021-10-201-0/+42
| | | | | Clear out any JIT code on iseqs when tracepoints get enabled. We can't handle tracepoints right now, so we'll just try to recompile later.
* Add a guard that we start executing on the first PCAaron Patterson2021-10-201-0/+11
| | | | | | | Methods with optional parameters don't always start executing at the first PC, but we compile all methods assuming that they do. This commit adds a guard to ensure that we're actually starting at the first PC for methods with optional params
* Ensure we guard the value before we returnKevin Newton2021-10-201-0/+15
| | | | Otherwise you can end up not implicitly calling `to_ary`, which if it has side-effects will result in different behavior.
* Code review for expandarray and testsKevin Newton2021-10-201-0/+84
|
* Implement splatarrayKevin Newton2021-10-201-0/+9
|
* Implement opt_divKevin Deisz2021-10-201-0/+10
|
* Implement opt_multKevin Deisz2021-10-201-0/+10
| | | | Basically the same thing as opt_mod, but for multiplying.
* Add FLONUM detectionJohn Hawthorn2021-10-201-0/+19
|
* Support guards against symbols and integersJohn Hawthorn2021-10-201-0/+52
| | | | This adds guards
* Add tests, comments, and an assert for invokesuperAlan Wu2021-10-201-0/+57
|
* Handle non-material empty singleton class properlyAlan Wu2021-10-201-0/+14
| | | | | | | | | | | | | | | | | | | | As an optimization, multiple objects could share the same singleton class. The optimization introduced in 6698e433934d810b16ee3636b63974c0a75c07f0 wasn't handling this correctly so was generating guards that never pass for the inputs we defer compilation to wait for. After generating identical code multiple times and failing, the call site is falsely recognized as megamorphic and it side exits. See disassembly for the following before this commit: def foo(obj) obj.itself end o = Object.new.singleton_class foo(o) puts YJIT.disasm(method(:foo)) See also: comment in rb_singleton_class_clone_and_attach().
* Disable invokesuper codegen for now. Add testAlan Wu2021-10-201-0/+20
| | | | The added test fails with SystemStackError with --yjit-call-threshold=1.
* Fix bug in generic case for gen_checktypeAlan Wu2021-10-201-0/+20
| | | | | When checking for T_HASH, which is Qnil and when the type check succeeds we were outputting to the stack a Qnil instead of a Qtrue.
* Simplify known class check for singletonsJohn Hawthorn2021-10-201-0/+31
| | | | | | | | | Singleton classes should only ever be attached to one object. This means that checking for the object should be the same as checking for the class. This should be slightly faster by avoiding one memory acccess as well as allowing us to skip checking if the receiver is a heap object. This will be most common for calling class methods.
* Improve opt_not by expanding cfunc codegenAlan Wu2021-10-201-0/+70
| | | | | | | | | | | | | This commit improves opt_not by making it correct when TrueClass#! and/or FalseClass#! is defined and genearting better code when the receiver is a heap object. guard_known_class() can now handle true, false, and nil, and we introduce a codegen function reimplementing rb_obj_not(), used when we know we are calling into rb_obj_not(). Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Co-authored-by: Noah Gibbs <the.codefolio.guy@gmail.com>
* Implement invokebuiltin_delegateJohn Hawthorn2021-10-201-0/+30
| | | | | | | | | | invokebuiltin_delegate is a special version of invokebuiltin used for sending a contiguous subset of the current method's locals. In some cases YJIT would already handle this for trivial cases it could be inlined, implementing this OP allows it to work when the method isn't inlinable (not marked as 'inline', does more than just call, not called from yjit, etc).
* Implement topn instructionAaron Patterson2021-10-201-0/+18
| | | | | | | This commit implements the topn instruction Co-Authored-By: Maxime Chevalier-Boisvert <maxime.chevalierboisvert@shopify.com> Co-Authored-By: Noah Gibbs <noah.gibbs@shopify.com>
* Implement gen_getlocalJohn Hawthorn2021-10-201-0/+14
| | | | | This extracts the generation code from getlocal_wc1, since this is the same just with more loops inside vm_get_ep.
* Add concatstrings to yjit codegen (#58)John Hawthorn2021-10-201-0/+44
| | | | | | | | | * Add ETYPE_TRUE and ETYPE_FALSE * Implement checktype * Implement concatstrings * Update deps
* Add newhash and newarray instructions to yjit codegen (#48)John Hawthorn2021-10-201-0/+50
| | | | | | | | | | | | | * Implement gen_newarray * Implement newhash for n=0 * Add yjit tests for newhash/newarray * Fix integer size warning on clang * Save PC and SP in newhash and newarray Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>
* Implement getblockparamproxyAlan Wu2021-10-201-13/+37
| | | | | | | | | | | | | * Implement getblockparamproxy * Parallel runner: wait for timeout thread to terminate after killing Or else the leak cheaker could sees the thread as running and cause test failures in test-tool. * Add a comment, use jne * Comment about where 0x3 comes from
* Implement opt_mod as call to interpreter function (#29)Maxime Chevalier-Boisvert2021-10-201-0/+10
|
* Check for easy-to-handle cases of block param (#24)Alan Wu2021-10-201-0/+24
| | | | In some cases, methods taking block parameters don't require extra paramter setup. They are fairly popular in railsbench.
* Implement send with alias method (#23)Maxime Chevalier-Boisvert2021-10-201-0/+46
| | | | | * Implement send with alias method * Add alias_method tests
* Implement send with blocksAlan Wu2021-10-201-0/+24
| | | | | | | | | | | | | | | | | | | | | | | | | * Implement send with blocks Not that much extra work compared to `opt_send_without_block`. Moved the stack over flow check because it could've exited after changes are made to cfp. * rename oswb counters * Might as well implement sending block to cfuncs * Disable sending blocks to cfuncs for now * Reconstruct interpreter sp before calling into cfuncs In case the callee cfunc calls a method or delegates to a block. This also has the side benefit of letting call sites that sometimes are iseq calls and sometimes cfunc call share the same successor. * only sync with interpreter sp when passing a block Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com> Co-authored-by: Aaron Patterson <aaron.patterson@shopify.com>
* Use rb_ivar_get() for general case of getivar (#17)Alan Wu2021-10-201-0/+27
| | | | | | | | | * Use rb_ivar_get() for general case of getivar Pretty straight forward. Buys about 1% coverage on railsbench. * Update yjit_codegen.c Co-authored-by: Maxime Chevalier-Boisvert <maximechevalierb@gmail.com>