summaryrefslogtreecommitdiff
path: root/tool/ruby_vm/views
Commit message (Collapse)AuthorAgeFilesLines
* Rename opes to operands on RubyVM::BaseInstructionJohn Hawthorn2023-03-164-6/+6
|
* Rename opes to operandsJohn Hawthorn2023-03-161-2/+2
| | | Co-authored-by: Aaron Patterson <aaron.patterson@gmail.com>
* Re-add RJIT::Instruction#opesJohn Hawthorn2023-03-161-1/+2
|
* RJIT: Simplify RubyVM::RJIT::InstructionTakashi Kokubun2023-03-101-27/+1
|
* s/MJIT/RJIT/Takashi Kokubun2023-03-062-2/+2
|
* Rename MJIT filenames to RJITTakashi Kokubun2023-03-061-0/+0
|
* Remove obsoleted mjit_sp_inc.inc.erbTakashi Kokubun2023-03-061-17/+0
|
* Decode trace insns properlyTakashi Kokubun2023-03-051-1/+2
|
* Move modules aroundTakashi Kokubun2023-03-051-2/+0
|
* Fix incorrect line numbers in GC hookPeter Zhu2023-02-241-0/+25
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | If the previous instruction is not a leaf instruction, then the PC was incremented before the instruction was ran (meaning the currently executing instruction is actually the previous instruction), so we should not increment the PC otherwise we will calculate the source line for the next instruction. This bug can be reproduced in the following script: ``` require "objspace" ObjectSpace.trace_object_allocations_start a = 1.0 / 0.0 p [ObjectSpace.allocation_sourceline(a), ObjectSpace.allocation_sourcefile(a)] ``` Which outputs: [4, "test.rb"] This is incorrect because the object was allocated on line 10 and not line 4. The behaviour is correct when we use a leaf instruction (e.g. if we replaced `1.0 / 0.0` with `"hello"`), then the output is: [10, "test.rb"]. [Bug #19456]
* Polish the public docs for MJIT [ci skip]Takashi Kokubun2022-12-221-1/+1
| | | | | Now every private interface is cleaned up, and the public interface is documented.
* Put RubyVM::MJIT::Compiler under ruby_vm directory (#6989)Takashi Kokubun2022-12-211-0/+0
| | | [Misc #19250]
* MJIT: Rename mjit_compile_attr to mjit_sp_incTakashi Kokubun2022-11-291-0/+0
| | | | There's no mjit_compile.inc, so no need to use this prefix anymore.
* mjit_c.rb doesn't need to be an erbTakashi Kokubun2022-09-231-137/+0
|
* Mix manual and auto-generated C APIsTakashi Kokubun2022-09-231-0/+124
|
* Bindgen macro with builtinTakashi Kokubun2022-09-231-0/+10
|
* Builtin RubyVM::MJIT::CTakashi Kokubun2022-09-232-1/+4
|
* Introduce --basedir to insns2vm.rbTakashi Kokubun2022-09-181-0/+0
| | | | and leverage that to preserve the directory structure under tool/ruby_vm/views
* Revert "Preserve the directory structure under tool/ruby_vm/views"Takashi Kokubun2022-09-181-0/+0
| | | | | | This reverts commit 62ec621f8c7457374d1f08aec97138ac1b7bdf2a. will revisit this once fixing non-MJIT targets
* Preserve the directory structure under tool/ruby_vm/viewsTakashi Kokubun2022-09-181-0/+0
| | | | for nested target directories
* Demote mjit_instruction.rb from builtin to stdlibTakashi Kokubun2022-09-181-0/+0
|
* Fix warnings from private_constantTakashi Kokubun2022-09-051-1/+1
| | | | `private_constant *constants` seems to be warned for some reason
* Ruby MJIT (#6028)Takashi Kokubun2022-09-0410-657/+57
|
* New constant caching insn: opt_getconstant_pathJohn Hawthorn2022-09-012-3/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Previously YARV bytecode implemented constant caching by having a pair of instructions, opt_getinlinecache and opt_setinlinecache, wrapping a series of getconstant calls (with putobject providing supporting arguments). This commit replaces that pattern with a new instruction, opt_getconstant_path, handling both getting/setting the inline cache and fetching the constant on a cache miss. This is implemented by storing the full constant path as a null-terminated array of IDs inside of the IC structure. idNULL is used to signal an absolute constant reference. $ ./miniruby --dump=insns -e '::Foo::Bar::Baz' == disasm: #<ISeq:<main>@-e:1 (1,0)-(1,13)> (catch: FALSE) 0000 opt_getconstant_path <ic:0 ::Foo::Bar::Baz> ( 1)[Li] 0002 leave The motivation for this is that we had increasingly found the need to disassemble the instructions between the opt_getinlinecache and opt_setinlinecache in order to determine the constant we are fetching, or otherwise store metadata. This disassembly was done: * In opt_setinlinecache, to register the IC against the constant names it is using for granular invalidation. * In rb_iseq_free, to unregister the IC from the invalidation table. * In YJIT to find the position of a opt_getinlinecache instruction to invalidate it when the cache is populated * In YJIT to register the constant names being used for invalidation. With this change we no longe need disassemly for these (in fact rb_iseq_each is now unused), as the list of constant names being referenced is held in the IC. This should also make it possible to make more optimizations in the future. This may also reduce the size of iseqs, as previously each segment required 32 bytes (on 64-bit platforms) for each constant segment. This implementation only stores one ID per-segment. There should be no significant performance change between this and the previous implementation. Previously opt_getinlinecache was a "leaf" instruction, but it included a jump (almost always to a separate cache line). Now opt_getconstant_path is a non-leaf (it may raise/autoload/call const_missing) but it does not jump. These seem to even out.
* Rename mjit_compile.c to mjit_compiler.cTakashi Kokubun2022-08-211-1/+1
| | | | | | I'm planning to introduce mjit_compiler.rb, and I want to make this consistent with it. Consistency with compile.c doesn't seem important for MJIT anyway.
* Rename mjit_exec to jit_exec (#6262)Takashi Kokubun2022-08-191-1/+1
| | | | | | | * Rename mjit_exec to jit_exec * Rename mjit_exec_slowpath to mjit_check_iseq * Remove mjit_exec references from comments
* Expand tabs [ci skip]Takashi Kokubun2022-07-211-2/+2
| | | | [Misc #18891]
* Separate TS_IVC and TS_ICVARC in is_entries buffersJemma Issroff2022-07-181-1/+2
| | | | This allows us to treat cvar caches differently than ivar caches.
* Implement Objects on VWAPeter Zhu2022-07-151-0/+9
| | | | | | This commit implements Objects on Variable Width Allocation. This allows Objects with more ivars to be embedded (i.e. contents directly follow the object header) which improves performance through better cache locality.
* Adjust indent [ci skip]Nobuyoshi Nakada2022-06-301-6/+8
|
* Move function to `static inline` so we don't have leaked globalsAaron Patterson2022-06-291-0/+16
| | | | | This function shouldn't leak and is only needed during instruction assembly
* Finer-grained constant cache invalidation (take 2)Kevin Newton2022-04-011-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | This commit reintroduces finer-grained constant cache invalidation. After 8008fb7 got merged, it was causing issues on token-threaded builds (such as on Windows). The issue was that when you're iterating through instruction sequences and using the translator functions to get back the instruction structs, you're either using `rb_vm_insn_null_translator` or `rb_vm_insn_addr2insn2` depending if it's a direct-threading build. `rb_vm_insn_addr2insn2` does some normalization to always return to you the non-trace version of whatever instruction you're looking at. `rb_vm_insn_null_translator` does not do that normalization. This means that when you're looping through the instructions if you're trying to do an opcode comparison, it can change depending on the type of threading that you're using. This can be very confusing. So, this commit creates a new translator function `rb_vm_insn_normalizing_translator` to always return the non-trace version so that opcode comparisons don't have to worry about different configurations. [Feature #18589]
* Revert "Finer-grained inline constant cache invalidation"Nobuyoshi Nakada2022-03-251-2/+2
| | | | | | | | | | | | This reverts commits for [Feature #18589]: * 8008fb7352abc6fba433b99bf20763cf0d4adb38 "Update formatting per feedback" * 8f6eaca2e19828e92ecdb28b0fe693d606a03f96 "Delete ID from constant cache table if it becomes empty on ISEQ free" * 629908586b4bead1103267652f8b96b1083573a8 "Finer-grained inline constant cache invalidation" MSWin builds on AppVeyor have been crashing since the merger.
* Finer-grained inline constant cache invalidationKevin Newton2022-03-241-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Current behavior - caches depend on a global counter. All constant mutations cause caches to be invalidated. ```ruby class A B = 1 end def foo A::B # inline cache depends on global counter end foo # populate inline cache foo # hit inline cache C = 1 # global counter increments, all caches are invalidated foo # misses inline cache due to `C = 1` ``` Proposed behavior - caches depend on name components. Only constant mutations with corresponding names will invalidate the cache. ```ruby class A B = 1 end def foo A::B # inline cache depends constants named "A" and "B" end foo # populate inline cache foo # hit inline cache C = 1 # caches that depend on the name "C" are invalidated foo # hits inline cache because IC only depends on "A" and "B" ``` Examples of breaking the new cache: ```ruby module C # Breaks `foo` cache because "A" constant is set and the cache in foo depends # on "A" and "B" class A; end end B = 1 ``` We expect the new cache scheme to be invalidated less often because names aren't frequently reused. With the cache being invalidated less, we can rely on its stability more to keep our constant references fast and reduce the need to throw away generated code in YJIT.
* Add ISEQ_BODY macroPeter Zhu2022-03-241-3/+3
| | | | | | Use ISEQ_BODY macro to get the rb_iseq_constant_body of the ISeq. Using this macro will make it easier for us to change the allocation strategy of rb_iseq_constant_body when using Variable Width Allocation.
* Make `leaf` const in VM generatorAlan Wu2021-12-051-1/+1
| | | | Assigning to `leaf` in insns.def would give undesirable results.
* vm_core.h: Avoid unaligned access to ic_serial on 32-bit machineYusuke Endoh2021-10-291-2/+2
| | | | This caused Bus error on 32 bit Solaris
* Remove the scraperAaron Patterson2021-10-202-38/+0
| | | | | Now that we're using the jit function entry point, we don't need the scraper. Thank you for your service, scraper. ❤️
* Remove some MicroJIT vestigesAaron Patterson2021-10-202-3/+3
| | | | Just happened to run across this, so lets fix them
* Yet Another Ruby JIT!Jose Narvaez2021-10-202-5/+5
| | | | Renaming uJIT to YJIT. AKA s/ujit/yjit/g.
* Restore interpreter regs in ujit hook. Implement leave bytecode.Maxime Chevalier-Boisvert2021-10-201-4/+5
|
* Refactor uJIT code into more files for readabilityMaxime Chevalier-Boisvert2021-10-201-0/+0
|
* Include disassembly in MicroJIT scraper outputAlan Wu2021-10-201-2/+7
|
* Add to the MicroJIT scraper an example that passes ecAlan Wu2021-10-202-4/+5
|
* Fix compilation for OPT_THREADED_CODE=2Alan Wu2021-10-201-3/+6
|
* Compile with MicroJIT disabled when scrape failsAlan Wu2021-10-201-2/+4
| | | | | This is just so we can build successfully on -O0 and other cases that are not supported by the code scraper.
* Refactor ujit_examples.h generator. Remove dwarfdump dependencyAlan Wu2021-10-202-1/+17
|
* Remove PC argument from ujit instructionsMaxime Chevalier-Boisvert2021-10-201-1/+1
|
* Yeah, this actually works!Alan Wu2021-10-201-1/+1
|
* Add example handler for ujit and scrape it from vm.oAlan Wu2021-10-201-0/+10
|