Skip to content

Commit

Permalink
Complete reorganization of bootstrap. Addition of kernel/platform. FF…
Browse files Browse the repository at this point in the history
…I fixed.

New restrictions for meta-programming in core bodies (not in methods).
kernel/platform is now where platform specific code, mainly related to FFI, lives.
A bunch of FFI bugs have been fixed and it should be working much better now.

FFI Note: you may now only specify :state as your first argument, and you must
leave it off when you call the method (rather than passing nil like before).
  • Loading branch information
evanphx committed Aug 18, 2007
1 parent d9da6dc commit 541bcb5
Show file tree
Hide file tree
Showing 98 changed files with 2,804 additions and 2,564 deletions.
2 changes: 1 addition & 1 deletion .gitignore
Expand Up @@ -5,7 +5,7 @@ code-cache
.hg
COMMIT
.load_order.txt

CI-specs
*.rbc

!runtime/loader.rbc
Expand Down
13 changes: 13 additions & 0 deletions Rakefile
Expand Up @@ -10,6 +10,7 @@ end

@pb = "runtime/pristine_bootstrap.rba"
@pc = "runtime/pristine_core.rba"
@pl = "runtime/pristine_loader.rbc"

if File.exists?(@pb)
puts "Using #{@pb} for bootstrap."
Expand All @@ -21,6 +22,11 @@ if File.exists?(@pc)
ENV['CORE'] = @pc
end

if File.exists?(@pl)
puts "Using #{@pl} for the loader."
ENV['LOADER'] = @pl
end

@compiler = ENV['COMPILER']

def update_archive(files, archive, dir=nil)
Expand Down Expand Up @@ -227,6 +233,13 @@ namespace :build do
files = Dir["compiler/**/*.rb"].sort
update_archive files, 'runtime/compiler.rba', "compiler"
end

desc "Compiles the Rubinius platform archive"
task :platform do
files = Dir["kernel/platform/*.rb"].sort
update_archive files, 'runtime/platform.rba'
end

end

desc "Remove all .rbc files from the project"
Expand Down
25 changes: 17 additions & 8 deletions compiler/bytecode/compiler.rb
Expand Up @@ -1263,15 +1263,22 @@ def do_resbody(x, rr, fin)
one_cond = (cond.size == 1)

bl = unique_lbl('resbody_')
while cur = cond.shift
add "push_exception"
process cur
add "send === 1"
if cond.empty?
gif nxt
else
git bl

# If Object is your condition, we run it without checking
# since everything is an object.
unless cond == [[:const, :Object]]

while cur = cond.shift
add "push_exception"
process cur
add "send === 1"
if cond.empty?
gif nxt
else
git bl
end
end

end

if !one_cond
Expand Down Expand Up @@ -1718,8 +1725,10 @@ def detect_class_special(x)
return true
elsif recv = [:self] and meth == :private and args.empty?
@compiler.flags[:visibility] = :private
return true
elsif recv = [:self] and meth == :public and args.empty?
@compiler.flags[:visibility] = :public
return true
end
return false
end
Expand Down
16 changes: 16 additions & 0 deletions doc/point_of_bootstrap.txt
@@ -0,0 +1,16 @@
The point of the bootstrap step is to build up just enough functionality to:

1) use alias
2) run FFI (for platform code)
3) provide basic error reporting (primary related to method_missing)

It also serves ot attach all primitives. Primitives are ONLY allowed to be
attached in bootstrap.

All functionality provided by bootstrap may be redefined in core to provide
a 'proper' implementation.

Rules of bootstrap:

1) limited to no metaprogramming. The bootstrap should be a container of code only.
if it runs code, then order starts to matter and things fall apart.
12 changes: 0 additions & 12 deletions kernel/bootstrap/00io.rb

This file was deleted.

33 changes: 0 additions & 33 deletions kernel/bootstrap/00object.rb

This file was deleted.

45 changes: 0 additions & 45 deletions kernel/bootstrap/01class.rb

This file was deleted.

74 changes: 0 additions & 74 deletions kernel/bootstrap/02module.rb

This file was deleted.

0 comments on commit 541bcb5

Please sign in to comment.