Alan Wu cdcabd8a44
Backport 3.3: YJIT memory leak fix with additional CI fixes (#9841)
merge revision(s) 2cc7a56e,b0711b1,db5d9429: [Backport #20209]

	YJIT: Avoid leaks by skipping objects with a singleton class

	For receiver with a singleton class, there are multiple vectors YJIT can
	end up retaining the object. There is a path in jit_guard_known_klass()
	that bakes the receiver into the code, and the object could also be kept
	alive indirectly through a path starting at the CME object baked into
	the code.

	To avoid these leaks, avoid compiling calls on objects with a singleton
	class.

	See: https://github.com/Shopify/ruby/issues/552

	[Bug #20209]
	---
	 yjit/bindgen/src/main.rs       |  1 +
	 yjit/src/codegen.rs            | 17 +++++++++++++++++
	 yjit/src/cruby_bindings.inc.rs |  1 +
	 yjit/src/stats.rs              |  2 ++
	 4 files changed, 21 insertions(+)

	YJIT: Fix tailcall and JIT entry eating up FINISH frames (#9729)

	Suppose YJIT runs a rb_vm_opt_send_without_block()
	fallback and the control frame stack looks like:

	```
	will_tailcall_bar [FINISH]
	caller_that_used_fallback
	```

	will_tailcall_bar() runs in the interpreter and sets up a tailcall.
	Right before JIT_EXEC() in the `send` instruction, the stack will look like:

	```
	bar [FINISH]
	caller_that_used_fallback
	```

	Previously, JIT_EXEC() ran bar() in JIT code, which caused the `FINISH`
	flag to return to the interpreter instead of to the JIT code running
	caller_that_used_fallback(), causing code to run twice and probably
	crash. Recent flaky failures on CI about "each stub expects a particular
	iseq" are probably due to leaving methods twice in
	`test_optimizations.rb`.

	Only run JIT code from the interpreter if a new frame is pushed.
	---
	 test/ruby/test_optimization.rb | 11 +++++++++++
	 vm_exec.h                      |  3 ++-
	 2 files changed, 13 insertions(+), 1 deletion(-)

	YJIT: No need to RESTORE_REG now that we reject tailcalls

	Thanks to Kokubun for noticing.

	Follow-up: b0711b1cf152afad0a480ee2f9bedd142a0d24ac
	---
	 vm_exec.h | 1 -
	 1 file changed, 1 deletion(-)
2024-03-14 16:26:02 +00:00
2023-11-14 16:22:03 -05:00
2023-11-23 17:17:28 +09:00
2023-10-11 13:32:54 +09:00
2023-12-07 15:52:35 -05:00
2023-11-23 02:15:42 +09:00
2023-11-23 17:17:28 +09:00
2023-12-23 09:51:30 -05:00
2023-11-02 10:06:03 +09:00
2023-12-07 15:52:35 -05:00
2023-12-19 13:09:36 -08:00
2023-12-24 14:56:06 -05:00
2023-10-12 14:47:01 +09:00
2023-11-14 15:56:57 +09:00
2023-12-07 15:52:35 -05:00
2023-12-24 13:59:34 +09:00
2024-02-01 04:33:30 +00:00
2023-12-18 20:17:43 +09:00
GPL
2023-12-15 13:42:19 -05:00
2023-12-17 00:21:00 +09:00
2023-12-07 15:52:35 -05:00
2023-12-07 15:52:35 -05:00
2023-12-25 14:52:06 +09:00
2023-10-30 00:19:43 +09:00
2023-10-14 11:08:43 +09:00
2023-12-07 09:23:02 -08:00
2023-10-06 16:33:44 +09:00
2023-12-15 11:58:43 +09:00
2023-12-12 17:24:17 -05:00
2023-12-20 16:23:38 +09:00
2023-12-07 15:52:35 -05:00
2023-11-03 10:41:48 +09:00
2023-11-03 10:41:48 +09:00
2023-12-22 11:24:04 -08:00
2023-12-22 22:18:14 -08:00
2023-12-08 01:20:15 +09:00
2023-12-04 13:57:12 -05:00
2023-12-15 11:58:43 +09:00
2023-11-14 15:56:57 +09:00
2023-12-07 15:52:35 -05:00
2023-10-12 14:47:01 +09:00
2023-12-02 21:48:00 +09:00
2023-12-02 21:48:00 +09:00
2023-12-07 15:52:35 -05:00
2023-12-07 15:52:35 -05:00
2023-12-15 13:42:19 -05:00
2023-11-23 17:17:28 +09:00
2023-10-12 14:47:01 +09:00
2023-12-07 09:23:02 -08:00
2024-02-04 05:37:33 +00:00

Actions Status: MinGW Actions Status: RJIT Actions Status: Ubuntu Actions Status: Windows AppVeyor status Travis Status

What is Ruby?

Ruby is an interpreted object-oriented programming language often used for web development. It also offers many scripting features to process plain text and serialized files, or manage system tasks. It is simple, straightforward, and extensible.

Features of Ruby

  • Simple Syntax
  • Normal Object-oriented Features (e.g. class, method calls)
  • Advanced Object-oriented Features (e.g. mix-in, singleton-method)
  • Operator Overloading
  • Exception Handling
  • Iterators and Closures
  • Garbage Collection
  • Dynamic Loading of Object Files (on some architectures)
  • Highly Portable (works on many Unix-like/POSIX compatible platforms as well as Windows, macOS, etc.) cf. https://docs.ruby-lang.org/en/master/maintainers_md.html#label-Platform+Maintainers

How to get Ruby

For a complete list of ways to install Ruby, including using third-party tools like rvm, see:

https://www.ruby-lang.org/en/downloads/

You can download release packages and the snapshot of the repository. If you want to download whole versions of Ruby, please visit https://www.ruby-lang.org/en/downloads/releases/.

Download with Git

The mirror of the Ruby source tree can be checked out with the following command:

$ git clone https://github.com/ruby/ruby.git

There are some other branches under development. Try the following command to see the list of branches:

$ git ls-remote https://github.com/ruby/ruby.git

You may also want to use https://git.ruby-lang.org/ruby.git (actual master of Ruby source) if you are a committer.

How to build

See Building Ruby

Ruby home page

https://www.ruby-lang.org/

Documentation

Mailing list

There is a mailing list to discuss Ruby. To subscribe to this list, please send the following phrase:

join

in the mail subject (not body) to the address ruby-talk-request@ml.ruby-lang.org.

Copying

See the file COPYING.

Feedback

Questions about the Ruby language can be asked on the Ruby-Talk mailing list or on websites like https://stackoverflow.com.

Bugs should be reported at https://bugs.ruby-lang.org. Read "Reporting Issues" for more information.

Contributing

See "Contributing to Ruby", which includes setup and build instructions.

The Author

Ruby was originally designed and developed by Yukihiro Matsumoto (Matz) in 1995.

matz@ruby-lang.org

Description
Languages
Ruby 58.9%
C 29.5%
Rust 6.1%
C++ 2.9%
Yacc 0.9%
Other 1.6%