Skip to content

Commit

Permalink
[Truffle] Split specializations for String#initialize_copy.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvdrum committed Jan 27, 2016
1 parent f0b030f commit 51b85b2
Showing 1 changed file with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
@@ -1332,12 +1332,14 @@ public InitializeCopyNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@Specialization(guards = "isRubyString(from)")
public Object initializeCopy(DynamicObject self, DynamicObject from) {
if (self == from) {
return self;
}
@Specialization(guards = "self == from")
public Object initializeCopySelfIsSameAsFrom(DynamicObject self, DynamicObject from) {
return self;
}


@Specialization(guards = { "self != from", "isRubyString(from)" })
public Object initializeCopy(DynamicObject self, DynamicObject from) {
StringOperations.setRope(self, rope(from));

return self;

0 comments on commit 51b85b2

Please sign in to comment.