aboutsummaryrefslogtreecommitdiffstats
path: root/ext
Commit message (Collapse)AuthorAgeFilesLines
* [ruby/pathname] [Misc #19155] [DOC] Addion of absolute pathsNobuyoshi Nakada2022-12-031-0/+4
| | | | https://github.com/ruby/pathname/commit/3cb5ed2576
* [ruby/io-console] Check rawmode option names strictlyNobuyoshi Nakada2022-12-021-10/+30
| | | | https://github.com/ruby/io-console/commit/aa8fc7e947
* Introduce encoding check macroS-H-GAMELINKS2022-12-021-0/+1
|
* Removed documentation for incomplete option about [Feature #17134]Hiroshi SHIBATA2022-11-301-1/+0
|
* [ruby/erb] Skip using the extension for truffleruby as wellTakashi Kokubun2022-11-271-1/+6
| | | | | | | | | | | | | | | | | | | | (https://github.com/ruby/erb/pull/39) * Skip using the extension for truffleruby as well * Just skip building the C extension for TruffleRuby * Skip rake compile for truffleruby * Use resolve_feature_path * Revert "Use resolve_feature_path" This reverts commit https://github.com/ruby/erb/commit/acc1e0c0ffaf. * Use resolve_feature_path with LoadError guard https://github.com/ruby/erb/commit/85dcb08439
* [ruby/erb] Define ERB::Escape moduleTakashi Kokubun2022-11-261-3/+3
| | | | | (https://github.com/ruby/erb/pull/38) Close #32
* [ruby/erb] Keep ERB::Util#html_escape privateTakashi Kokubun2022-11-251-1/+1
| | | | | | | ERB::Util.html_escape has been public, but ERB::Util#html_escape had been private. https://github.com/ruby/erb/commit/e62210bf56
* Use `rb_sprintf` instead of deprecated `sprintf`Nobuyoshi Nakada2022-11-251-13/+13
|
* [ruby/erb] Rename erb.so to erb/escape.soTakashi Kokubun2022-11-243-3/+3
| | | | | | (https://github.com/ruby/erb/pull/35) https://github.com/ruby/erb/commit/1280046952
* Use class methods of `File` over `Kernel.open` and `IO.read`Nobuyoshi Nakada2022-11-212-7/+5
|
* Fix typos (#6775)Yudai Takada2022-11-201-2/+2
| | | | | | | | | | | * s/Innteger/Integer/ * s/diretory/directory/ * s/Bufer/Buffer/ * s/defalt/default/ * s/covearge/coverage/
* Enhance keep_tokens option for RubyVM::AbstractSyntaxTree parsing methodsyui-knk2022-11-211-19/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Implementation for Language Server Protocol (LSP) sometimes needs token information. For example both `m(1)` and `m(1, )` has same AST structure other than node locations then it's impossible to check the existence of `,` from AST. However in later case, it might be better to suggest variables list for the second argument. Token information is important for such case. This commit adds these methods. * Add `keep_tokens` option for `RubyVM::AbstractSyntaxTree.parse`, `.parse_file` and `.of` * Add `RubyVM::AbstractSyntaxTree::Node#tokens` which returns tokens for the node including tokens for descendants nodes. * Add `RubyVM::AbstractSyntaxTree::Node#all_tokens` which returns all tokens for the input script regardless the receiver node. [Feature #19070] Impacts on memory usage and performance are below: Memory usage: ``` $ cat test.rb root = RubyVM::AbstractSyntaxTree.parse_file(File.expand_path('../test/ruby/test_keyword.rb', __FILE__), keep_tokens: true) $ /usr/bin/time -f %Mkb /usr/local/bin/ruby -v ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux] 11408kb # keep_tokens :false $ /usr/bin/time -f %Mkb /usr/local/bin/ruby test.rb 17508kb # keep_tokens :true $ /usr/bin/time -f %Mkb /usr/local/bin/ruby test.rb 30960kb ``` Performance: ``` $ cat ../ast_keep_tokens.yml prelude: | src = <<~SRC module M class C def m1(a, b) 1 + a + b end end end SRC benchmark: without_keep_tokens: | RubyVM::AbstractSyntaxTree.parse(src, keep_tokens: false) with_keep_tokens: | RubyVM::AbstractSyntaxTree.parse(src, keep_tokens: true) $ make benchmark COMPARE_RUBY="./ruby" ARGS=../ast_keep_tokens.yml /home/kaneko.y/.rbenv/shims/ruby --disable=gems -rrubygems -I../benchmark/lib ../benchmark/benchmark-driver/exe/benchmark-driver \ --executables="compare-ruby::./ruby -I.ext/common --disable-gem" \ --executables="built-ruby::./miniruby -I../lib -I. -I.ext/common ../tool/runruby.rb --extout=.ext -- --disable-gems --disable-gem" \ --output=markdown --output-compare -v ../ast_keep_tokens.yml compare-ruby: ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux] built-ruby: ruby 3.2.0dev (2022-11-19T09:41:54Z 19070-keep_tokens d3af1b8057) [x86_64-linux] warming up.. | |compare-ruby|built-ruby| |:--------------------|-----------:|---------:| |without_keep_tokens | 21.659k| 21.303k| | | 1.02x| -| |with_keep_tokens | 6.220k| 5.691k| | | 1.09x| -| ```
* Add support for `sockaddr_un` on Windows. (#6513)Samuel Williams2022-11-179-26/+39
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Windows: Fix warning about undefined if_indextoname() * Windows: Fix UNIXSocket on MINGW and make .pair more reliable * Windows: Use nonblock=true for read tests with scheduler * Windows: Move socket detection from File.socket? to File.stat Add S_IFSOCK to Windows and interpret reparse points accordingly. Enable tests that work now. * Windows: Use wide-char functions to UNIXSocket This fixes behaviour with non-ASCII characters. It also fixes deletion of temporary UNIXSocket.pair files. * Windows: Add UNIXSocket tests for specifics of Windows impl. * Windows: fix VC build due to missing _snwprintf Avoid usage of _snwprintf, since it fails linking ruby.dll like so: linking shared-library x64-vcruntime140-ruby320.dll x64-vcruntime140-ruby320.def : error LNK2001: unresolved external symbol snwprintf x64-vcruntime140-ruby320.def : error LNK2001: unresolved external symbol vsnwprintf_l whereas linking miniruby.exe succeeds. This patch uses snprintf on the UTF-8 string instead. Also remove branch GetWindowsDirectoryW, since it doesn't work. * Windows: Fix dangling symlink test failures Co-authored-by: Lars Kanis <kanis@comcard.de>
* Clean extension build directories and exts.mk fileNobuyoshi Nakada2022-11-161-2/+8
|
* Remove `-j` option from `MFLAGS` for sub-makesNobuyoshi Nakada2022-11-161-0/+1
|
* [ruby/bigdecimal] Add fallback definition of MAYBE_UNUSEDKenta Murata2022-11-151-0/+4
| | | | https://github.com/ruby/bigdecimal/commit/b2123faa52
* [ruby/bigdecimal] Replace sprintf by snprintfKenta Murata2022-11-152-121/+189
| | | | https://github.com/ruby/bigdecimal/commit/d6f5bb40c7
* [ruby/bigdecimal] Mark some functions MAYBE_UNUSEDKenta Murata2022-11-151-0/+8
| | | | https://github.com/ruby/bigdecimal/commit/d70a4d53e5
* [ruby/bigdecimal] Add specific value allocatorsKenta Murata2022-11-131-199/+282
| | | | | | | * Add NewZero* and NewOne* function families * Use them instead of VpAlloc for allocating 0 and 1 https://github.com/ruby/bigdecimal/commit/9276a94ac7
* [ruby/bigdecimal] Add and use specific value allocatorsKenta Murata2022-11-131-19/+50
| | | | | | | | | * Add rbd_allocate_struct_zero for making 0.0 * Add rbd_allocate_struct_one for making 1.0 * Use them to replace VpAlloc calls * Renmae VpPt5 to VpConstPt5 https://github.com/ruby/bigdecimal/commit/40c826f5e6
* [ruby/bigdecimal] Make VPrint function always availableKenta Murata2022-11-131-91/+86
| | | | https://github.com/ruby/bigdecimal/commit/5391f7e92c
* [ruby/bigdecimal] Tweak VpAllocKenta Murata2022-11-131-32/+32
| | | | | | | | * Stop reusing mx and mf * Check szVal == NULL first * Treat special values before checking the leading `#` https://github.com/ruby/bigdecimal/commit/14f3d965f8
* [ruby/bigdecimal] Rewrite allocation functionsKenta Murata2022-11-132-72/+90
| | | | | | | * Rename them * Make allocation count operations atomic https://github.com/ruby/bigdecimal/commit/a5ab34a115
* [ruby/bigdecimal] Twak GetPrecisionInt and rename it to check_int_precisionKenta Murata2022-11-131-9/+16
| | | | https://github.com/ruby/bigdecimal/commit/69d0588a3b
* [ruby/bigdecimal] Tweak check_rounding_mode_optionKenta Murata2022-11-131-10/+9
| | | | https://github.com/ruby/bigdecimal/commit/e1c6c9be25
* [ruby/bigdecimal] Rewrite check_rounding_mode functionKenta Murata2022-11-132-46/+70
| | | | | | Use table-lookup algorithm instead of consecutive if-statements. https://github.com/ruby/bigdecimal/commit/23eaff3ae5
* [ruby/bigdecimal] [Doc] Fix the document of n_significant_digitsKenta Murata2022-11-131-9/+9
| | | | https://github.com/ruby/bigdecimal/commit/91b72a9341
* [ruby/bigdecimal] Make GetVpValue inlineKenta Murata2022-11-131-1/+1
| | | | https://github.com/ruby/bigdecimal/commit/1b642e2e59
* [ruby/bigdecimal] Make BigDecimal_double_fig inlineKenta Murata2022-11-131-1/+1
| | | | https://github.com/ruby/bigdecimal/commit/4ecf04da7a
* Remove numiv from RObjectJemma Issroff2022-11-101-1/+1
| | | | | | | Since object shapes store the capacity of an object, we no longer need the numiv field on RObjects. This gives us one extra slot which we can use to give embedded objects one more instance variable (for a total of 3 ivs). This commit removes the concept of numiv from RObject.
* Transition shape when object's capacity changesJemma Issroff2022-11-104-0/+18
| | | | | | | | | | | | | | | | This commit adds a `capacity` field to shapes, and adds shape transitions whenever an object's capacity changes. Objects which are allocated out of a bigger size pool will also make a transition from the root shape to the shape with the correct capacity for their size pool when they are allocated. This commit will allow us to remove numiv from objects completely, and will also mean we can guarantee that if two objects share shapes, their IVs are in the same positions (an embedded and extended object cannot share shapes). This will enable us to implement ivar sets in YJIT using object shapes. Co-Authored-By: Aaron Patterson <tenderlove@ruby-lang.org>
* Fix compiler issues in test on C99Peter Zhu2022-11-101-1/+1
| | | | | | | | Fixes the following issue when compiling using C99: ext/-test-/rb_call_super_kw/rb_call_super_kw.c ext/-test-/random/loop.c:16:39: error: extra ';' outside of a function [-Werror,-Wextra-semi] RB_RANDOM_DEFINE_INIT_INT32_FUNC(loop);
* [Bug #19100] Add `init_int32` function to `rb_random_interface_t`Nobuyoshi Nakada2022-11-102-0/+4
| | | | | Distinguish initialization by single word from initialization by array.
* Add version to the interface of Random extensionsNobuyoshi Nakada2022-11-102-0/+292
|
* Preprocess for older bison is no longer neededNobuyoshi Nakada2022-11-101-2/+0
|
* Use `rb_sprintf` instead of deprecated `sprintf`Nobuyoshi Nakada2022-11-091-2/+1
|
* Set default %printer for NODE ntermsyui-knk2022-11-081-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | Before: ``` Reducing stack by rule 639 (line 5062): $1 = token "integer literal" (1.0-1.1: 1) -> $$ = nterm simple_numeric (1.0-1.1: ) ``` After: ``` Reducing stack by rule 641 (line 5078): $1 = token "integer literal" (1.0-1.1: 1) -> $$ = nterm simple_numeric (1.0-1.1: NODE_LIT) ``` `"<*>"` is supported by Bison 2.3b (2008-05-27) or later. https://git.savannah.gnu.org/cgit/bison.git/commit/?id=12e3584054c16ab255672c07af0ffc7bb220e8bc Therefore developers need to install Bison 2.3b+ to build ruby from source codes if their Bison is older. Minimum version requirement for Bison is changed to 3.0. See: https://bugs.ruby-lang.org/issues/19068 [Feature #19068]
* [ruby/erb] Revert the strpbrk optimizationTakashi Kokubun2022-11-051-5/+0
| | | | | | | | | | | | because it's much slower on M1 https://github.com/ruby/erb/pull/29. It'd be too complicated to switch the implementation based on known optimized platforms / versions. Besides, short strings are the most common usages of this method and SIMD doesn't really help that case. All in all, I can't justify the existence of this code. https://github.com/ruby/erb/commit/30691c8995
* [ruby/erb] Optimize away the rb_convert_type call using RB_TYPE_PTakashi Kokubun2022-11-051-1/+3
| | | | https://github.com/ruby/erb/commit/12058c3784
* [ruby/erb] Use strpbrk only when str is long enough for SIMDTakashi Kokubun2022-11-051-5/+7
| | | | | | | This is the same trick used by https://github.com/k0kubun/hescape to choose the best strategy for different scenarios. https://github.com/ruby/erb/commit/af26da2858
* [ruby/erb] Optimize the no-escape case with strpbrkTakashi Kokubun2022-11-051-5/+8
| | | | | | | | | | | | | (https://github.com/ruby/erb/pull/29) Typically, strpbrk(3) is optimized pretty well with SIMD instructions. Just using it makes this as fast as a SIMD-based implementation for the no-escape case. Not utilizing this for escaped cases because memory allocation would be a more significant bottleneck for many strings anyway. Also, there'll be some overhead in calling a C function (strpbrk) many times because we're not using SIMD instructions directly. So using strpbrk all the time might not necessarily be faster.
* [ruby/erb] Avoid using prepend + super for fallbackTakashi Kokubun2022-11-041-4/+8
| | | | | | | | | (https://github.com/ruby/erb/pull/28) `prepend` is prioritized more than ActiveSupport's monkey-patch, but the monkey-patch needs to work. https://github.com/ruby/erb/commit/611de5a865
* Update dependencies for bc28acc347eace4d02bbb4b672655216f7dd3a81Nobuyoshi Nakada2022-11-053-0/+3
|
* Substitute from the actual netinet6/in6.hNobuyoshi Nakada2022-11-041-5/+13
| | | | | Xcode no longer links the system include files directory to `/usr`. Extract the actual header file path from cpp output.
* [ruby/erb] Do not allocate a new String if not neededTakashi Kokubun2022-11-041-4/+4
| | | | | [Feature #19102]https://github.com/ruby/erb/commit/ecebf8075c
* [ruby/erb] Optimize away to_s if it's already T_STRINGTakashi Kokubun2022-11-041-9/+2
| | | | | [Feature #19102]https://github.com/ruby/erb/commit/38c6e182fb
* [ruby/erb] Copy CGI.escapeHTML to ERB::Util.html_escapeTakashi Kokubun2022-11-042-0/+98
| | | | https://github.com/ruby/erb/commit/ac9b219fa9
* Use shared flags of the typePeter Zhu2022-11-021-1/+2
| | | | | | The ELTS_SHARED flag is generic, so we should prefer to use the flags specific of the type (STR_SHARED for strings and RARRAY_SHARED_FLAG for arrays).
* [ruby/bigdecimal] Suppress macro redefinition warningsNobuyoshi Nakada2022-10-301-2/+2
| | | | | | `HAVE_` macros by autoconf are defined as 1. https://github.com/ruby/bigdecimal/commit/cd35868aa6
* [ruby/digest] Use CommonDigest by default if availableNobuyoshi Nakada2022-10-291-1/+1
| | | | https://github.com/ruby/digest/commit/cce9ada85e