Skip to content

Instantly share code, notes, and snippets.

View shyouhei's full-sized avatar

卜部昌平 shyouhei

View GitHub Profile
From 366e7e37b5f54c5d359a32f4324b6b90a6c7d33a Mon Sep 17 00:00:00 2001
From: "Urabe, Shyouhei" <shyouhei@ruby-lang.org>
Date: Mon, 21 Jan 2019 19:04:17 +0900
Subject: [PATCH] send-pop optimisation part two: eliminate pop
Sending a method, then immediately throwing away its return value, is
one of the most frequent waste of time that ruby does. Now that
callee methods can skip pushing objects onto the stack, why not caller
sites to also avoid popping them.
From dc34706366802534e8f24b4efc312942c31cca72 Mon Sep 17 00:00:00 2001
From: "Urabe, Shyouhei" <shyouhei@ruby-lang.org>
Date: Wed, 5 Sep 2018 14:15:08 +0900
Subject: [PATCH] print N-gram of instructions that run
This is different from N-gram of generated iseq. Rather it prints
the sequence that was actually executed.
Signed-off-by: Urabe, Shyouhei <shyouhei@ruby-lang.org>
---
diff --git a/lib/crypt_checkpass/argon2.rb b/lib/crypt_checkpass/argon2.rb
index 08f22dd..c42f374 100644
--- a/lib/crypt_checkpass/argon2.rb
+++ b/lib/crypt_checkpass/argon2.rb
@@ -191,7 +191,7 @@ class CryptCheckpass::Argon2 < CryptCheckpass
require 'argon2'
@dll = Module.new do
extend FFI::Library
- lib = FFI::Compiler::Loader.find 'argon2_wrap'
+ lib = ::Argon2::Ext.ffi_libraries.first.name
diff --git a/string.c b/string.c
index 435954d313..8a264acef4 100644
--- a/string.c
+++ b/string.c
@@ -9220,11 +9220,9 @@ rb_str_crypt(VALUE str, VALUE salt)
{
#ifdef HAVE_CRYPT_R
VALUE databuf;
- struct crypt_data *data;
-# define CRYPT_END() ALLOCV_END(databuf)
Index: trunk/compile.c
===================================================================
--- trunk/compile.c (revision 63362)
+++ trunk/compile.c (working copy)
@@ -8929,7 +8929,7 @@
dump_body.ci_entries = ibf_dump_ci_entries(dump, iseq);
dump_body.cc_entries = NULL;
dump_body.variable.coverage = Qnil;
- dump_body.variable.original_iseq = Qnil;
+ dump_body.variable.original_iseq = NULL;
--- before.txt 2018-01-26 13:38:32.000000000 +0900
+++ after.txt 2018-01-26 13:38:57.000000000 +0900
@@ -719,15 +719,15 @@ miniruby[0x1002259d7] <+3223>: movq %r
miniruby[0x1002259da] <+3226>: movq %r15, %rsi
miniruby[0x1002259dd] <+3229>: vzeroupper
miniruby[0x1002259e0] <+3232>: callq 0x100218b00 ; vm_trace at vm_insnhelper.c:3805
-miniruby[0x1002259e5] <+3237>: leaq 0x8(%r14), %rax
-miniruby[0x1002259e9] <+3241>: movq %r14, %rcx
-miniruby[0x1002259ec] <+3244>: movq %rax, (%r15)
-miniruby[0x1002259ef] <+3247>: movq %rax, %r14
zsh % git svn dcommit
Committing to svn+ssh://svn@ci.ruby-lang.org/ruby/trunk ...
M include/ruby/ruby.h
Committed r61905
M include/ruby/ruby.h
r61905 = 2453ad5cc2cb94d9d446feaff2aa8b49feef365d (refs/remotes/svn/trunk)
M include/ruby/ruby.h
Committed r61906
M include/ruby/ruby.h
r61906 = e7ac1c60436023bd9ff7ae99cca11fe3c16e1ed1 (refs/remotes/svn/trunk)
diff --git a/tool/ruby_vm/scripts/insns2vm.rb b/tool/ruby_vm/scripts/insns2vm.rb
index b1c604b570..ca857aacc4 100644
--- a/tool/ruby_vm/scripts/insns2vm.rb
+++ b/tool/ruby_vm/scripts/insns2vm.rb
@@ -22,7 +22,7 @@ def router argv
def generate_parser
OptionParser.new do |this|
- this.on "-I", "--srcdir=DIR", <<~'end'
+ this.on "-I", "--srcdir=DIR", <<-'end'
/* -*- mode:c; style:ruby; coding: utf-8; indent-tabs-mode: nil -*- */
/* This is an auto-generated file and is a part of the programming language
* Ruby. The person who created a program to generate this file (``I''
* hereafter) would like to refrain from defining licensing of this generated
* source code.
*
* This file consist of many small parts of codes copyrighted by each authors,
* not only the ``I'' person. Those original authors agree with some
* open-source license. I believe that the license we agree is the condition