[macruby-changes] [2601] MacRuby/trunk
source_changes at macosforge.org
source_changes at macosforge.org
Mon Sep 21 22:14:55 PDT 2009
Revision: 2601
http://trac.macosforge.org/projects/ruby/changeset/2601
Author: lsansonetti at apple.com
Date: 2009-09-21 22:14:51 -0700 (Mon, 21 Sep 2009)
Log Message:
-----------
move the AOT compilation of the stdlib into the main build task, introduce the VM_DISABLE_RBO environment variable to disable the load of rbo files, change instruby.rb to install the .rbo files
Modified Paths:
--------------
MacRuby/trunk/HACKING.rdoc
MacRuby/trunk/Rakefile
MacRuby/trunk/instruby.rb
MacRuby/trunk/load.c
MacRuby/trunk/rakelib/builder.rake
Modified: MacRuby/trunk/HACKING.rdoc
===================================================================
--- MacRuby/trunk/HACKING.rdoc 2009-09-22 04:19:55 UTC (rev 2600)
+++ MacRuby/trunk/HACKING.rdoc 2009-09-22 05:14:51 UTC (rev 2601)
@@ -102,6 +102,8 @@
* GC_DEBUG: set it to any value to enable GC debugging on $stderr.
+* VM_DISABLE_RBO: set it to any value to disable the load of .rbo files.
+
* VM_DUMP_IR: set it to any value to dump the LLVM IR on $stderr before the
interpreter quits.
Modified: MacRuby/trunk/Rakefile
===================================================================
--- MacRuby/trunk/Rakefile 2009-09-22 04:19:55 UTC (rev 2600)
+++ MacRuby/trunk/Rakefile 2009-09-22 05:14:51 UTC (rev 2601)
@@ -46,7 +46,7 @@
task :clean => ['clean:local', 'clean:ext']
desc "Build MacRuby and extensions"
-task :all => [:macruby, :extensions]
+task :all => [:macruby, :aot_compile_stdlib, :extensions]
desc "Create an archive (GIT only)"
task :git_archive do
@@ -59,4 +59,4 @@
desc "Run IRB"
task :irb do
exec './miniruby -I./lib ./bin/irb'
-end
\ No newline at end of file
+end
Modified: MacRuby/trunk/instruby.rb
===================================================================
--- MacRuby/trunk/instruby.rb 2009-09-22 04:19:55 UTC (rev 2600)
+++ MacRuby/trunk/instruby.rb 2009-09-22 05:14:51 UTC (rev 2601)
@@ -361,7 +361,7 @@
Dir.chdir srcdir
makedirs [rubylibdir]
- for f in Dir["lib/**/*{.rb,help-message}"]
+ for f in Dir["lib/**/*{.rb,.rbo,help-message}"]
dir = File.dirname(f).sub!(/\Alib/, rubylibdir) || rubylibdir
makedirs dir
install f, dir, :mode => $data_mode
@@ -517,14 +517,6 @@
ln_sfh File.join("../../..", CONFIG['bindir'], 'rb_nibtool'), ib_dest
install('tool/rb_nibtool.old', ib_dest, :mode => $prog_mode)
-puts "compiling (parts of) the standard library"
-files = ['universal-darwin*/rbconfig.rb', 'irb.rb', 'irb/**/*.rb']
-files.map { |file| Dir.glob(File.join(with_destdir(rubylibdir), file)) }.flatten.each do |path|
- line = "./miniruby -I. -I./lib bin/rubyc --internal -C \"#{path}\""
- $stderr.puts line
- raise 'AOT compilation failed' unless system(line)
-end
-
end # unless $installing_rdoc
# vi:set sw=2:
Modified: MacRuby/trunk/load.c
===================================================================
--- MacRuby/trunk/load.c 2009-09-22 04:19:55 UTC (rev 2600)
+++ MacRuby/trunk/load.c 2009-09-22 05:14:51 UTC (rev 2601)
@@ -12,6 +12,9 @@
#include "vm.h"
#include "dln.h"
+extern bool ruby_is_miniruby;
+static bool rbo_enabled = true;
+
VALUE
rb_get_load_path(void)
{
@@ -173,7 +176,7 @@
if (strcmp(p + 1, "rb") == 0) {
t = TYPE_RB;
}
- else if (strcmp(p + 1, "rbo") == 0) {
+ else if (rbo_enabled && strcmp(p + 1, "rbo") == 0) {
t = TYPE_RBO;
}
else if (strcmp(p + 1, "bundle") == 0) {
@@ -188,10 +191,12 @@
// No valid extension, let's append the valid ones and try to validate
// the path.
char buf[PATH_MAX];
- snprintf(buf, sizeof buf, "%s.rbo", path);
- if (path_ok(buf, out)) {
- *type = TYPE_RBO;
- return true;
+ if (rbo_enabled) {
+ snprintf(buf, sizeof buf, "%s.rbo", path);
+ if (path_ok(buf, out)) {
+ *type = TYPE_RBO;
+ return true;
+ }
}
snprintf(buf, sizeof buf, "%s.rb", path);
if (path_ok(buf, out)) {
@@ -377,6 +382,8 @@
const char *var_load_path = "$:";
ID id_load_path = rb_intern(var_load_path);
+ rbo_enabled = !ruby_is_miniruby && getenv("VM_DISABLE_RBO") == NULL;
+
rb_define_virtual_variable("$:", rb_vm_load_path, 0);
rb_alias_variable((rb_intern)("$-I"), id_load_path);
rb_alias_variable((rb_intern)("$LOAD_PATH"), id_load_path);
Modified: MacRuby/trunk/rakelib/builder.rake
===================================================================
--- MacRuby/trunk/rakelib/builder.rake 2009-09-22 04:19:55 UTC (rev 2600)
+++ MacRuby/trunk/rakelib/builder.rake 2009-09-22 05:14:51 UTC (rev 2601)
@@ -346,6 +346,19 @@
perform_extensions_target(:all)
end
+AOT_STDLIB = ['rbconfig.rb', 'lib/irb.rb', 'lib/irb/**/*.rb', 'lib/fileutils.rb']
+desc "AOT compile parts of the stdlib"
+task :aot_compile_stdlib => [:miniruby] do
+ AOT_STDLIB.each do |pat|
+ Dir.glob(pat).each do |path|
+ out = File.join(File.dirname(path), File.basename(path, '.rb') + '.rbo')
+ if !File.exist?(out) or File.mtime(path) > File.mtime(out) or File.mtime('./miniruby') > File.mtime(out)
+ sh "./miniruby -I. -I./lib bin/rubyc --internal -C \"#{path}\" -o \"#{out}\""
+ end
+ end
+ end
+end
+
desc "Same as extensions"
task :ext => 'extensions'
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macruby-changes/attachments/20090921/527600c0/attachment-0001.html>
More information about the macruby-changes
mailing list