better_caller 0.0.1 → 0.1.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/ext/version.h CHANGED
@@ -1,29 +1,29 @@
1
- #define RUBY_VERSION "1.9.1"
2
- #define RUBY_PATCHLEVEL 376
1
+ #define RUBY_VERSION "1.9.2"
2
+ #define RUBY_PATCHLEVEL 136
3
3
  #define RUBY_VERSION_MAJOR 1
4
4
  #define RUBY_VERSION_MINOR 9
5
5
  #define RUBY_VERSION_TEENY 1
6
6
 
7
- #define RUBY_RELEASE_YEAR 2009
7
+ #define RUBY_RELEASE_YEAR 2010
8
8
  #define RUBY_RELEASE_MONTH 12
9
- #define RUBY_RELEASE_DAY 7
10
- #define RUBY_RELEASE_DATE "2009-12-07"
9
+ #define RUBY_RELEASE_DAY 25
10
+ #define RUBY_RELEASE_DATE "2010-12-25"
11
11
 
12
- #ifdef RUBY_EXTERN
13
- RUBY_EXTERN const char ruby_version[];
14
- RUBY_EXTERN const char ruby_release_date[];
15
- RUBY_EXTERN const char ruby_platform[];
16
- RUBY_EXTERN const int ruby_patchlevel;
17
- RUBY_EXTERN const char ruby_description[];
18
- RUBY_EXTERN const char ruby_copyright[];
19
- #endif
12
+ #include "ruby/version.h"
20
13
 
21
- #define RUBY_AUTHOR "Yukihiro Matsumoto"
22
- #define RUBY_BIRTH_YEAR 1993
23
- #define RUBY_BIRTH_MONTH 2
24
- #define RUBY_BIRTH_DAY 24
14
+ #if !defined RUBY_LIB_VERSION && defined RUBY_LIB_VERSION_STYLE
15
+ # if RUBY_LIB_VERSION_STYLE == 3
16
+ # define RUBY_LIB_VERSION STRINGIZE(RUBY_VERSION_MAJOR)"."STRINGIZE(RUBY_VERSION_MINOR)"."STRINGIZE(RUBY_VERSION_TEENY)
17
+ # elif RUBY_LIB_VERSION_STYLE == 2
18
+ # define RUBY_LIB_VERSION STRINGIZE(RUBY_VERSION_MAJOR)"."STRINGIZE(RUBY_VERSION_MINOR)
19
+ # endif
20
+ #endif
25
21
 
22
+ #if RUBY_PATCHLEVEL == -1
23
+ #define RUBY_PATCHLEVEL_STR "dev"
24
+ #else
26
25
  #define RUBY_PATCHLEVEL_STR "p"STRINGIZE(RUBY_PATCHLEVEL)
26
+ #endif
27
27
 
28
28
  #ifndef RUBY_REVISION
29
29
  # include "revision.h"
data/ext/vm_core.h CHANGED
@@ -1,6 +1,6 @@
1
1
  /**********************************************************************
2
2
 
3
- vm_core.h -
3
+ vm_core.h -
4
4
 
5
5
  $Author: yugui $
6
6
  created at: 04/01/01 19:41:38 JST
@@ -21,6 +21,7 @@
21
21
  #include "debug.h"
22
22
  #include "vm_opts.h"
23
23
  #include "id.h"
24
+ #include "method.h"
24
25
 
25
26
  #if defined(_WIN32)
26
27
  #include "thread_win32.h"
@@ -30,6 +31,21 @@
30
31
  #error "unsupported thread type"
31
32
  #endif
32
33
 
34
+ #ifndef ENABLE_VM_OBJSPACE
35
+ #ifdef _WIN32
36
+ /*
37
+ * TODO: object space indenpendent st_table.
38
+ * socklist needs st_table in rb_w32_sysinit(), before object space
39
+ * initialization.
40
+ * It is too early now to change st_hash_type, since it breaks binary
41
+ * compatibility.
42
+ */
43
+ #define ENABLE_VM_OBJSPACE 0
44
+ #else
45
+ #define ENABLE_VM_OBJSPACE 1
46
+ #endif
47
+ #endif
48
+
33
49
  #include <setjmp.h>
34
50
  #include <signal.h>
35
51
 
@@ -47,6 +63,10 @@
47
63
  #define va_init_list(a,b) va_start(a)
48
64
  #endif
49
65
 
66
+ #if defined(SIGSEGV) && defined(HAVE_SIGALTSTACK) && defined(SA_SIGINFO) && !defined(__NetBSD__)
67
+ #define USE_SIGALTSTACK
68
+ #endif
69
+
50
70
  /*****************/
51
71
  /* configuration */
52
72
  /*****************/
@@ -90,8 +110,16 @@
90
110
  #define UNLIKELY(x) (x)
91
111
  #endif /* __GNUC__ >= 3 */
92
112
 
113
+ #if __GNUC__ >= 3
114
+ #define UNINITIALIZED_VAR(x) x = x
115
+ #else
116
+ #define UNINITIALIZED_VAR(x) x
117
+ #endif
118
+
93
119
  typedef unsigned long rb_num_t;
94
120
 
121
+ /* iseq data type */
122
+
95
123
  struct iseq_compile_data_ensure_node_stack;
96
124
 
97
125
  typedef struct rb_compile_option_struct {
@@ -106,6 +134,16 @@ typedef struct rb_compile_option_struct {
106
134
  int debug_level;
107
135
  } rb_compile_option_t;
108
136
 
137
+ struct iseq_inline_cache_entry {
138
+ VALUE ic_vmstat;
139
+ VALUE ic_class;
140
+ union {
141
+ VALUE value;
142
+ rb_method_entry_t *method;
143
+ long index;
144
+ } ic_value;
145
+ };
146
+
109
147
  #if 1
110
148
  #define GetCoreDataFromValue(obj, type, ptr) do { \
111
149
  ptr = (type*)DATA_PTR(obj); \
@@ -127,6 +165,7 @@ struct rb_iseq_struct {
127
165
  VALUE type; /* instruction sequence type */
128
166
  VALUE name; /* String: iseq name */
129
167
  VALUE filename; /* file information where this sequence from */
168
+ VALUE filepath; /* real file path or nil */
130
169
  VALUE *iseq; /* iseq (insn number and openrads) */
131
170
  VALUE *iseq_encoded; /* encoded iseq */
132
171
  unsigned long iseq_size;
@@ -136,13 +175,16 @@ struct rb_iseq_struct {
136
175
 
137
176
  /* insn info, must be freed */
138
177
  struct iseq_insn_info_entry *insn_info_table;
139
- unsigned long insn_info_size;
178
+ size_t insn_info_size;
140
179
 
141
180
  ID *local_table; /* must free */
142
181
  int local_table_size;
143
182
 
144
183
  /* method, class frame: sizeof(vars) + 1, block frame: sizeof(vars) */
145
- int local_size;
184
+ int local_size;
185
+
186
+ struct iseq_inline_cache_entry *ic_entries;
187
+ int ic_size;
146
188
 
147
189
  /**
148
190
  * argument information
@@ -177,7 +219,7 @@ struct rb_iseq_struct {
177
219
  int arg_size;
178
220
  VALUE *arg_opt_table;
179
221
 
180
- int stack_max; /* for stack overflow check */
222
+ size_t stack_max; /* for stack overflow check */
181
223
 
182
224
  /* catch table */
183
225
  struct iseq_catch_table_entry *catch_table;
@@ -195,7 +237,7 @@ struct rb_iseq_struct {
195
237
  VALUE orig; /* non-NULL if its data have origin */
196
238
 
197
239
  /* block inlining */
198
- /*
240
+ /*
199
241
  * NODE *node;
200
242
  * void *special_block_builder;
201
243
  * void *cached_special_block_builder;
@@ -220,11 +262,14 @@ enum ruby_special_exceptions {
220
262
  ruby_special_error_count
221
263
  };
222
264
 
223
- typedef struct rb_iseq_struct rb_iseq_t;
224
-
225
265
  #define GetVMPtr(obj, ptr) \
226
266
  GetCoreDataFromValue(obj, rb_vm_t, ptr)
227
267
 
268
+ #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
269
+ struct rb_objspace;
270
+ void rb_objspace_free(struct rb_objspace *);
271
+ #endif
272
+
228
273
  typedef struct rb_vm_struct {
229
274
  VALUE self;
230
275
 
@@ -251,7 +296,7 @@ typedef struct rb_vm_struct {
251
296
  VALUE load_path;
252
297
  VALUE loaded_features;
253
298
  struct st_table *loading_table;
254
-
299
+
255
300
  /* signal */
256
301
  struct {
257
302
  VALUE cmd;
@@ -266,6 +311,8 @@ typedef struct rb_vm_struct {
266
311
  VALUE verbose, debug, progname;
267
312
  VALUE coverages;
268
313
 
314
+ struct unlinked_method_entry_list_entry *unlinked_method_entry_list;
315
+
269
316
  #if defined(ENABLE_VM_OBJSPACE) && ENABLE_VM_OBJSPACE
270
317
  struct rb_objspace *objspace;
271
318
  #endif
@@ -282,8 +329,7 @@ typedef struct {
282
329
  VALUE *dfp; /* cfp[7] / block[2] */
283
330
  rb_iseq_t *block_iseq; /* cfp[8] / block[3] */
284
331
  VALUE proc; /* cfp[9] / block[4] */
285
- ID method_id; /* cfp[10] saved in special case */
286
- VALUE method_class; /* cfp[11] saved in special case */
332
+ const rb_method_entry_t *me;/* cfp[10] */
287
333
  } rb_control_frame_t;
288
334
 
289
335
  typedef struct rb_block_struct {
@@ -314,8 +360,8 @@ struct rb_vm_tag {
314
360
  struct rb_vm_tag *prev;
315
361
  };
316
362
 
317
- struct rb_vm_trap_tag {
318
- struct rb_vm_trap_tag *prev;
363
+ struct rb_vm_protect_tag {
364
+ struct rb_vm_protect_tag *prev;
319
365
  };
320
366
 
321
367
  #define RUBY_VM_VALUE_CACHE_SIZE 0x1000
@@ -340,12 +386,15 @@ typedef struct rb_thread_struct
340
386
  int safe_level;
341
387
  int raised_flag;
342
388
  VALUE last_status; /* $? */
343
-
389
+
344
390
  /* passing state */
345
391
  int state;
346
392
 
347
393
  /* for rb_iterate */
348
- rb_block_t *passed_block;
394
+ const rb_block_t *passed_block;
395
+
396
+ /* for bmethod */
397
+ const rb_method_entry_t *passed_me;
349
398
 
350
399
  /* for load(true) */
351
400
  VALUE top_self;
@@ -381,7 +430,7 @@ typedef struct rb_thread_struct
381
430
  int transition_for_lock;
382
431
 
383
432
  struct rb_vm_tag *tag;
384
- struct rb_vm_trap_tag *trap_tag;
433
+ struct rb_vm_protect_tag *protect_tag;
385
434
 
386
435
  int parse_in_eval;
387
436
  int mild_compile_error;
@@ -428,17 +477,20 @@ typedef struct rb_thread_struct
428
477
  /* misc */
429
478
  int method_missing_reason;
430
479
  int abort_on_exception;
480
+ #ifdef USE_SIGALTSTACK
481
+ void *altstack;
482
+ #endif
431
483
  } rb_thread_t;
432
484
 
433
485
  /* iseq.c */
434
- VALUE rb_iseq_new(NODE*, VALUE, VALUE, VALUE, VALUE);
435
- VALUE rb_iseq_new_top(NODE *node, VALUE name, VALUE filename, VALUE parent);
436
- VALUE rb_iseq_new_main(NODE *node, VALUE filename);
437
- VALUE rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
438
- VALUE rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, const rb_compile_option_t*);
486
+ VALUE rb_iseq_new(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE);
487
+ VALUE rb_iseq_new_top(NODE *node, VALUE name, VALUE filename, VALUE filepath, VALUE parent);
488
+ VALUE rb_iseq_new_main(NODE *node, VALUE filename, VALUE filepath);
489
+ VALUE rb_iseq_new_with_bopt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE);
490
+ VALUE rb_iseq_new_with_opt(NODE*, VALUE, VALUE, VALUE, VALUE, VALUE, VALUE, const rb_compile_option_t*);
439
491
  VALUE rb_iseq_compile(VALUE src, VALUE file, VALUE line);
440
492
  VALUE rb_iseq_disasm(VALUE self);
441
- VALUE rb_iseq_disasm_insn(VALUE str, VALUE *iseqval, int pos, rb_iseq_t *iseq, VALUE child);
493
+ int rb_iseq_disasm_insn(VALUE str, VALUE *iseqval, size_t pos, rb_iseq_t *iseq, VALUE child);
442
494
  const char *ruby_node_name(int node);
443
495
  int rb_iseq_first_lineno(rb_iseq_t *iseq);
444
496
 
@@ -450,11 +502,6 @@ RUBY_EXTERN VALUE rb_mRubyVMFrozenCore;
450
502
  /* each thread has this size stack : 128KB */
451
503
  #define RUBY_VM_THREAD_STACK_SIZE (128 * 1024)
452
504
 
453
- struct global_entry {
454
- struct global_variable *var;
455
- ID id;
456
- };
457
-
458
505
  #define GetProcPtr(obj, ptr) \
459
506
  GetCoreDataFromValue(obj, rb_proc_t, ptr)
460
507
 
@@ -484,9 +531,10 @@ typedef struct {
484
531
 
485
532
  typedef struct {
486
533
  VALUE env;
534
+ VALUE filename;
535
+ unsigned short line_no;
487
536
  } rb_binding_t;
488
537
 
489
-
490
538
  /* used by compile time and send insn */
491
539
  #define VM_CALL_ARGS_SPLAT_BIT (0x01 << 1)
492
540
  #define VM_CALL_ARGS_BLOCKARG_BIT (0x01 << 2)
@@ -495,10 +543,11 @@ typedef struct {
495
543
  #define VM_CALL_TAILCALL_BIT (0x01 << 5)
496
544
  #define VM_CALL_TAILRECURSION_BIT (0x01 << 6)
497
545
  #define VM_CALL_SUPER_BIT (0x01 << 7)
498
- #define VM_CALL_SEND_BIT (0x01 << 8)
546
+ #define VM_CALL_OPT_SEND_BIT (0x01 << 8)
499
547
 
500
- #define VM_SPECIAL_OBJECT_VMCORE 0x01
501
- #define VM_SPECIAL_OBJECT_CBASE 0x02
548
+ #define VM_SPECIAL_OBJECT_VMCORE 0x01
549
+ #define VM_SPECIAL_OBJECT_CBASE 0x02
550
+ #define VM_SPECIAL_OBJECT_CONST_BASE 0x03
502
551
 
503
552
  #define VM_FRAME_MAGIC_METHOD 0x11
504
553
  #define VM_FRAME_MAGIC_BLOCK 0x21
@@ -518,19 +567,17 @@ typedef struct {
518
567
  /* other frame flag */
519
568
  #define VM_FRAME_FLAG_PASSED 0x0100
520
569
 
521
-
522
570
  #define RUBYVM_CFUNC_FRAME_P(cfp) \
523
571
  (VM_FRAME_TYPE(cfp) == VM_FRAME_MAGIC_CFUNC)
524
572
 
573
+ /* inline cache */
574
+ typedef struct iseq_inline_cache_entry *IC;
525
575
 
526
- /* inline (method|const) cache */
527
- #define NEW_INLINE_CACHE_ENTRY() NEW_WHILE(Qundef, 0, 0)
528
- #define ic_class u1.value
529
- #define ic_method u2.node
530
- #define ic_value u2.value
531
- #define ic_vmstat u3.cnt
532
- typedef NODE *IC;
576
+ extern VALUE ruby_vm_global_state_version;
533
577
 
578
+ #define GET_VM_STATE_VERSION() (ruby_vm_global_state_version)
579
+ #define INC_VM_STATE_VERSION() \
580
+ (ruby_vm_global_state_version = (ruby_vm_global_state_version+1) & 0x8fffffff)
534
581
  void rb_vm_change_state(void);
535
582
 
536
583
  typedef VALUE CDHASH;
@@ -559,8 +606,6 @@ typedef rb_control_frame_t *
559
606
  #define RUBY_VM_NORMAL_ISEQ_P(ptr) \
560
607
  (ptr && !RUBY_VM_IFUNC_P(ptr))
561
608
 
562
- #define RUBY_VM_CLASS_SPECIAL_P(ptr) (((VALUE)(ptr)) & 0x02)
563
-
564
609
  #define RUBY_VM_GET_BLOCK_PTR_IN_CFP(cfp) ((rb_block_t *)(&(cfp)->self))
565
610
  #define RUBY_VM_GET_CFP_FROM_BLOCK_PTR(b) \
566
611
  ((rb_control_frame_t *)((VALUE *)(b) - 5))
@@ -575,9 +620,7 @@ extern void rb_vmdebug_stack_dump_raw(rb_thread_t *, rb_control_frame_t *);
575
620
  #define SDR2(cfp) rb_vmdebug_stack_dump_raw(GET_THREAD(), (cfp))
576
621
  void rb_vm_bugreport(void);
577
622
 
578
-
579
623
  /* functions about thread/vm execution */
580
-
581
624
  VALUE rb_iseq_eval(VALUE iseqval);
582
625
  VALUE rb_iseq_eval_main(VALUE iseqval);
583
626
  void rb_enable_interrupt(void);
@@ -585,18 +628,29 @@ void rb_disable_interrupt(void);
585
628
  int rb_thread_method_id_and_class(rb_thread_t *th, ID *idp, VALUE *klassp);
586
629
 
587
630
  VALUE rb_vm_invoke_proc(rb_thread_t *th, rb_proc_t *proc, VALUE self,
588
- int argc, const VALUE *argv, rb_block_t *blockptr);
631
+ int argc, const VALUE *argv, const rb_block_t *blockptr);
589
632
  VALUE rb_vm_make_proc(rb_thread_t *th, const rb_block_t *block, VALUE klass);
590
633
  VALUE rb_vm_make_env_object(rb_thread_t *th, rb_control_frame_t *cfp);
591
634
 
635
+ void rb_thread_start_timer_thread(void);
636
+ void rb_thread_stop_timer_thread(void);
637
+ void rb_thread_reset_timer_thread(void);
592
638
  void *rb_thread_call_with_gvl(void *(*func)(void *), void *data1);
593
639
  int ruby_thread_has_gvl_p(void);
640
+ VALUE rb_make_backtrace(void);
641
+ typedef int rb_backtrace_iter_func(void *, VALUE, int, VALUE);
642
+ int rb_backtrace_each(rb_backtrace_iter_func *iter, void *arg);
594
643
  rb_control_frame_t *rb_vm_get_ruby_level_next_cfp(rb_thread_t *th, rb_control_frame_t *cfp);
644
+ int rb_vm_get_sourceline(const rb_control_frame_t *);
645
+ VALUE rb_name_err_mesg_new(VALUE obj, VALUE mesg, VALUE recv, VALUE method);
595
646
 
596
647
  NOINLINE(void rb_gc_save_machine_context(rb_thread_t *));
597
648
 
598
649
  #define sysstack_error GET_VM()->special_exceptions[ruby_error_sysstack]
599
650
 
651
+ VALUE rb_str_resurrect(VALUE str);
652
+ VALUE rb_ary_resurrect(VALUE ary);
653
+
600
654
  /* for thread */
601
655
 
602
656
  #if RUBY_VM_THREAD_MODEL == 2
@@ -620,11 +674,17 @@ extern rb_vm_t *ruby_current_vm;
620
674
  #define RUBY_VM_SET_FINALIZER_INTERRUPT(th) ((th)->interrupt_flag |= 0x04)
621
675
  #define RUBY_VM_INTERRUPTED(th) ((th)->interrupt_flag & 0x02)
622
676
 
623
- void rb_thread_execute_interrupts(rb_thread_t *);
677
+ void rb_threadptr_check_signal(rb_thread_t *mth);
678
+ void rb_threadptr_signal_raise(rb_thread_t *th, int sig);
679
+ void rb_threadptr_signal_exit(rb_thread_t *th);
680
+ void rb_threadptr_execute_interrupts(rb_thread_t *);
681
+
682
+ void rb_thread_lock_unlock(rb_thread_lock_t *);
683
+ void rb_thread_lock_destroy(rb_thread_lock_t *);
624
684
 
625
685
  #define RUBY_VM_CHECK_INTS_TH(th) do { \
626
686
  if (UNLIKELY(th->interrupt_flag)) { \
627
- rb_thread_execute_interrupts(th); \
687
+ rb_threadptr_execute_interrupts(th); \
628
688
  } \
629
689
  } while (0)
630
690
 
data/ext/vm_insnhelper.h CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  insnhelper.h - helper macros to implement each instructions
4
4
 
5
- $Author: yugui $
5
+ $Author: wanabe $
6
6
  created at: 04/01/01 15:50:34 JST
7
7
 
8
8
  Copyright (C) 2004-2007 Koichi Sasada
@@ -48,6 +48,7 @@ enum {
48
48
  BOP_AREF,
49
49
  BOP_ASET,
50
50
  BOP_LENGTH,
51
+ BOP_SIZE,
51
52
  BOP_SUCC,
52
53
  BOP_GT,
53
54
  BOP_GE,
@@ -58,13 +59,8 @@ enum {
58
59
  };
59
60
 
60
61
  extern char ruby_vm_redefined_flag[BOP_LAST_];
61
- extern VALUE ruby_vm_global_state_version;
62
62
  extern VALUE ruby_vm_const_missing_count;
63
63
 
64
- #define GET_VM_STATE_VERSION() (ruby_vm_global_state_version)
65
- #define INC_VM_STATE_VERSION() \
66
- (ruby_vm_global_state_version = (ruby_vm_global_state_version+1) & 0x8fffffff)
67
-
68
64
 
69
65
  /**********************************************************/
70
66
  /* deal with stack */
@@ -138,10 +134,10 @@ extern VALUE ruby_vm_const_missing_count;
138
134
 
139
135
  #define GET_PREV_DFP(dfp) ((VALUE *)((dfp)[0] & ~0x03))
140
136
 
141
- #define GET_GLOBAL(entry) rb_gvar_get((struct global_entry*)entry)
142
- #define SET_GLOBAL(entry, val) rb_gvar_set((struct global_entry*)entry, val)
137
+ #define GET_GLOBAL(entry) rb_gvar_get((struct rb_global_entry*)entry)
138
+ #define SET_GLOBAL(entry, val) rb_gvar_set((struct rb_global_entry*)entry, val)
143
139
 
144
- #define GET_CONST_INLINE_CACHE(dst) ((IC) * (GET_PC() + (dst) + 1))
140
+ #define GET_CONST_INLINE_CACHE(dst) ((IC) * (GET_PC() + (dst) + 2))
145
141
 
146
142
  /**********************************************************/
147
143
  /* deal with values */
@@ -156,12 +152,12 @@ extern VALUE ruby_vm_const_missing_count;
156
152
  #define COPY_CREF(c1, c2) do { \
157
153
  NODE *__tmp_c2 = (c2); \
158
154
  c1->nd_clss = __tmp_c2->nd_clss; \
159
- c1->nd_visi = __tmp_c2->nd_visi; \
155
+ c1->nd_visi = __tmp_c2->nd_visi;\
160
156
  c1->nd_next = __tmp_c2->nd_next; \
161
157
  } while (0)
162
158
 
163
- #define CALL_METHOD(num, blockptr, flag, id, mn, recv) do { \
164
- VALUE v = vm_call_method(th, GET_CFP(), num, blockptr, flag, id, mn, recv); \
159
+ #define CALL_METHOD(num, blockptr, flag, id, me, recv) do { \
160
+ VALUE v = vm_call_method(th, GET_CFP(), num, blockptr, flag, id, me, recv); \
165
161
  if (v == Qundef) { \
166
162
  RESTORE_REGS(); \
167
163
  NEXT_INSN(); \
@@ -172,7 +168,8 @@ extern VALUE ruby_vm_const_missing_count;
172
168
  } while (0)
173
169
 
174
170
  #define GET_BLOCK_PTR() \
175
- ((rb_block_t *)(GC_GUARDED_PTR_REF(GET_LFP()[0])))
171
+ ((rb_block_t *)(GC_GUARDED_PTR_REF(GET_LFP()[0] & \
172
+ ((GET_LFP()[0] & 0x02) - 0x02))))
176
173
 
177
174
  /**********************************************************/
178
175
  /* deal with control flow 3: exception */
@@ -188,9 +185,24 @@ extern VALUE ruby_vm_const_missing_count;
188
185
  #define BASIC_OP_UNREDEFINED_P(op) (LIKELY(ruby_vm_redefined_flag[op] == 0))
189
186
  #define HEAP_CLASS_OF(obj) RBASIC(obj)->klass
190
187
 
188
+ #ifndef USE_IC_FOR_SPECIALIZED_METHOD
189
+ #define USE_IC_FOR_SPECIALIZED_METHOD 1
190
+ #endif
191
+
192
+ #if USE_IC_FOR_SPECIALIZED_METHOD
193
+
194
+ #define CALL_SIMPLE_METHOD(num, id, recv) do { \
195
+ VALUE klass = CLASS_OF(recv); \
196
+ CALL_METHOD(num, 0, 0, id, vm_method_search(id, klass, ic), recv); \
197
+ } while (0)
198
+
199
+ #else
200
+
191
201
  #define CALL_SIMPLE_METHOD(num, id, recv) do { \
192
202
  VALUE klass = CLASS_OF(recv); \
193
- CALL_METHOD(num, 0, 0, id, rb_method_node(klass, id), recv); \
203
+ CALL_METHOD(num, 0, 0, id, rb_method_entry(klass, id), recv); \
194
204
  } while (0)
195
205
 
206
+ #endif
207
+
196
208
  #endif /* RUBY_INSNHELPER_H */
data/ext/vm_opts.h CHANGED
@@ -3,7 +3,7 @@
3
3
 
4
4
  vm_opts.h - VM optimize option
5
5
 
6
- $Author: ko1 $
6
+ $Author: akr $
7
7
 
8
8
  Copyright (C) 2004-2007 Koichi Sasada
9
9
 
@@ -0,0 +1,14 @@
1
+ # @private
2
+ class Exception
3
+ # @private
4
+ def set_better_backtrace(bt)
5
+ @better_backtrace = bt.collect do |(file, line, meth, bind)|
6
+ vars = {
7
+ local_variables: eval("local_variables.inject({}) { |hsh, var| hsh[var] = eval(var) ; hsh }", bind),
8
+ instance_variables: eval("instance_variables.inject({}) { |hsh, var| hsh[var] = eval(var) ; hsh }", bind),
9
+ global_variables: eval("global_variables.inject({}) { |hsh, var| hsh[var] = eval(var) ; hsh }", bind),
10
+ }
11
+ [ file, line, meth, vars]
12
+ end
13
+ end
14
+ end