~ubuntu-branches/ubuntu/intrepid/ruby1.9/intrepid-updates

« back to all changes in this revision

Viewing changes to blockinlining.c

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2007-09-04 16:01:17 UTC
  • mfrom: (1.1.8 upstream)
  • Revision ID: james.westby@ubuntu.com-20070904160117-i15zckg2nhxe9fyw
Tags: 1.9.0+20070830-2ubuntu1
* Sync from Debian; remaining changes:
  - Add -g to CFLAGS.
* Fixes build failure on ia64.
* Fixes build failure with gcc-4.2 on lpia.
* Robustify check for target_os, fixing build failure on lpia.
* Set Ubuntu maintainer address.

Show diffs side-by-side

added added

removed removed

Lines of Context:
3
3
  blockinlining.c -
4
4
 
5
5
  $Author: ko1 $
6
 
  $Date: 2007-02-27 07:51:33 +0900 (火, 27  2月 2007) $
 
6
  $Date: 2007-07-12 13:25:46 +0900 (木, 12  7月 2007) $
7
7
 
8
8
  Copyright (C) 2004-2006 Koichi Sasada
9
9
 
10
10
**********************************************************************/
11
11
 
12
 
#include "ruby.h"
13
 
#include "node.h"
14
 
#include "yarvcore.h"
15
 
 
16
 
VALUE yarv_new_iseqval(VALUE node, VALUE name, VALUE file,
17
 
                       VALUE parent, VALUE type, VALUE block_opt, VALUE opt);
 
12
#include "ruby/ruby.h"
 
13
#include "ruby/node.h"
 
14
#include "vm_core.h"
18
15
 
19
16
static VALUE
20
 
yarv_iseq_special_block(rb_iseq_t *iseq, void *builder)
 
17
iseq_special_block(rb_iseq_t *iseq, void *builder)
21
18
{
22
19
#if OPT_BLOCKINLINING
23
20
    VALUE parent = Qfalse;
181
178
}
182
179
 
183
180
VALUE
184
 
yarv_invoke_Integer_times_special_block(VALUE num)
 
181
invoke_Integer_times_special_block(VALUE num)
185
182
{
186
183
    rb_thread_t *th = GET_THREAD();
187
184
    rb_block_t *orig_block = GC_GUARDED_PTR_REF(th->cfp->lfp[0]);
188
185
 
189
186
    if (orig_block && BUILTIN_TYPE(orig_block->iseq) != T_NODE) {
190
 
        VALUE tsiseqval = yarv_iseq_special_block(orig_block->iseq,
191
 
                                                  build_Integer_times_node);
 
187
        VALUE tsiseqval = iseq_special_block(orig_block->iseq,
 
188
                                             build_Integer_times_node);
192
189
        rb_iseq_t *tsiseq;
193
190
        VALUE argv[2], val;
194
191
 
199
196
            th->cfp->lfp[0] = GC_GUARDED_PTR(&block);
200
197
            argv[0] = INT2FIX(0);
201
198
            argv[1] = num;
202
 
            val = th_yield(th, 2, argv);
 
199
            val = vm_yield(th, 2, argv);
203
200
            if (val == Qundef) {
204
201
                return num;
205
202
            }
297
294
}
298
295
 
299
296
VALUE
300
 
yarv_invoke_Range_each_special_block(VALUE range,
301
 
                                     VALUE beg, VALUE end, int excl)
 
297
invoke_Range_each_special_block(VALUE range,
 
298
                                VALUE beg, VALUE end, int excl)
302
299
{
303
300
    rb_thread_t *th = GET_THREAD();
304
301
    rb_block_t *orig_block = GC_GUARDED_PTR_REF(th->cfp->lfp[0]);
306
303
    if (BUILTIN_TYPE(orig_block->iseq) != T_NODE) {
307
304
        void *builder =
308
305
            excl ? build_Range_each_node_LT : build_Range_each_node_LE;
309
 
        VALUE tsiseqval = yarv_iseq_special_block(orig_block->iseq, builder);
 
306
        VALUE tsiseqval = iseq_special_block(orig_block->iseq, builder);
310
307
        rb_iseq_t *tsiseq;
311
308
        VALUE argv[2];
312
309
 
318
315
            th->cfp->lfp[0] = GC_GUARDED_PTR(&block);
319
316
            argv[0] = beg;
320
317
            argv[1] = end;
321
 
            val = th_yield(th, 2, argv);
 
318
            val = vm_yield(th, 2, argv);
322
319
            if (val == Qundef) {
323
320
                return range;
324
321
            }
429
426
}
430
427
 
431
428
VALUE
432
 
yarv_invoke_Array_each_special_block(VALUE ary)
 
429
invoke_Array_each_special_block(VALUE ary)
433
430
{
434
431
    rb_thread_t *th = GET_THREAD();
435
432
    rb_block_t *orig_block = GC_GUARDED_PTR_REF(th->cfp->lfp[0]);
436
433
 
437
434
    if (BUILTIN_TYPE(orig_block->iseq) != T_NODE) {
438
 
        VALUE tsiseqval = yarv_iseq_special_block(orig_block->iseq,
439
 
                                                  build_Array_each_node);
 
435
        VALUE tsiseqval = iseq_special_block(orig_block->iseq,
 
436
                                             build_Array_each_node);
440
437
        rb_iseq_t *tsiseq;
441
438
        VALUE argv[2];
442
439
 
448
445
            th->cfp->lfp[0] = GC_GUARDED_PTR(&block);
449
446
            argv[0] = 0;
450
447
            argv[1] = ary;
451
 
            val = th_yield(th, 2, argv);
 
448
            val = vm_yield(th, 2, argv);
452
449
            if (val == Qundef) {
453
450
                return ary;
454
451
            }