Skip to content

Commit 8ba3efe

Browse files
committed
Imported Upstream version 2.2.6
1 parent 799ea68 commit 8ba3efe

File tree

122 files changed

+2144
-829
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

122 files changed

+2144
-829
lines changed

ChangeLog

Lines changed: 565 additions & 0 deletions
Large diffs are not rendered by default.

array.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4383,7 +4383,7 @@ flatten(VALUE ary, int level, int *modified)
43834383

43844384
st_free_table(memo);
43854385

4386-
RBASIC_SET_CLASS(result, rb_class_of(ary));
4386+
RBASIC_SET_CLASS(result, rb_obj_class(ary));
43874387
return result;
43884388
}
43894389

bignum.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6248,7 +6248,7 @@ rb_big_fdiv(VALUE x, VALUE y)
62486248
*
62496249
* 123456789 ** 2 #=> 15241578750190521
62506250
* 123456789 ** 1.2 #=> 5126464716.09932
6251-
* 123456789 ** -2 #=> 6.5610001194102e-17
6251+
* 123456789 ** -2 #=> (1/15241578750190521)
62526252
*/
62536253

62546254
VALUE
@@ -6789,7 +6789,7 @@ rb_big_aref(VALUE x, VALUE y)
67896789
* See also Object#hash.
67906790
*/
67916791

6792-
static VALUE
6792+
VALUE
67936793
rb_big_hash(VALUE x)
67946794
{
67956795
st_index_t hash;

common.mk

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -187,7 +187,7 @@ configure-ext: $(EXTS_MK)
187187

188188
build-ext: $(EXTS_MK)
189189
$(Q)$(MAKE) -f $(EXTS_MK) $(MFLAGS) libdir="$(libdir)" LIBRUBY_EXTS=$(LIBRUBY_EXTS) \
190-
ENCOBJS="$(ENCOBJS)" UPDATE_LIBRARIES=no $(EXTSTATIC)
190+
EXTENCS="$(ENCOBJS)" UPDATE_LIBRARIES=no $(EXTSTATIC)
191191

192192
prog: program wprogram
193193

@@ -584,8 +584,8 @@ $(RBCONFIG): $(srcdir)/tool/mkconfig.rb config.status $(srcdir)/version.h $(PREP
584584

585585
test-rubyspec-precheck:
586586

587-
test-rubyspec: test-rubyspec-precheck
588-
$(RUNRUBY) $(srcdir)/spec/mspec/bin/mspec run -B $(srcdir)/spec/default.mspec $(MSPECOPT)
587+
test-rubyspec: test-rubyspec-precheck $(arch)-fake.rb
588+
$(RUNRUBY) -r./$(arch)-fake $(srcdir)/spec/mspec/bin/mspec run -B $(srcdir)/spec/default.mspec $(MSPECOPT)
589589

590590
RUNNABLE = $(LIBRUBY_RELATIVE:no=un)-runnable
591591
runnable: $(RUNNABLE) prog $(srcdir)/tool/mkrunnable.rb PHONY

compile.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -245,6 +245,7 @@ r_value(VALUE value)
245245
#define ADD_TRACE(seq, line, event) \
246246
do { \
247247
if ((event) == RUBY_EVENT_LINE && iseq->coverage && \
248+
(line) > 0 && \
248249
(line) != iseq->compile_data->last_coverable_line) { \
249250
RARRAY_ASET(iseq->coverage, (line) - 1, INT2FIX(0)); \
250251
iseq->compile_data->last_coverable_line = (line); \
@@ -929,6 +930,8 @@ new_label_body(rb_iseq_t *iseq, long line)
929930
labelobj->label_no = iseq->compile_data->label_no++;
930931
labelobj->sc_state = 0;
931932
labelobj->sp = -1;
933+
labelobj->set = 0;
934+
labelobj->rescued = LABEL_RESCUE_NONE;
932935
return labelobj;
933936
}
934937

complex.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1351,7 +1351,7 @@ rb_complex_set_real(VALUE cmp, VALUE r)
13511351
VALUE
13521352
rb_complex_set_imag(VALUE cmp, VALUE i)
13531353
{
1354-
RCOMPLEX_SET_REAL(cmp, i);
1354+
RCOMPLEX_SET_IMAG(cmp, i);
13551355
return cmp;
13561356
}
13571357

cont.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -479,6 +479,10 @@ cont_new(VALUE klass)
479479

480480
static VALUE
481481
cont_capture(volatile int *stat)
482+
#if defined(__clang__) && \
483+
__clang_major__ == 3 && __clang_minor__ == 8 && __clang_patch__ == 0
484+
__attribute__ ((optnone))
485+
#endif
482486
{
483487
rb_context_t *cont;
484488
rb_thread_t *th = GET_THREAD();

encoding.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -821,8 +821,8 @@ rb_enc_associate_index(VALUE obj, int idx)
821821
}
822822
termlen = rb_enc_mbminlen(enc);
823823
oldtermlen = rb_enc_mbminlen(rb_enc_from_index(oldidx));
824-
if (oldtermlen < termlen && RB_TYPE_P(obj, T_STRING)) {
825-
rb_str_fill_terminator(obj, termlen);
824+
if (oldtermlen != termlen && RB_TYPE_P(obj, T_STRING)) {
825+
rb_str_change_terminator_length(obj, oldtermlen, termlen);
826826
}
827827
enc_set_index(obj, idx);
828828
return obj;

error.c

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -819,6 +819,26 @@ exc_backtrace(VALUE exc)
819819
return obj;
820820
}
821821

822+
VALUE
823+
rb_get_backtrace(VALUE exc)
824+
{
825+
ID mid;
826+
CONST_ID(mid, "backtrace");
827+
if (rb_method_basic_definition_p(CLASS_OF(exc), mid)) {
828+
VALUE info, klass = rb_eException;
829+
rb_thread_t *th = GET_THREAD();
830+
if (NIL_P(exc))
831+
return Qnil;
832+
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_CALL, exc, mid, klass, Qundef);
833+
info = exc_backtrace(exc);
834+
EXEC_EVENT_HOOK(th, RUBY_EVENT_C_RETURN, exc, mid, klass, info);
835+
if (NIL_P(info))
836+
return Qnil;
837+
return rb_check_backtrace(info);
838+
}
839+
return rb_funcall(exc, mid, 0, 0);
840+
}
841+
822842
/*
823843
* call-seq:
824844
* exception.backtrace_locations -> array

eval.c

Lines changed: 20 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -519,13 +519,25 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
519519
rb_ivar_set(mesg, idBt_locations, at);
520520
}
521521
}
522-
else if (NIL_P(get_backtrace(mesg))) {
523-
at = rb_vm_backtrace_object();
524-
if (OBJ_FROZEN(mesg)) {
525-
mesg = rb_obj_dup(mesg);
522+
else {
523+
int status;
524+
525+
TH_PUSH_TAG(th);
526+
if ((status = EXEC_TAG()) == 0) {
527+
VALUE bt;
528+
if (rb_threadptr_set_raised(th)) goto fatal;
529+
bt = rb_get_backtrace(mesg);
530+
if (NIL_P(bt)) {
531+
at = rb_vm_backtrace_object();
532+
if (OBJ_FROZEN(mesg)) {
533+
mesg = rb_obj_dup(mesg);
534+
}
535+
rb_ivar_set(mesg, idBt_locations, at);
536+
set_backtrace(mesg, at);
537+
}
538+
rb_threadptr_reset_raised(th);
526539
}
527-
rb_ivar_set(mesg, idBt_locations, at);
528-
set_backtrace(mesg, at);
540+
TH_POP_TAG();
529541
}
530542
}
531543

@@ -567,6 +579,7 @@ setup_exception(rb_thread_t *th, int tag, volatile VALUE mesg, VALUE cause)
567579
}
568580

569581
if (rb_threadptr_set_raised(th)) {
582+
fatal:
570583
th->errinfo = exception_error;
571584
rb_threadptr_reset_raised(th);
572585
JUMP_TAG(TAG_FATAL);
@@ -1587,7 +1600,7 @@ errat_getter(ID id)
15871600
{
15881601
VALUE err = get_errinfo();
15891602
if (!NIL_P(err)) {
1590-
return get_backtrace(err);
1603+
return rb_get_backtrace(err);
15911604
}
15921605
else {
15931606
return Qnil;

0 commit comments

Comments
 (0)