Skip to content
Permalink
Browse files
Start merging kernel/ into a single directory.
  • Loading branch information
brixen committed Jan 25, 2016
1 parent fa397f8 commit f78737162e753a90f1e5abfe66275994608d709d
Showing with 2,230 additions and 2,113 deletions.
  1. 0 kernel/{bootstrap → }/alias.rb
  2. 0 kernel/{common → }/argf.rb
  3. +129 −0 kernel/{common → }/array.rb
  4. 0 kernel/{bootstrap → }/array_mirror.rb
  5. 0 kernel/{bootstrap → }/atomic.rb
  6. 0 kernel/{common → }/autoload.rb
  7. 0 kernel/{common → }/backtrace.rb
  8. +31 −0 kernel/{bootstrap → }/basic_object.rb
  9. +27 −0 kernel/{bootstrap → }/bignum.rb
  10. 0 kernel/{common → }/binding.rb
  11. +66 −0 kernel/{common → }/block_environment.rb
  12. +0 −129 kernel/bootstrap/array.rb
  13. +0 −66 kernel/bootstrap/block_environment.rb
  14. +0 −14 kernel/bootstrap/class.rb
  15. +0 −68 kernel/bootstrap/compiled_code.rb
  16. +0 −160 kernel/bootstrap/io.rb
  17. +0 −108 kernel/bootstrap/kernel.rb
  18. +0 −55 kernel/bootstrap/load_order.txt
  19. +0 −36 kernel/bootstrap/proc.rb
  20. +0 −16 kernel/bootstrap/process.rb
  21. +0 −69 kernel/bootstrap/regexp.rb
  22. +0 −103 kernel/bootstrap/stat.rb
  23. +0 −175 kernel/bootstrap/string.rb
  24. +0 −31 kernel/bootstrap/symbol.rb
  25. +0 −40 kernel/bootstrap/time.rb
  26. +0 −20 kernel/bootstrap/true.rb
  27. +0 −129 kernel/bootstrap/type.rb
  28. +0 −56 kernel/bootstrap/variable_scope.rb
  29. +39 −0 kernel/{bootstrap → }/byte_array.rb
  30. 0 kernel/{bootstrap → }/call_custom_cache.rb
  31. 0 kernel/{bootstrap → }/call_site.rb
  32. 0 kernel/{common → }/capi.rb
  33. +11 −0 kernel/{bootstrap → }/channel.rb
  34. 0 kernel/{bootstrap → }/character.rb
  35. +14 −0 kernel/{common → }/class.rb
  36. 0 kernel/{common → }/code_loader.rb
  37. +0 −31 kernel/common/basic_object.rb
  38. +0 −27 kernel/common/bignum.rb
  39. +0 −39 kernel/common/byte_array.rb
  40. +0 −11 kernel/common/channel.rb
  41. +0 −15 kernel/common/lookup_table.rb
  42. +0 −57 kernel/common/method_table.rb
  43. +0 −21 kernel/common/nil.rb
  44. +0 −264 kernel/common/struct.rb
  45. +0 −166 kernel/common/thread.rb
  46. +0 −150 kernel/common/tuple.rb
  47. 0 kernel/{bootstrap → }/compact_lookup_table.rb
  48. 0 kernel/{common → }/comparable.rb
  49. +68 −0 kernel/{common → }/compiled_code.rb
  50. 0 kernel/{bootstrap → }/configuration.rb
  51. 0 kernel/{bootstrap → }/constant_cache.rb
  52. 0 kernel/{bootstrap → }/constant_scope.rb
  53. 0 kernel/{bootstrap → }/constant_table.rb
  54. 0 kernel/{bootstrap → }/dir.rb
  55. 0 kernel/{bootstrap → }/encoding.rb
  56. 0 kernel/{platform → }/enum.rb
  57. 0 kernel/{platform → }/env.rb
  58. 0 kernel/{bootstrap → }/exception.rb
  59. 0 kernel/{bootstrap → }/executable.rb
  60. 0 kernel/{bootstrap → }/false.rb
  61. 0 kernel/{platform → }/ffi.rb
  62. 0 kernel/{platform → }/file.rb
  63. 0 kernel/{bootstrap → }/fixnum.rb
  64. 0 kernel/{bootstrap → }/gc.rb
  65. 0 kernel/{common → }/integer.rb
  66. +160 −0 kernel/{common → }/io.rb
  67. 0 kernel/{bootstrap → }/iseq.rb
  68. 0 kernel/{bootstrap → }/jit.rb
  69. +108 −0 kernel/{common → }/kernel.rb
  70. 0 kernel/{platform → }/library.rb
  71. +183 −0 kernel/load_order.txt
  72. 0 kernel/{common → }/loaded_features.rb
  73. 0 kernel/{common → }/location.rb
  74. 0 kernel/{bootstrap → }/logger.rb
  75. +15 −0 kernel/{bootstrap → }/lookup_table.rb
  76. 0 kernel/{common → }/lru_cache.rb
  77. 0 kernel/{common → }/main.rb
  78. 0 kernel/{common → }/marshal.rb
  79. +46 −0 kernel/{common → }/math.rb
  80. 0 kernel/{common → }/method.rb
  81. 0 kernel/{common → }/method_equality.rb
  82. +57 −0 kernel/{bootstrap → }/method_table.rb
  83. 0 kernel/{bootstrap → }/mirror.rb
  84. 0 kernel/{common → }/missing_method.rb
  85. 0 kernel/{common → }/module.rb
  86. 0 kernel/{bootstrap → }/mono_inline_cache.rb
  87. 0 kernel/{common → }/mutex.rb
  88. 0 kernel/{common → }/native_method.rb
  89. +21 −0 kernel/{bootstrap → }/nil.rb
  90. 0 kernel/{common → }/numeric.rb
  91. 0 kernel/{common → }/numeric_mirror.rb
  92. 0 kernel/{common → }/object_space.rb
  93. +0 −11 kernel/platform/load_order.txt
  94. +0 −46 kernel/platform/math.rb
  95. 0 kernel/{platform → }/pointer.rb
  96. 0 kernel/{platform → }/pointer_accessors.rb
  97. 0 kernel/{bootstrap → }/poly_inline_cache.rb
  98. 0 kernel/{platform → }/posix.rb
  99. +36 −0 kernel/{common → }/proc.rb
  100. 0 kernel/{common → }/proc_mirror.rb
  101. +16 −0 kernel/{common → }/process.rb
  102. 0 kernel/{common → }/process_mirror.rb
  103. 0 kernel/{common → }/random.rb
  104. 0 kernel/{common → }/range.rb
  105. 0 kernel/{common → }/range_mirror.rb
  106. 0 kernel/{common → }/rational.rb
  107. 0 kernel/{common → }/rationalizer.rb
  108. +69 −0 kernel/{common → }/regexp.rb
  109. 0 kernel/{bootstrap → }/respond_to_cache.rb
  110. 0 kernel/{bootstrap → }/rubinius.rb
  111. 0 kernel/{common → }/signal.rb
  112. 0 kernel/{common → }/splitter.rb
  113. 0 kernel/{common → }/sprinter.rb
  114. +103 −0 kernel/{common → }/stat.rb
  115. +175 −0 kernel/{common → }/string.rb
  116. 0 kernel/{common → }/string_mirror.rb
  117. +264 −0 kernel/{platform → }/struct.rb
  118. +31 −0 kernel/{common → }/symbol.rb
  119. +166 −0 kernel/{bootstrap → }/thread.rb
  120. 0 kernel/{common → }/thread_group.rb
  121. 0 kernel/{common → }/thread_group_mirror.rb
  122. 0 kernel/{bootstrap → }/thread_mirror.rb
  123. 0 kernel/{common → }/throw_catch.rb
  124. 0 kernel/{bootstrap → }/thunk.rb
  125. +40 −0 kernel/{common → }/time.rb
  126. +20 −0 kernel/{common → }/true.rb
  127. +150 −0 kernel/{bootstrap → }/tuple.rb
  128. +129 −0 kernel/{common → }/type.rb
  129. 0 kernel/{common → }/undefined.rb
  130. 0 kernel/{platform → }/union.rb
  131. +56 −0 kernel/{common → }/variable_scope.rb
  132. 0 kernel/{bootstrap → }/vm.rb
  133. 0 kernel/{bootstrap → }/weakref.rb
File renamed without changes.
File renamed without changes.
@@ -1,3 +1,132 @@
class Array
def self.allocate
Rubinius.primitive :array_allocate
raise PrimitiveFailure, "Array.allocate primitive failed"
end

def size
@total
end

alias_method :length, :size

def new_range(start, count)
Rubinius.primitive :array_new_range
raise PrimitiveFailure, "Array.new_range primitive failed"
end

def new_reserved(count)
Rubinius.primitive :array_new_reserved
raise PrimitiveFailure, "Array.new_reserved primitive failed"
end

# THIS MUST NOT BE REMOVED. the kernel requires a simple
# Array#[] to work while parts of the kernel boot.
def [](idx)
at(idx)
end

def []=(idx, ent)
Rubinius.check_frozen

if idx >= @tuple.fields
new_tuple = Rubinius::Tuple.new(idx + 10)
new_tuple.copy_from @tuple, @start, @total, 0
@tuple = new_tuple
end

@tuple.put @start + idx, ent
if idx >= @total - 1
@total = idx + 1
end
return ent
end

# Returns the element at the given index. If the
# index is negative, counts from the end of the
# Array. If the index is out of range, nil is
# returned. Slightly faster than +Array#[]+
def at(idx)
Rubinius.primitive :array_aref
idx = Rubinius::Type.coerce_to_collection_index idx

total = @start + @total

if idx < 0
idx += total
else
idx += @start
end

if idx >= @start and idx < total
return @tuple.at idx
end
end

# Passes each element in the Array to the given block
# and returns self.
def each
return to_enum(:each) { size } unless block_given?

i = @start
total = i + @total
tuple = @tuple

while i < total
yield tuple.at(i)
i += 1
end

self
end

# Creates a new Array from the return values of passing
# each element in self to the supplied block.
def map
return to_enum(:map) { size } unless block_given?
out = Array.new size

i = @start
total = i + @total
src = @tuple

dest = Rubinius::Mirror.reflect(out).tuple

j = 0
while i < total
dest[j] = yield src[i]
i += 1
j += 1
end

out
end

# Replaces each element in self with the return value
# of passing that element to the supplied block.
def map!
return to_enum(:map!) { size } unless block_given?

Rubinius.check_frozen

i = @start
total = i + @total
tuple = @tuple

while i < total
tuple[i] = yield tuple.at(i)
i += 1
end

self
end

def to_tuple
tuple = Rubinius::Tuple.new @total
tuple.copy_from @tuple, @start, @total, 0
tuple
end
end
class Array
include Enumerable

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
@@ -38,3 +38,34 @@ def __id__
raise ::PrimitiveFailure, "BasicObject#__id__ primitive failed"
end
end
class BasicObject
def method_missing(meth, *args)
::Kernel.raise ::NoMethodError, "Unable to send '#{meth}' on instance of BasicObject"
end
private :method_missing

def singleton_method_added(name) end
private :singleton_method_added

def singleton_method_removed(name) end
private :singleton_method_removed

def singleton_method_undefined(name) end
private :singleton_method_undefined

def __all_instance_variables__
Rubinius.primitive :object_ivar_names

raise PrimitiveFailure, "BasicObject#__instance_variables__ failed"
end
private :__all_instance_variables__

def __instance_variables__
ary = []
__all_instance_variables__.each do |sym|
ary << sym if sym.is_ivar?
end

ary
end
end
@@ -168,3 +168,30 @@ def size
raise PrimitiveFailure, "Bignum#size primitive failed"
end
end
class Bignum < Integer

# see README-DEVELOPERS regarding safe math compiler plugin
alias_method :/, :divide

def eql?(value)
value.is_a?(Bignum) && self == value
end

alias_method :modulo, :%

def fdiv(n)
to_f / n
end

def **(o)
Rubinius.primitive :bignum_pow

if o.is_a?(Float) && self < 0 && o != o.round
return Complex.new(self, 0) ** o
elsif o.is_a?(Integer) && o < 0
return Rational.new(self, 1) ** o
end

redo_coerced :**, o
end
end
File renamed without changes.
@@ -1,3 +1,69 @@
module Rubinius
class BlockEnvironment
def self.allocate
Rubinius.primitive :blockenvironment_allocate
raise PrimitiveFailure, "BlockEnvironment.allocate primitive failed"
end

def call(*args)
Rubinius.primitive :block_call
raise PrimitiveFailure, "BlockEnvironment#call primitive failed"
end

def call_under(recv, constant_scope, visibility_scope, *args)
Rubinius.primitive :block_call_under
raise PrimitiveFailure, "BlockEnvironment#call_under primitive failed"
end

def self.of_sender
Rubinius.primitive :block_env_of_sender
raise PrimitiveFailure, "BlockEnvironment#of_sender primitive failed"
end

class AsMethod < Executable
def self.new(block_env)
Rubinius.primitive :block_as_method_create
raise PrimitiveFailure, "BlockEnvironment::AsMethod.new primitive failed"
end

def arity
@block_env.compiled_code.arity
end

def local_names
@block_env.compiled_code.local_names
end

def required_args
@block_env.compiled_code.required_args
end

def total_args
@block_env.compiled_code.total_args
end

def post_args
@block_env.compiled_code.post_args
end

def splat
@block_env.compiled_code.splat
end

def block_index
@block_env.compiled_code.block_index
end

def file
@block_env.file
end

def defined_line
@block_env.line
end
end
end
end
##
# Describes the environment a block was created in. BlockEnvironment is used
# to create a BlockContext.

This file was deleted.

Loading

0 comments on commit f787371

Please sign in to comment.