# \[Bug #3443\] require$B$,CY$/$J$k(B

**URL:** <https://www.ruby-forum.com/t/bug-3443-require-b-cy-j-k-b/190185>\
**Category:** Development\
**Created:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/bug-3443-require-b-cy-j-k-b/190185 "2010-06-17T16:22:14Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Yusuke\_E](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/f08c70/32.png) [@Yusuke\_E](https://www.ruby-forum.com/u/Yusuke_E)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/bug-3443-require-b-cy-j-k-b/190185/1 "2010-06-17T16:22:14Z")

</div>

e$B%A%1%C%He(B #3443 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$B%+%F%4%je(B coree$B$K%;%C%He(B  
e$BC4Ev\<Te(B Yusuke E.e$B$K%;%C%He(B

e$B1sF#$G$9!#e(B

prepare\_iseq\_build e$B$NCf$Ge(B expand\_path  
e$B$9$k$N$O3N$+$KCY$=$&$J$N$G!"e(B  
rb\_iseq\_new e$B$r8F$VB&$G$=$l$\>$le(B expand\_path  
e$B$9$k$h$&$J%Q%C%A$r=q$$$Fe(B  
e$B$_$^$7$?!#e(B  
e$B;01:$5$s$+$i8z2L$,3NG’$7$F$b$i$C$?$i%3%_%C%H$7$h$&$H;W$$$^$9!#e(B

diff --git a/eval\_intern.h b/eval\_intern.h  
index 909b10a…549953a 100644  
— a/eval\_intern.h  
+++ b/eval\_intern.h  
@@ -205,7 +205,7 @@ NORETURN(void rb\_raise\_method\_missing(rb\_thread\_t  
\*th, int argc, VALUE \*argv,

VALUE rb\_vm\_make\_jump\_tag\_but\_local\_jump(int state, VALUE val);  
NODE \*rb\_vm\_cref(void);  
-VALUE rb\_vm\_call\_cfunc(VALUE recv, VALUE (\*func)(VALUE), VALUE arg,  
const rb\_block\_t \*blockptr, VALUE filename, VALUE filepath);  
+VALUE rb\_vm\_call\_cfunc(VALUE recv, VALUE (\*func)(VALUE), VALUE arg,  
const rb\_block\_t \*blockptr, VALUE filename);  
void rb\_vm\_set\_progname(VALUE filename);  
void rb\_thread\_terminate\_all(void);  
VALUE rb\_vm\_top\_self();  
diff --git a/iseq.c b/iseq.c  
index 48d0cdf…ae45884 100644  
— a/iseq.c  
+++ b/iseq.c  
@@ -228,7 +228,7 @@ prepare\_iseq\_build(rb\_iseq\_t \*iseq,

```
 iseq->name = name;
 iseq->filename = filename;

```

- iseq-\>filepath = filepath == Qnil ? Qnil :  
rb\_realpath\_internal(Qnil, filepath, 1);

- iseq-\>filepath = filepath;  
iseq-\>line\_no = (unsigned short)line\_no; /\* TODO: really enough? \*/  
iseq-\>defined\_method\_id = 0;  
iseq-\>mark\_ary = rb\_ary\_tmp\_new(3);  
@@ -606,7 +606,8 @@ iseq\_s\_compile\_file(int argc, VALUE \*argv, VALUE  
self)  
parser = rb\_parser\_new();  
node = rb\_parser\_compile\_file(parser, fname, f, NUM2INT(line));  
make\_compile\_option(&option, opt);

- return rb\_iseq\_new\_with\_opt(node, rb\_str\_new2(“”), file,  
file, line, Qfalse,

- return rb\_iseq\_new\_with\_opt(node, rb\_str\_new2(“”), file,
- 

```
   rb_realpath_internal(Qnil, file, 1), line, Qfalse,
   ISEQ_TYPE_TOP, &option);

```

}

diff --git a/load.c b/load.c  
index b4ec2d9…a0e5a4b 100644  
— a/load.c  
+++ b/load.c  
@@ -297,7 +297,7 @@ rb\_load\_internal(VALUE fname, int wrap)  
th-\>mild\_compile\_error++;  
node = (NODE \*)rb\_load\_file(RSTRING\_PTR(fname));  
loaded = TRUE;

- iseq = rb\_iseq\_new\_top(node, rb\_str\_new2(“\<top (required)\>”), fname,  
fname, Qfalse);

- iseq = rb\_iseq\_new\_top(node, rb\_str\_new2(“\<top (required)\>”), fname,  
rb\_realpath\_internal(Qnil, fname, 1), Qfalse);  
th-\>mild\_compile\_error–;  
rb\_iseq\_eval(iseq);  
}  
@@ -596,7 +596,7 @@ rb\_require\_safe(VALUE fname, int safe)

- 

```
           path, 0, path, path);

```

- 

```
           path, 0, path);
   rb_ary_push(ruby_dln_librefs, LONG2NUM(handle));
   break;

```

}  
@@ -643,7 +643,7 @@ ruby\_init\_ext(const char \*name, void (\*init)(void))  
{  
if (load\_lock(name)) {  
rb\_vm\_call\_cfunc(rb\_vm\_top\_self(), init\_ext\_call, (VALUE)init,

- 

```
  0, rb_str_new2(name), Qnil);

```

- 

```
  0, rb_str_new2(name));

```

rb\_provide(name);  
load\_unlock(name, 1);  
}  
diff --git a/ruby.c b/ruby.c  
index daaf0d6…75ea88f 100644  
— a/ruby.c  
+++ b/ruby.c  
@@ -1462,7 +1462,8 @@ process\_options(int argc, char \*\*argv, struct  
cmdline\_options \*opt)

PREPARE\_PARSE\_MAIN({  
VALUE path = Qnil;

- if (!opt-\>e\_script && strcmp(opt-\>script, “-”)) path =  
opt-\>script\_name;

- if (!opt-\>e\_script && strcmp(opt-\>script, “-”))
- 

```
 path = rb_realpath_internal(Qnil, opt->script_name, 1);

```

iseq = rb\_iseq\_new\_main(tree, opt-\>script\_name, path);  
});

diff --git a/vm.c b/vm.c  
index bc11094…3516024 100644  
— a/vm.c  
+++ b/vm.c  
@@ -1450,11 +1450,11 @@ rb\_thread\_current\_status(const rb\_thread\_t \*th)

VALUE  
rb\_vm\_call\_cfunc(VALUE recv, VALUE (\*func)(VALUE), VALUE arg,

- 

```
const rb_block_t *blockptr, VALUE filename, VALUE filepath)

```

- 

```
const rb_block_t *blockptr, VALUE filename)

```

{  
rb\_thread\_t \*th = GET\_THREAD();  
const rb\_control\_frame\_t \*reg\_cfp = th-\>cfp;

- volatile VALUE iseqval = rb\_iseq\_new(0, filename, filename,  
filepath, 0, ISEQ\_TYPE\_TOP);

- volatile VALUE iseqval = rb\_iseq\_new(0, filename, filename, Qnil,  
0, ISEQ\_TYPE\_TOP);  
VALUE val;

## – Yusuke E. [removed\_email\_address@domain.invalid](mailto:removed_email_address@domain.invalid)

[http://redmine.ruby-lang.org/issues/show/3443](http://redmine.ruby-lang.org/issues/show/3443)

---

<div class="post-metadata">

**Author:** ![Yusuke\_E](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/f08c70/32.png) [@Yusuke\_E](https://www.ruby-forum.com/u/Yusuke_E)\
**Post date:** [June 17, 2010, 4:22pm UTC](https://www.ruby-forum.com/t/bug-3443-require-b-cy-j-k-b/190185/2 "2010-06-17T16:22:45Z")

</div>

e$B;01:$G$9e(B

e$B%Q%C%A$"$j$,$H$&$4$6$$$^$9!#8z2L$r3NG’$7$^$7$?!#e(B

> e$B;01:$5$s$+$i8z2L$,3NG’$7$F$b$i$C$?$i%3%\_%C%H$7$h$&$H;W$$$^$9!#e(B

e$B7k2L!"e(B3e$BG\0J\>e$NB.EY8~\>e$G$7$?!#e(B  
yarv2llvme$B$Ge(Bfibe$B$r%3%s%Q%$%k$7$F\<B9T$9$k;~4V$rB,Dj$7$^$7$?!#e(B3e$B2sB,Dj$7$Fe(B  
e$B0lHV@.@S$NNI$$$b$N$r:$;$F$$$^$9!#e(B

Rubye$B$N%P!\<%8%g%se(B  
$ ruby -v  
ruby 1.9.3dev (2010-06-16 trunk 28332) [i386-cygwin]

e$B%Q%C%AA0e(B

$ time ruby -I . -I lib/ yarv2llvm.rb fib.rb  
102334155

real 0m34.876s  
user 0m4.102s  
sys 0m14.476s

e$B%Q%C%A8ee(B

$ time ruby -I . -I lib/ yarv2llvm.rb fib.rb  
102334155

real 0m9.816s  
user 0m2.760s  
sys 0m3.462s

---

<div class="post-metadata">

**Author:** ![Yusuke\_E](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/y/f08c70/32.png) [@Yusuke\_E](https://www.ruby-forum.com/u/Yusuke_E)\
**Post date:** [June 17, 2010, 4:40pm UTC](https://www.ruby-forum.com/t/bug-3443-require-b-cy-j-k-b/190185/3 "2010-06-17T16:40:03Z")

</div>

e$B%A%1%C%He(B #3443 e$B$,99?7$5$l$^$7$?!#e(B (by Yusuke E.)

e$B%9%F!\<%?%9e(B Opene$B$+$ie(BClosede$B$KJQ99e(B  
e$B?JD=e(B % 0e$B$+$ie(B100e$B$KJQ99e(B

This issue was solved with changeset r28351.  
Yusuke, thank you for reporting this issue.  
Your contribution to Ruby is greatly appreciated.  
May Ruby be with you.

* * *

[http://redmine.ruby-lang.org/issues/show/3443](http://redmine.ruby-lang.org/issues/show/3443)
