Skip to content

Commit 699e23a

Browse files
committed
[GR-45116] Specialize Array#<< and related methods appending elements per call site to have a single array storage strategy in the inline cache for most cases
PullRequest: truffleruby/3969 (cherry picked from commit f541bb2)
1 parent 9b550a1 commit 699e23a

File tree

3 files changed

+5
-6
lines changed

3 files changed

+5
-6
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,7 @@ Performance:
4848

4949
* Improve `Truffle::FeatureLoader.loaded_feature_path` by removing expensive string ops from a loop. Speeds up feature lookup time (#3010, @itarato).
5050
* Improve `String#-@` performance by reducing unnecessary data copying and supporting substring lookups (@nirvdrum)
51+
* Specialize `Array#<<` and related methods appending elements per call site to have a single array storage strategy in the inline cache for most cases (@eregon).
5152

5253
Changes:
5354

src/main/java/org/truffleruby/core/array/ArrayAppendOneNode.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
import static org.truffleruby.core.array.ArrayHelpers.setStoreAndSize;
1414

1515
import com.oracle.truffle.api.dsl.NeverDefault;
16+
import com.oracle.truffle.api.dsl.ReportPolymorphism;
1617
import com.oracle.truffle.api.profiles.CountingConditionProfile;
1718
import org.truffleruby.core.array.library.ArrayStoreLibrary;
1819
import org.truffleruby.language.RubyContextSourceNode;
@@ -28,6 +29,7 @@
2829
@NodeChild(value = "arrayNode", type = RubyNode.class)
2930
@NodeChild(value = "valueNode", type = RubyNode.class)
3031
@ImportStatic(ArrayGuards.class)
32+
@ReportPolymorphism
3133
public abstract class ArrayAppendOneNode extends RubyContextSourceNode {
3234

3335
@NeverDefault

src/main/ruby/truffleruby/core/gc.rb

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,9 @@ def self.stat_hash(key_or_hash)
4848
Primitive.gc_stat[3]
4949
when :unknown_count
5050
Primitive.gc_stat[4]
51-
when :used
51+
when :used, :heap_live_slots
5252
Primitive.gc_stat[5]
53-
when :heap_live_slots
54-
Primitive.gc_stat[5]
55-
when :heap_available_slots
56-
Primitive.gc_stat[6]
57-
when :committed
53+
when :committed, :heap_available_slots
5854
Primitive.gc_stat[6]
5955
when :heap_free_slots
6056
stat = Primitive.gc_stat

0 commit comments

Comments
 (0)