Граф коммитов

1321 Коммитов

Автор SHA1 Сообщение Дата
Takashi Kokubun fa1db8f938
Add missing dependency
https://travis-ci.org/ruby/ruby/jobs/620972117
2019-12-04 22:25:12 -08:00
Nobuyoshi Nakada 9afaf139f2
Revert "builtin_binary.inc needs miniruby itself for RubyVM.each_builtin"
This reverts commit 2615030c52,
which doesn't work when cross compiling, except for mingw.
2019-12-02 14:15:42 +09:00
Nobuyoshi Nakada 2615030c52
builtin_binary.inc needs miniruby itself for RubyVM.each_builtin 2019-12-02 14:03:57 +09:00
Koichi Sasada dd723771c1 fastpath for ivar read of FL_EXIVAR objects.
vm_getivar() provides fastpath for T_OBJECT by caching an index
of ivar. This patch also provides fastpath for FL_EXIVAR objects.
FL_EXIVAR objects have an each ivar array and index can be cached
as T_OBJECT. To access this ivar array, generic_iv_tbl is exposed
by rb_ivar_generic_ivtbl() (declared in variable.h which is newly
introduced).

Benchmark script:

Benchmark.driver(repeat_count: 3){|x|
  x.executable name: 'clean', command: %w'../clean/miniruby'
  x.executable name: 'trunk', command: %w'./miniruby'

  objs = [Object.new, 'str', {a: 1, b: 2}, [1, 2]]

  objs.each.with_index{|obj, i|
    rep = obj.inspect
    rep = 'Object.new' if /\#/ =~ rep
    x.prelude str = %Q{
      v#{i} = #{rep}
      def v#{i}.foo
        @iv # ivar access method (attr_reader)
      end
      v#{i}.instance_variable_set(:@iv, :iv)
    }
    puts str
    x.report %Q{
      v#{i}.foo
    }
  }
}

Result:

      v0.foo # T_OBJECT

               clean:  85387141.8 i/s
               trunk:  85249373.6 i/s - 1.00x  slower

      v1.foo # T_STRING

               trunk:  57894407.5 i/s
               clean:  39957178.6 i/s - 1.45x  slower

      v2.foo # T_HASH

               trunk:  56629413.2 i/s
               clean:  39227088.9 i/s - 1.44x  slower

      v3.foo # T_ARRAY

               trunk:  55797530.2 i/s
               clean:  38263572.9 i/s - 1.46x  slower
2019-11-29 03:11:04 +09:00
Nobuyoshi Nakada b563439274
Show include directive differences only when under git
When building from tarballs, the source directory is not a git
repository.
2019-11-23 16:06:30 +09:00
Nobuyoshi Nakada e1b2341488
Update dependencies 2019-11-18 23:16:22 +09:00
Koichi Sasada 93ce4f1cd7 update deps.
https://travis-ci.org/ruby/ruby/jobs/613242256#L2205
2019-11-18 10:16:11 +09:00
Koichi Sasada 9c1abe2a6c load prelude.rb by builtin features.
The script in prelude.rb was embed in MRI to load it (eval this
script at everyboot).
This commit change the loading process of prelude.rb. MRI doesn't
eval a script, but load from compiled binary with builtin feature.

So that Init_prelude() does not load `prelude.rb` now.
2019-11-15 03:55:46 +09:00
Kazuhiro NISHIYAMA 63f363b70d
Update dependencies
patch from https://travis-ci.org/ruby/ruby/jobs/611152175#L2204
2019-11-13 10:31:42 +09:00
Nobuyoshi Nakada fb02e3192c
Create `RUBYCOMMONDIR` directory in advance
As well as the directory per architecture.

Closes https://github.com/ruby/ruby/pull/2669
2019-11-12 16:36:56 +09:00
Koichi Sasada 05a5c69e1a add deps for miniprelude.c 2019-11-11 16:47:50 +09:00
Nobuyoshi Nakada 31ee6f6f5d
Extract gem files after update
So that test/optparse/test_did_you_mean.rb can find did_you_mean.rb.
2019-11-11 13:10:55 +09:00
Nobuyoshi Nakada faa4f4f23f
Get rid of FreeBSD make incompatibility [Bug #16331]
FreeBSD make works differently with `-j` option.

> -j	max_jobs
> 	Specify the maximum number of jobs that `make` may have running
>	at any one time.  The value is saved in `.MAKE.JOBS.` Turns
>	compatibility mode off, unless the `B` flag is also specified.
>	When compatibility mode is off, all commands associated with a
>	target are executed in a single shell invocation as opposed to
>	the traditional one shell invocation per line.  This can break
>	traditional scripts which change directories on each command
>	invocation and then expect to start with a fresh environment on
>	the next line.  It is more efficient to correct the scripts
>	rather than turn backwards compatibility on.

Stop using exit, cd, exec in middle of commands.
2019-11-10 09:26:19 +09:00
Nobuyoshi Nakada fcf37ca2fe Fix builtin scirpt paths
Do not search builtin scripts by using VPATH, to get rid of weird
nmake VPATH.
2019-11-09 21:16:05 +09:00
Nobuyoshi Nakada 4dd1caa129
Updated miniprelude.o dependency 2019-11-09 20:08:01 +09:00
Nobuyoshi Nakada dfaac2b372
Embed builtin ruby scripts in miniprelude.c
Instead of reading from the files by the full-path at runtime.  As
rbinc files need to be included in distributed tarballs, the
full-paths at the packaging are unavailable at compilation times.
2019-11-09 19:28:45 +09:00
Nobuyoshi Nakada 579aa4dc52
Fixed the dependency 2019-11-09 00:03:29 +09:00
Nobuyoshi Nakada 248d0008db
Added pack.rb to BUILTIN_RB_SRCS 2019-11-08 23:59:22 +09:00
Yusuke Endoh a3141e3c76 Rubified the APIs of pack.c 2019-11-08 23:51:51 +09:00
Nobuyoshi Nakada ff2d99406d
Update builtin include files 2019-11-08 22:31:44 +09:00
Nobuyoshi Nakada 20971799f2
Renamed `load_*.inc` as `*.rbinc` to utilize a suffix rule 2019-11-08 16:30:28 +09:00
Koichi Sasada 8fa41971c2 use builtins for GC.
Define a part of GC in gc.rb.
2019-11-08 15:29:02 +09:00
Koichi Sasada 365557f111 Define IO#read/write_nonblock with builtins.
IO#read/write_nonblock methods are defined in prelude.rb with
special private method __read/write_nonblock to reduce keyword
parameters overhead. We can move them into io.rb with builtin
functions.
2019-11-08 10:03:19 +09:00
Koichi Sasada a47d058ebf use builtin for RubyVM::AbstractSyntaxTree.
Define RubyVM::AbstractSyntaxTree in ast.rb
with __builtin functions.
2019-11-08 09:09:29 +09:00
Koichi Sasada e2a45cb984 use builtin for TracePoint.
Define TracePoint in trace_point.rb and use __builtin_ syntax.
2019-11-08 09:09:29 +09:00
Koichi Sasada 46acd0075d support builtin features with Ruby and C.
Support loading builtin features written in Ruby, which implement
with C builtin functions.
[Feature #16254]

Several features:

(1) Load .rb file at boottime with native binary.

Now, prelude.rb is loaded at boottime. However, this file is contained
into the interpreter as a text format and we need to compile it.
This patch contains a feature to load from binary format.

(2) __builtin_func() in Ruby call func() written in C.

In Ruby file, we can write `__builtin_func()` like method call.
However this is not a method call, but special syntax to call
a function `func()` written in C. C functions should be defined
in a file (same compile unit) which load this .rb file.

Functions (`func` in above example) should be defined with
  (a) 1st parameter: rb_execution_context_t *ec
  (b) rest parameters (0 to 15).
  (c) VALUE return type.
This is very similar requirements for functions used by
rb_define_method(), however `rb_execution_context_t *ec`
is new requirement.

(3) automatic C code generation from .rb files.

tool/mk_builtin_loader.rb creates a C code to load .rb files
needed by miniruby and ruby command. This script is run by
BASERUBY, so *.rb should be written in BASERUBY compatbile
syntax. This script load a .rb file and find all of __builtin_
prefix method calls, and generate a part of C code to export
functions.

tool/mk_builtin_binary.rb creates a C code which contains
binary compiled Ruby files needed by ruby command.
2019-11-08 09:09:29 +09:00
Nobuyoshi Nakada c7632fa80c Do not occupy `ARGV` by XRUBY command
Instead run test-bundled-gems.rb by `ENV['RUBY']`, which should be
set by runruby.rb.
2019-11-05 08:45:19 +09:00
Nobuyoshi Nakada 4e8336bae8
Share test-bundled-gems-run in common.mk 2019-11-05 00:05:38 +09:00
Martin Dürst c54635c08b Update Unicode Emoji version from 12.0 to 12.1.
This update does not add any new codepoint assignments, it just
expands the range of emoji codepoint sequences recommended for
public interchange.

Depending on how emoji data files are cached, this commit may
require manual intervention in some build environments
(including some CI systems).
2019-10-30 08:25:45 +09:00
Alan Wu 89e7997622 Combine call info and cache to speed up method invocation
To perform a regular method call, the VM needs two structs,
`rb_call_info` and `rb_call_cache`. At the moment, we allocate these two
structures in separate buffers. In the worst case, the CPU needs to read
4 cache lines to complete a method call. Putting the two structures
together reduces the maximum number of cache line reads to 2.

Combining the structures also saves 8 bytes per call site as the current
layout uses separate two pointers for the call info and the call cache.
This saves about 2 MiB on Discourse.

This change improves the Optcarrot benchmark at least 3%. For more
details, see attached bugs.ruby-lang.org ticket.

Complications:
 - A new instruction attribute `comptime_sp_inc` is introduced to
 calculate SP increase at compile time without using call caches. At
 compile time, a `TS_CALLDATA` operand points to a call info struct, but
 at runtime, the same operand points to a call data struct. Instruction
 that explicitly define `sp_inc` also need to define `comptime_sp_inc`.
 - MJIT code for copying call cache becomes slightly more complicated.
 - This changes the bytecode format, which might break existing tools.

[Misc #16258]
2019-10-24 18:03:42 +09:00
Nobuyoshi Nakada f1d4216bd9
Added refresh-gems
Refreshes bundled gems to the latest version, and extracts them.
2019-10-24 01:42:48 +09:00
Nobuyoshi Nakada 67f010af9b
name2ctype.h depends on also Emoji data 2019-10-23 15:11:52 +09:00
Nobuyoshi Nakada 929d5fd3b9 Comparable#clamp with a range [Feature #14784] 2019-10-16 01:42:34 +09:00
卜部昌平 f1ce4897f2 make rb_raise a GVL-only function again
Requested by ko1 that ability of calling rb_raise from anywhere
outside of GVL is "too much".  Give up that part, move the GVL
aquisition routine into gc.c, and make our new gc_raise().
2019-10-10 17:10:21 +09:00
Nobuyoshi Nakada 495ebd6e95
Now error.o needs thread.h 2019-10-10 14:21:29 +09:00
卜部昌平 9c3153e0da allow rb_raise from outside of GVL
Now that allocation routines like ALLOC_N() can raise exceptions
on integer overflows.  This is a problem when the calling thread
has no GVL.  Memory allocations has been allowed without it, but
can still fail.

Let's just relax rb_raise's restriction so that we can call it
with or without GVL.  With GVL the behaviour is unchanged.  With
no GVL, wait for it.

Also, integer overflows can theoretically occur during GC when
we expand the object space.  We cannot do so much then.  Call
rb_memerror and let that routine abort the process.
2019-10-10 12:07:38 +09:00
Nobuyoshi Nakada 212da9a6ae
Added dependencies on prerequisite makefiles 2019-10-05 11:04:23 +09:00
Takashi Kokubun 6045ff64e3
Use benchmark-driver v0.15.6
to fix another keyword argument warning which was added recently.
2019-09-19 18:04:47 +09:00
Takashi Kokubun bcd49a4669
Upgrade benchmark_driver to v0.15.5
Fixed new Struct-related keyword argument warnings
2019-09-13 00:34:54 +09:00
Nobuyoshi Nakada 8bfc46a9a3
Fixed wrong usage of file2lastrev.rb 2019-09-07 11:59:19 +09:00
Takashi Kokubun 9c0626fa90
Upgrade benchmark-driver to v0.15.4
Fixing a bug on Windows introduced in v0.15.0
2019-09-07 09:14:33 +09:00
Takashi Kokubun bb53ddfe0e
Upgrade benchmark-driver to v0.15.3
It got some nice features for better support of
benchmark_driver-output-charty, Windows, ridk, and rbenv.
2019-09-07 00:43:38 +09:00
Takashi Kokubun e13da00824
Explain how to run an individual btest in help 2019-09-03 01:25:59 +09:00
Takashi Kokubun 04c3e34456
Upgrade benchmark-driver for keyword args warnings 2019-09-01 19:26:23 +09:00
Kazuhiro NISHIYAMA 972222c039
Show MFLAGS to check `Set ENV` in .github/workflows/ubuntu.yml 2019-08-26 17:45:18 +09:00
Nobuyoshi Nakada 44bead391f
CPPFLAGS is not needed for link 2019-08-26 16:54:10 +09:00
Nobuyoshi Nakada 2614653622
Moved INCFLAGS to XCFLAGS from CPPFLAGS as well as mswin
Rules which have used CPPFLAGS will need XCFLAGS or INCFLAGS now.
2019-08-26 16:54:10 +09:00
Nobuyoshi Nakada fafabe2f43
Add INCFLAGS for fake.rb
INCFLAGS is not included in CPPFLAGS on mswin, not to be exported
to rbconfig.rb.
2019-08-26 16:11:53 +09:00
Nobuyoshi Nakada b4d6d9c167
Removed unnecessary flags for fake.rb
Flags for ruby core such as warning and `_FORTIFY_SOURCE` macro
are not necessary to make fake.rb, except for `RUBY_EXPORT` macro
which prevents to include ruby/backward.h.
2019-08-26 13:14:01 +09:00
Hiroshi SHIBATA 1940347fdf
Use () instead of {} for nmake 2019-08-22 08:21:43 +10:00