Skip to content

Commit

Permalink
Showing 2 changed files with 0 additions and 52 deletions.
Original file line number Diff line number Diff line change
@@ -1284,21 +1284,6 @@ protected boolean offsetTooLargeRaw(int offset, DynamicObject string) {

}

@RubiniusPrimitive(unsafeNeedsAudit = true, name = "string_resize_capacity", needsSelf = false, lowerFixnumParameters = 1)
public static abstract class StringResizeCapacityPrimitiveNode extends RubiniusPrimitiveArrayArgumentsNode {

public StringResizeCapacityPrimitiveNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
}

@Specialization
public DynamicObject stringResizeCapacity(DynamicObject string, int capacity) {
// TODO (nirvdrum 11-Jan-16): Any calls to this are suspect now that we use ropes. We don't have a way to preallocate a buffer to mutate.
return string;
}

}

@RubiniusPrimitive(unsafeNeedsAudit = true, name = "string_rindex", lowerFixnumParameters = 1)
public static abstract class StringRindexPrimitiveNode extends RubiniusPrimitiveArrayArgumentsNode {

37 changes: 0 additions & 37 deletions truffle/src/main/ruby/core/rubinius/common/string_mirror.rb
Original file line number Diff line number Diff line change
@@ -52,43 +52,6 @@ def previous_byte_index(index)
def copy_from(other, start, size, dest)
Rubinius.invoke_primitive :string_copy_from, @object, other, start, size, dest
end

def resize_capacity(count)
Rubinius.invoke_primitive :string_resize_capacity, @object, count
end

def splice(start, count, replacement)
str = @object

# TODO: copy_from unshares
str.modify!

bs = str.bytesize
rbs = replacement.bytesize

bytes = bs - count + rbs

s = start + count
b = bs - s
d = start + rbs

# Always resize if the resulting size is different to prevent "leaking"
# bytes in large ByteArray instances when splicing out chunks.

if rbs < count
copy_from str, s, b, d
resize_capacity bytes
elsif rbs > count
resize_capacity bytes
copy_from str, s, b, d
end

copy_from replacement, 0, rbs, start if rbs > 0

str.num_bytes = bytes

self
end
end
end
end

0 comments on commit 1dd1ed6

Please sign in to comment.