ruby/internal
Aaron Patterson d3574c117a Move IO#readline to Ruby
This commit moves IO#readline to Ruby.  In order to call C functions,
keyword arguments must be converted to hashes.  Prior to this commit,
code like `io.readline(chomp: true)` would allocate a hash.  This
commits moves the keyword "denaturing" to Ruby, allowing us to send
positional arguments to the C API and avoiding the hash allocation.

Here is an allocation benchmark for the method:

```
x = GC.stat(:total_allocated_objects)
File.open("/usr/share/dict/words") do |f|
  f.readline(chomp: true) until f.eof?
end
p ALLOCATIONS: GC.stat(:total_allocated_objects) - x
```

Before this commit, the output was this:

```
$ make run
./miniruby -I./lib -I. -I.ext/common  -r./arm64-darwin22-fake  ./test.rb
{:ALLOCATIONS=>707939}
```

Now it is this:

```
$ make run
./miniruby -I./lib -I. -I.ext/common  -r./arm64-darwin22-fake  ./test.rb
{:ALLOCATIONS=>471962}
```

[Bug #19890] [ruby-core:114803]
2023-09-28 10:43:45 -07:00
..
array.h Remove RARRAY_CONST_PTR_TRANSIENT 2023-07-13 14:48:14 -04:00
basic_operators.h Emit special instruction for array literal + .(hash|min|max) 2023-04-18 17:16:22 -07:00
bignum.h Stop exporting symbols for MJIT 2023-03-06 21:59:23 -08:00
bits.h Check that __builtin_mul_overflow can handle long long 2023-08-24 20:47:23 -07:00
class.h Stop exposing FrozenCore in headers 2023-09-19 14:08:05 +09:00
cmdlineopt.h [Feature #19790] Rename BUGREPORT_PATH as CRASH_REPORT 2023-09-25 22:57:28 +09:00
compar.h Introduce BOP_CMP for optimized comparison 2022-12-06 12:37:23 -08:00
compile.h Move the PC regardless of the leaf flag (#8232) 2023-08-16 20:28:33 -07:00
compilers.h
complex.h
cont.h Introduce `Fiber#storage` for inheritable fiber-scoped variables. (#6612) 2022-12-01 23:00:33 +13:00
dir.h
enc.h
encoding.h parenthesize to macro 2022-12-02 01:31:27 +09:00
enum.h
enumerator.h
error.h Add `rb_sys_fail_sprintf` macro 2023-05-12 18:36:02 +09:00
eval.h
file.h Revert "reuse open(2) from rb_file_load_ok on POSIX-like system" 2023-02-27 09:24:45 -08:00
fixnum.h
gc.h Fix crash in WeakMap during compaction 2023-09-06 14:20:23 -04:00
hash.h Add rb_hash_free for the GC to use 2023-09-24 09:07:52 -04:00
imemo.h use correct svar even if env is escaped 2023-02-10 17:55:25 +09:00
inits.h
io.h do not redefine a typedef 2023-08-25 17:27:53 +09:00
load.h
loadpath.h
math.h
missing.h
numeric.h Stop exporting symbols for MJIT 2023-03-06 21:59:23 -08:00
object.h Stop exporting symbols for MJIT 2023-03-06 21:59:23 -08:00
parse.h Move SCRIPT_LINES__ away from parse.y 2023-08-25 18:23:05 +09:00
proc.h Stop exporting symbols for MJIT 2023-03-06 21:59:23 -08:00
process.h Put `rb_fork` back into process.c 2023-05-21 23:00:27 +09:00
ractor.h
random.h
range.h Implement Struct on VWA 2023-06-05 15:47:16 -04:00
rational.h Don't redefine RB_OBJ_WRITE 2023-01-18 08:49:32 -05:00
re.h Stop allocating unused backref strings at `defined?` 2023-06-27 23:14:10 +09:00
ruby_parser.h Move SCRIPT_LINES__ away from parse.y 2023-08-25 18:23:05 +09:00
sanitizers.h Remove obsoleted MJIT_HEADER macro 2023-03-06 22:29:35 -08:00
serial.h
signal.h Move `posix_signal` declaration internal with prefix `ruby_` 2023-07-17 21:31:59 +09:00
static_assert.h
string.h Use end of char boundary in start_with? 2023-09-01 16:23:28 -07:00
struct.h Remove unused references to the transient heap 2023-07-13 14:48:14 -04:00
symbol.h
thread.h Use a real Ruby mutex in rb_io_close_wait_list (#7884) 2023-06-01 17:37:18 +09:00
time.h
transcode.h
util.h
variable.h Remove unused references to the transient heap 2023-07-13 14:48:14 -04:00
vm.h Move IO#readline to Ruby 2023-09-28 10:43:45 -07:00
warnings.h