1
0
Fork 0
mirror of https://github.com/ruby/ruby.git synced 2022-11-09 12:17:21 -05:00
ruby--ruby/test/ruby
Jemma Issroff 9ddfd2ca00 This commit implements the Object Shapes technique in CRuby.
Object Shapes is used for accessing instance variables and representing the
"frozenness" of objects.  Object instances have a "shape" and the shape
represents some attributes of the object (currently which instance variables are
set and the "frozenness").  Shapes form a tree data structure, and when a new
instance variable is set on an object, that object "transitions" to a new shape
in the shape tree.  Each shape has an ID that is used for caching. The shape
structure is independent of class, so objects of different types can have the
same shape.

For example:

```ruby
class Foo
  def initialize
    # Starts with shape id 0
    @a = 1 # transitions to shape id 1
    @b = 1 # transitions to shape id 2
  end
end

class Bar
  def initialize
    # Starts with shape id 0
    @a = 1 # transitions to shape id 1
    @b = 1 # transitions to shape id 2
  end
end

foo = Foo.new # `foo` has shape id 2
bar = Bar.new # `bar` has shape id 2
```

Both `foo` and `bar` instances have the same shape because they both set
instance variables of the same name in the same order.

This technique can help to improve inline cache hits as well as generate more
efficient machine code in JIT compilers.

This commit also adds some methods for debugging shapes on objects.  See
`RubyVM::Shape` for more details.

For more context on Object Shapes, see [Feature: #18776]

Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
Co-Authored-By: Eileen M. Uchitelle <eileencodes@gmail.com>
Co-Authored-By: John Hawthorn <john@hawthorn.email>
2022-09-26 09:21:30 -07:00
..
enc Avoid defining the same test class in multiple files 2022-04-22 15:00:16 -07:00
allpairs.rb
beginmainend.rb
bug-11928.rb
bug-13526.rb
lbtest.rb
marshaltestlib.rb
sentence.rb
test_alias.rb Fix visibility of alias of zsuper methods 2022-03-10 08:35:26 -08:00
test_argf.rb [Bug #18892] Reset ARGF.lineno after reading shebang 2022-07-07 11:33:07 +09:00
test_arithmetic_sequence.rb
test_arity.rb Make a dedecated assertion to clarify failed assertions 2022-03-19 14:33:04 +09:00
test_array.rb Fix Array#[] with ArithmeticSequence with negative steps (#5739) 2022-08-11 19:16:49 +09:00
test_assignment.rb test/ruby/test_assignment.rb: Prevent a warning 2022-01-19 13:15:37 +09:00
test_ast.rb Prevent a warning "possibly useless use of a literal in void context" 2022-06-20 19:25:11 +09:00
test_autoload.rb Prevent a warning "Expected ... to define AutoloadTest but it didn't" 2022-06-20 17:39:58 +09:00
test_backtrace.rb Add Thread.each_caller_location 2022-02-17 08:54:07 -08:00
test_basicinstructions.rb
test_beginendblock.rb
test_bignum.rb Fix the condition when a new buffer is needed without GMP 2022-06-02 10:29:53 +09:00
test_call.rb [Bug #19021] Fix safe call w/ conditional assign 2022-09-25 20:44:54 -07:00
test_case.rb
test_class.rb Remove Class#descendants 2021-12-20 11:02:15 -08:00
test_clone.rb Adding more clone tests, and adding dup tests 2022-06-16 08:48:08 -07:00
test_comparable.rb
test_complex.rb Consider Complex from Complex cases 2022-09-02 14:33:23 +09:00
test_complex2.rb Use omit instead of skip: test/ruby/**/*.rb 2022-01-04 17:25:30 +09:00
test_complexrational.rb Use omit instead of skip: test/ruby/**/*.rb 2022-01-04 17:25:30 +09:00
test_condition.rb
test_const.rb
test_continuation.rb
test_default_gems.rb Use omit instead of skip: test/ruby/**/*.rb 2022-01-04 17:25:30 +09:00
test_defined.rb
test_dir.rb Use omit instead of skip: test/ruby/**/*.rb 2022-01-04 17:25:30 +09:00
test_dir_m17n.rb
test_dup.rb Adding more clone tests, and adding dup tests 2022-06-16 08:48:08 -07:00
test_econv.rb
test_encoding.rb Deprecate Encoding#replicate 2022-09-10 19:02:15 +02:00
test_enum.rb Raise ArgumentError when calling Enumberable#inject without block or arguments 2022-03-23 07:55:49 -07:00
test_enumerator.rb Implement Enumerator::Product and Enumerator.product [Feature #18685] 2022-07-30 20:05:14 +09:00
test_env.rb [Bug #17767] Now ENV.clone raises TypeError as well as ENV.dup 2022-08-02 16:40:12 +09:00
test_eval.rb
test_exception.rb Revert "Revert "error.c: Let Exception#inspect inspect its message"" 2022-09-23 16:40:59 +09:00
test_fiber.rb rb_fiber_terminate must not return [Bug #18497] 2022-01-19 19:57:16 +09:00
test_file.rb Support Encoding::Converter newline: :lf and :lf_newline options 2022-08-19 20:23:36 -07:00
test_file_exhaustive.rb Skip failing test on FreeBSD [ci skip] 2022-06-17 14:37:15 +09:00
test_fixnum.rb
test_flip.rb
test_float.rb Add invalid hexadecimal float tests 2022-08-21 20:01:27 +09:00
test_fnmatch.rb
test_frozen.rb Added tests for setting ivars on frozen objs 2022-06-16 08:48:08 -07:00
test_frozen_error.rb
test_gc.rb Fix flaky test for GC thrashing 2022-08-17 10:54:28 -04:00
test_gc_compact.rb Implement Objects on VWA 2022-07-15 09:21:07 -04:00
test_hash.rb Fix inconsistency with opt_aref_with 2022-08-04 14:48:47 -07:00
test_ifunless.rb
test_inlinecache.rb Avoid defining the same test class in multiple files 2022-04-22 15:00:16 -07:00
test_insns_leaf.rb
test_integer.rb Add Numeric#ceildiv and Integer#ceildiv 2022-08-12 15:57:52 +09:00
test_integer_comb.rb
test_io.rb [Win32] Negative length IO#sysread 2022-09-11 23:08:14 +09:00
test_io_buffer.rb Add several new methods for getting and setting buffer contents. (#6434) 2022-09-26 18:06:12 +13:00
test_io_m17n.rb [Bug #18898] Fallback invalid external encoding to the default 2022-07-06 18:08:31 +09:00
test_iseq.rb Use omit instead of skip: test/ruby/**/*.rb 2022-01-04 17:25:30 +09:00
test_iterator.rb
test_key_error.rb
test_keyword.rb test/ruby/test_keyword.rb: Prevent warning: assigned but unused variable 2022-04-11 10:05:16 +09:00
test_lambda.rb
test_lazy_enumerator.rb
test_literal.rb
test_m17n.rb Remove get_actual_encoding() and the dynamic endian detection for dummy UTF-16/UTF-32 2022-09-12 14:02:34 +02:00
test_m17n_comb.rb
test_marshal.rb Optimize Marshal dump/load for large (> 31-bit) FIXNUM (#6229) 2022-08-15 16:14:12 -07:00
test_math.rb
test_memory_view.rb
test_metaclass.rb
test_method.rb Consider resolved-through-zsuper methods equal for compatibility 2022-08-20 13:44:00 +02:00
test_method_cache.rb
test_mixed_unicode_escapes.rb
test_mjit.rb This commit implements the Object Shapes technique in CRuby. 2022-09-26 09:21:30 -07:00
test_mjit_debug.rb Rename test_jit to test_mjit 2022-05-20 21:32:55 -07:00
test_module.rb Skip test_redefinition_mismatch on trunk-mjit for now 2022-09-06 15:40:13 +09:00
test_name_error.rb
test_nomethod_error.rb
test_not.rb
test_numeric.rb Remove Numeric#ceildiv 2022-08-12 15:57:52 +09:00
test_object.rb
test_objectspace.rb Ensure _id2ref finds symbols with the correct type 2022-07-20 10:38:44 -07:00
test_optimization.rb Use omit instead of skip: test/ruby/**/*.rb 2022-01-04 17:25:30 +09:00
test_pack.rb
test_parse.rb [Bug #18890] Suppress warnings and fix the message 2022-07-08 11:31:51 +09:00
test_path.rb
test_pattern_matching.rb Fix unexpected "duplicated key name" error in paren-less one line pattern matching 2022-09-09 14:00:27 +09:00
test_pipe.rb
test_primitive.rb
test_proc.rb Raise RuntimeError if Kernel#binding is called from a non-Ruby frame 2022-04-06 19:14:03 -07:00
test_process.rb Ignore EPERM which means already being process-leader 2022-09-20 11:12:11 +09:00
test_rand.rb Remove deprecated Random::DEFAULT [Feature #17351] 2022-01-01 18:55:52 +09:00
test_random_formatter.rb
test_range.rb Fix Range#cover? returning true for beginless ranges of different types 2022-06-06 09:59:22 -07:00
test_rational.rb
test_rational2.rb
test_readpartial.rb
test_refinement.rb Allow calling protected methods from refinements 2022-06-16 13:24:48 -07:00
test_regexp.rb [Feature #18788] Support options as String to Regexp.new 2022-06-20 19:35:12 +09:00
test_require.rb Skip failing test with freebsd 2022-05-31 11:40:38 +09:00
test_require_lib.rb Use omit instead of skip: test/ruby/**/*.rb 2022-01-04 17:25:30 +09:00
test_rubyoptions.rb Drop mswin support of MJIT (#6265) 2022-08-20 18:35:36 -07:00
test_rubyvm.rb Finer-grained constant cache invalidation (take 2) 2022-04-01 14:48:22 -04:00
test_rubyvm_mjit.rb Remove MJIT worker thread (#6006) 2022-06-15 09:40:54 -07:00
test_settracefunc.rb Implement Queue#pop(timeout: sec) 2022-08-02 11:04:28 +02:00
test_shapes.rb This commit implements the Object Shapes technique in CRuby. 2022-09-26 09:21:30 -07:00
test_signal.rb Do not create core file if it is intentional abort 2022-01-19 23:17:14 +09:00
test_sleep.rb
test_sprintf.rb [Bug #18973] Promote US-ASCII to ASCII-8BIT when adding 8-bit char 2022-08-31 17:27:59 +09:00
test_sprintf_comb.rb
test_stack.rb
test_string.rb Fix inspect for unicode codepoint 0x85 2022-08-11 08:47:29 -07:00
test_stringchar.rb
test_struct.rb A positional Hash is not keyword arguments [Bug #18632] 2022-03-17 20:53:41 +09:00
test_super.rb
test_symbol.rb [Bug #18905] Check symbol name types more strictly 2022-07-20 00:23:38 +09:00
test_syntax.rb Do not have class/module keywords look up ancestors of Object 2022-07-21 08:28:05 -07:00
test_system.rb
test_thread.rb Skip randomly failing tests with FreeBSD 12 2022-07-28 19:45:15 +09:00
test_thread_cv.rb
test_thread_queue.rb Harden SizedQueue#push timeout test 2022-08-19 00:16:44 +09:00
test_threadgroup.rb
test_time.rb [Bug #18922] Normalize time at 24:00:00 UTC 2022-07-18 00:59:27 +09:00
test_time_tz.rb Use omit instead of skip: test/ruby/**/*.rb 2022-01-04 17:25:30 +09:00
test_trace.rb
test_transcode.rb Remove get_actual_encoding() and the dynamic endian detection for dummy UTF-16/UTF-32 2022-09-12 14:02:34 +02:00
test_undef.rb
test_unicode_escape.rb
test_variable.rb
test_vm_dump.rb Use omit instead of skip: test/ruby/**/*.rb 2022-01-04 17:25:30 +09:00
test_weakmap.rb Weakmap failure is still pending 2022-01-16 22:43:04 +09:00
test_whileuntil.rb
test_yield.rb
test_yjit.rb New constant caching insn: opt_getconstant_path 2022-09-01 15:20:49 -07:00
test_yjit_exit_locations.rb Prevent a warning: assigned but unused variable - out 2022-06-13 10:37:26 +09:00
ut_eof.rb