Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Use consistent PrimitiveFailure exception messages.

Primitives can fail at any time, even during VM boot where the backtrace can
be primitive or possibly missing. The following format of the PrimitiveFailure
exception message provides all necessary information to index directly to the
Ruby method and then to the primitive implementation:

  "[module scope]::class_name[.#]method_name primitive failed"

This is the minimum required exception message. If there exists only a single
possible cause of failure, that can be appended to, but does not replace,
the basic exception message.
  • Loading branch information...
commit 2f821565ba18e06e6ed472f0c0c46c533f877a79 1 parent 9cf0fd2
@brixen brixen authored
Showing with 163 additions and 163 deletions.
  1. +3 −3 kernel/alpha.rb
  2. +3 −3 kernel/bootstrap/atomic.rb
  3. +2 −2 kernel/bootstrap/basicobject.rb
  4. +1 −1  kernel/bootstrap/block_environment.rb
  5. +3 −2 kernel/bootstrap/class.rb
  6. +2 −2 kernel/bootstrap/compiled_code.rb
  7. +2 −2 kernel/bootstrap/configuration.rb
  8. +4 −4 kernel/bootstrap/gc.rb
  9. +2 −2 kernel/bootstrap/io.rb
  10. +1 −1  kernel/bootstrap/kernel.rb
  11. +1 −1  kernel/bootstrap/lookuptable.rb
  12. +3 −3 kernel/bootstrap/proc.rb
  13. +6 −6 kernel/bootstrap/process.rb
  14. +5 −6 kernel/bootstrap/regexp.rb
  15. +37 −37 kernel/bootstrap/rubinius.rb
  16. +7 −7 kernel/bootstrap/string.rb
  17. +4 −4 kernel/bootstrap/symbol.rb
  18. +5 −5 kernel/bootstrap/thread.rb
  19. +1 −1  kernel/bootstrap/thread18.rb
  20. +6 −6 kernel/bootstrap/thunk.rb
  21. +2 −2 kernel/bootstrap/time.rb
  22. +7 −7 kernel/bootstrap/type.rb
  23. +5 −5 kernel/bootstrap/variable_scope.rb
  24. +1 −1  kernel/bootstrap/vm.rb
  25. +3 −3 kernel/bootstrap/weakref.rb
  26. +4 −4 kernel/common/fiber.rb
  27. +3 −3 kernel/common/float.rb
  28. +1 −1  kernel/common/float18.rb
  29. +3 −3 kernel/common/kernel19.rb
  30. +1 −1  kernel/common/module.rb
  31. +1 −1  kernel/common/native_method.rb
  32. +1 −1  kernel/common/proc.rb
  33. +1 −1  kernel/common/symbol.rb
  34. +1 −1  kernel/common/time.rb
  35. +1 −1  kernel/common/time19.rb
  36. +1 −1  kernel/platform/ffi.rb
  37. +2 −2 kernel/platform/library.rb
  38. +27 −27 kernel/platform/pointer.rb
View
6 kernel/alpha.rb
@@ -160,7 +160,7 @@ def raise(cls, str, junk=nil)
#
def kind_of?(cls)
Rubinius.primitive :object_kind_of
- raise TypeError, 'kind_of? requires a Class or Module argument'
+ raise TypeError, "Kernel#kind_of? primitive failed"
end
# Hook method invoked when object is sent a message it cannot handle.
@@ -352,7 +352,7 @@ class Symbol
#
def to_s
Rubinius.primitive :symbol_to_s
- raise PrimitiveFailure, "Symbol#to_s primitive failed."
+ raise PrimitiveFailure, "Symbol#to_s primitive failed"
end
# For completeness, returns self.
@@ -382,7 +382,7 @@ class String
#++
def to_sym
Rubinius.primitive :symbol_lookup
- raise PrimitiveFailure, "Unable to symbolize: #{self.dump}"
+ raise PrimitiveFailure, "String#to_sym primitive failed: #{self.dump}"
end
# For completeness, returns self.
View
6 kernel/bootstrap/atomic.rb
@@ -16,21 +16,21 @@ def marshal_load(val)
def get
Rubinius.primitive :atomic_get
- raise PrimitiveFailure, "get failed"
+ raise PrimitiveFailure, "Rubinius::AtomicReference#get primitive failed"
end
alias_method :value, :get
def set(val)
Rubinius.primitive :atomic_set
- raise PrimitiveFailure, "set failed"
+ raise PrimitiveFailure, "Rubinius::AtomicReference#set primitive failed"
end
alias_method :value=, :set
def compare_and_set(old, new)
Rubinius.primitive :atomic_compare_and_set
- raise PrimitiveFailure, "compare_and_set failed"
+ raise PrimitiveFailure, "Rubinius::AtomicReference#compare_and_set primitive failed"
end
def get_and_set(new)
View
4 kernel/bootstrap/basicobject.rb
@@ -31,11 +31,11 @@ def !=(other)
#
def __send__(message, *args)
Rubinius.primitive :object_send
- raise ::PrimitiveFailure, "#__send__ primitive failed"
+ raise ::PrimitiveFailure, "BasicObject#__send__ primitive failed"
end
def __id__
Rubinius.primitive :object_id
- raise ::PrimitiveFailure, "#__id__ primitive failed"
+ raise ::PrimitiveFailure, "BasicObject#__id__ primitive failed"
end
end
View
2  kernel/bootstrap/block_environment.rb
@@ -25,7 +25,7 @@ def self.of_sender
class AsMethod < Executable
def self.new(block_env)
Rubinius.primitive :block_as_method_create
- raise PrimitiveFailure, "BlockEnvironment::AsMethod.new failed"
+ raise PrimitiveFailure, "BlockEnvironment::AsMethod.new primitive failed"
end
def arity
View
5 kernel/bootstrap/class.rb
@@ -3,12 +3,13 @@
class Class
def self.allocate
Rubinius.primitive :class_s_allocate
- raise PrimitiveFailure, "Unable to create a new Class"
+ raise PrimitiveFailure, "Class.allocate primitive failed"
end
def set_superclass(sup)
Rubinius.primitive :class_set_superclass
- raise TypeError, "superclass must be a Class (#{Rubinius::Type.object_class(sup)} given)"
+ kind = Rubinius::Type.object_class(sup)
+ raise TypeError, "Class.set_superclass: argument must be a Class (#{kind} given)"
end
private :set_superclass
View
4 kernel/bootstrap/compiled_code.rb
@@ -32,7 +32,7 @@ def dup
#
def self.of_sender
Rubinius.primitive :compiledcode_of_sender
- raise PrimitiveFailure, "CompiledCode.of_sender failed"
+ raise PrimitiveFailure, "CompiledCode.of_sender primitive failed"
end
# Returns the CompiledCode object for the currently executing Ruby
@@ -44,7 +44,7 @@ def self.of_sender
#
def self.current
Rubinius.primitive :compiledcode_current
- raise PrimitiveFailure, "CompiledCode.current failed"
+ raise PrimitiveFailure, "CompiledCode.current primitive failed"
end
end
View
4 kernel/bootstrap/configuration.rb
@@ -9,12 +9,12 @@ def initialize
def get_variable(name)
Rubinius.primitive :vm_get_config_item
- raise PrimitiveFailure, "Unable to get config variable"
+ raise PrimitiveFailure, "Rubinius::Configuration#get_variable primitive failed"
end
def get_section(section)
Rubinius.primitive :vm_get_config_section
- raise PrimitiveFailure, "Unable to get config section"
+ raise PrimitiveFailure, "Rubinius::Configuration#get_section primitive failed"
end
def section(section)
View
8 kernel/bootstrap/gc.rb
@@ -48,7 +48,7 @@ def garbage_collect
module ObjectSpace
def self.find_object(query, callable)
Rubinius.primitive :vm_find_object
- raise PrimitiveFailure, "vm_each_object failed"
+ raise PrimitiveFailure, "ObjectSpace#find_object primitive failed"
end
end
@@ -56,17 +56,17 @@ module Rubinius
module GC
def self.count
Rubinius.primitive :vm_gc_count
- raise PrimitiveFailure, "Failed to get GC count"
+ raise PrimitiveFailure, "Rubinius::GC.count primitive failed"
end
def self.time
Rubinius::primitive :vm_gc_time
- raise PrimitiveFailure, "Failed to get GC time"
+ raise PrimitiveFailure, "Rubinius::GC.time primitive failed"
end
def self.size
Rubinius::primitive :vm_gc_size
- raise PrimitiveFailure, "Failed to get GC size"
+ raise PrimitiveFailure, "Rubinius::GC.size primitive failed"
end
end
end
View
4 kernel/bootstrap/io.rb
@@ -62,12 +62,12 @@ def ensure_open
def read_primitive(number_of_bytes)
Rubinius.primitive :io_sysread
- raise PrimitiveFailure, "IO::sysread primitive failed!"
+ raise PrimitiveFailure, "IO::sysread primitive failed"
end
def write(str)
Rubinius.primitive :io_write
- raise PrimitiveFailure, "IO#write failed. Might not have passed a string."
+ raise PrimitiveFailure, "IO#write primitive failed"
end
def read_if_available(size)
View
2  kernel/bootstrap/kernel.rb
@@ -44,7 +44,7 @@ def inspect
def respond_to_all?(meth, include)
Rubinius.primitive :object_respond_to
- raise PrimitiveFailure, "Kernel#prim_respond_to? failed"
+ raise PrimitiveFailure, "Kernel#respond_to_all? primiive failed"
end
private :respond_to_all?
View
2  kernel/bootstrap/lookuptable.rb
@@ -74,7 +74,7 @@ def dup
def fetch(key, return_on_failure)
Rubinius.primitive :lookuptable_fetch
- raise PrimitiveFailure, "fetch failed"
+ raise PrimitiveFailure, "LookupTable#fetch primitive failed"
end
def key?(key)
View
6 kernel/bootstrap/proc.rb
@@ -7,17 +7,17 @@ def self.allocate
def self.__allocate__
Rubinius.primitive :proc_allocate
- raise PrimitiveFailure, "Proc#allocate failed"
+ raise PrimitiveFailure, "Proc#allocate primitive failed"
end
def call(*args)
Rubinius.primitive :proc_call
- raise PrimitiveFailure, "Proc#call failed"
+ raise PrimitiveFailure, "Proc#call primitive failed"
end
def call_on_object(*args)
Rubinius.primitive :proc_call_on_object
- raise PrimitiveFailure, "Proc#call_on_object failed"
+ raise PrimitiveFailure, "Proc#call_on_object primitive failed"
end
def lambda_style!
View
12 kernel/bootstrap/process.rb
@@ -3,31 +3,31 @@
module Process
def self.perform_fork
Rubinius.primitive :vm_fork
- raise PrimitiveFailure, "vm_fork primitive failed"
+ raise PrimitiveFailure, "Process.perform_fork primitive failed"
end
def self.perform_exec(file, args)
Rubinius.primitive :vm_exec
- raise PrimitiveFailure, "vm_exec primitive failed"
+ raise PrimitiveFailure, "Process.perform_exec primitive failed"
end
def self.replace(str)
Rubinius.primitive :vm_replace
- raise PrimitiveFailure, "vm_replace primitive failed"
+ raise PrimitiveFailure, "Process.replace primitive failed"
end
def self.wait_pid_prim(pid, no_hang)
Rubinius.primitive :vm_wait_pid
- raise PrimitiveFailure, "vm_wait_pid primitive failed"
+ raise PrimitiveFailure, "Process.wait_pid primitive failed"
end
def self.time
Rubinius.primitive :vm_time
- raise PrimitiveFailure, "vm_time primitive failed"
+ raise PrimitiveFailure, "Process.time primitive failed"
end
def self.cpu_times
Rubinius.primitive :vm_times
- raise PrimitiveFailure, "vm_times primitive failed"
+ raise PrimitiveFailure, "Process.cpu_times primitive failed"
end
end
View
11 kernel/bootstrap/regexp.rb
@@ -12,8 +12,7 @@ def self.allocate
def compile(pattern, opts)
Rubinius.primitive :regexp_initialize
- raise PrimitiveFailure,
- "Regexp.compile(#{pattern.inspect}, #{opts}) primitive failed"
+ raise PrimitiveFailure, "Regexp.compile(#{pattern.inspect}, #{opts}) primitive failed"
end
private :compile
@@ -42,7 +41,7 @@ def self.last_match(field=nil)
Rubinius.primitive :regexp_last_match
return last_match(Integer(field)) if field
- raise PrimitiveFailure, "Regexp#last_match failed"
+ raise PrimitiveFailure, "Regexp#last_match primitive failed"
end
def self.last_match=(match)
@@ -52,17 +51,17 @@ def self.last_match=(match)
raise TypeError, "Expected MatchData, got #{match.inspect}"
end
- raise PrimitiveFailure, "Regexp#set_last_match failed"
+ raise PrimitiveFailure, "Regexp#set_last_match primitive failed"
end
def self.propagate_last_match
Rubinius.primitive :regexp_propagate_last_match
- raise PrimitiveFailure, "Regexp#propagate_last_match failed"
+ raise PrimitiveFailure, "Regexp#propagate_last_match primitive failed"
end
def self.set_block_last_match
Rubinius.primitive :regexp_set_block_last_match
- raise PrimitiveFailure, "Regexp#set_block_last_match failed"
+ raise PrimitiveFailure, "Regexp#set_block_last_match primitive failed"
end
end
View
74 kernel/bootstrap/rubinius.rb
@@ -8,58 +8,58 @@ def self.watch_signal(sig, ignored)
def self.find_method(obj, name)
Rubinius.primitive :vm_find_method
- raise PrimitiveFailure, "Rubinius.find_method failed"
+ raise PrimitiveFailure, "Rubinius.find_method primitive failed"
end
def self.find_public_method(obj, name)
Rubinius.primitive :vm_find_public_method
- raise PrimitiveFailure, "Rubinius.find_public_method failed"
+ raise PrimitiveFailure, "Rubinius.find_public_method primitive failed"
end
def self.extended_modules(obj)
Rubinius.primitive :vm_extended_modules
- raise PrimitiveFailure, "Rubinius.extended_modules failed"
+ raise PrimitiveFailure, "Rubinius.extended_modules primitive failed"
end
def self.inc_global_serial
Rubinius.primitive :vm_inc_global_serial
- raise PrimitiveFailure, "Rubinius.vm_inc_global_serial failed"
+ raise PrimitiveFailure, "Rubinius.vm_inc_global_serial primitive failed"
end
def self.jit_block(be, show)
Rubinius.primitive :vm_jit_block
- raise PrimitiveFailure, "Rubinius.vm_jit_block failed"
+ raise PrimitiveFailure, "Rubinius.vm_jit_block primitive failed"
end
def self.deoptimize_inliners(exec)
Rubinius.primitive :vm_deoptimize_inliners
- raise PrimitiveFailure, "Rubinius.vm_deoptimize_inliners failed"
+ raise PrimitiveFailure, "Rubinius.vm_deoptimize_inliners primitive failed"
end
# Deoptimize all methods in the system.
def self.deoptimize_all(disable)
Rubinius.primitive :vm_deoptimize_all
- raise PrimitiveFailure, "Rubinius.vm_deoptimize_all failed"
+ raise PrimitiveFailure, "Rubinius.vm_deoptimize_all primitive failed"
end
def self.raise_exception(exc)
Rubinius.primitive :vm_raise_exception
- raise PrimitiveFailure, "Rubinius.vm_raise_exception failed"
+ raise PrimitiveFailure, "Rubinius.vm_raise_exception primitive failed"
end
def self.memory_size(obj)
Rubinius.primitive :vm_memory_size
- raise PrimitiveFailure, "Rubinius.vm_memory_size failed"
+ raise PrimitiveFailure, "Rubinius.vm_memory_size primitive failed"
end
def self.throw(dest, obj)
Rubinius.primitive :vm_throw
- raise PrimitiveFailure, "Rubinius.throw failed"
+ raise PrimitiveFailure, "Rubinius.throw primitive failed"
end
def self.catch(dest, obj)
Rubinius.primitive :vm_catch
- raise PrimitiveFailure, "Rubinius.catch failed"
+ raise PrimitiveFailure, "Rubinius.catch primitive failed"
end
def self.method_missing_reason
@@ -69,7 +69,7 @@ def self.method_missing_reason
def self.mri_backtrace(skip)
Rubinius.primitive :vm_mri_backtrace
- raise PrimitiveFailure, "Rubinius.mri_backtrace failed"
+ raise PrimitiveFailure, "Rubinius.mri_backtrace primitive failed"
end
def self.add_method(name, executable, mod, vis)
@@ -91,52 +91,52 @@ def self.set_class(obj, cls)
def self.kcode=(str)
Rubinius.primitive :vm_set_kcode
- raise PrimitiveFailure, "Rubinius.kcode= failed"
+ raise PrimitiveFailure, "Rubinius.kcode= primitive failed"
end
def self.kcode
Rubinius.primitive :vm_get_kcode
- raise PrimitiveFailure, "Rubinius.kcode failed"
+ raise PrimitiveFailure, "Rubinius.kcode primitive failed"
end
def self.get_user_home(name)
Rubinius.primitive :vm_get_user_home
- raise PrimitiveFailure, "Rubinius.get_user_home failed"
+ raise PrimitiveFailure, "Rubinius.get_user_home primitive failed"
end
def self.agent_start
Rubinius.primitive :vm_agent_start
- raise PrimitiveFailure, "Rubinius.agent_start failed"
+ raise PrimitiveFailure, "Rubinius.agent_start primitive failed"
end
def self.agent_loopback
Rubinius.primitive :vm_agent_loopback
- raise PrimitiveFailure, "Rubinius.agent_loopback failed"
+ raise PrimitiveFailure, "Rubinius.agent_loopback primitive failed"
end
def self.lock(obj)
Rubinius.primitive :vm_object_lock
- raise PrimitiveFailure, "Rubinius.lock failed"
+ raise PrimitiveFailure, "Rubinius.lock primitive failed"
end
def self.lock_timed(obj, duration)
Rubinius.primitive :vm_object_lock_timed
- raise PrimitiveFailure, "Rubinius.lock failed"
+ raise PrimitiveFailure, "Rubinius.lock primitive failed"
end
def self.try_lock(obj)
Rubinius.primitive :vm_object_trylock
- raise PrimitiveFailure, "Rubinius.try_lock failed"
+ raise PrimitiveFailure, "Rubinius.try_lock primitive failed"
end
def self.locked?(obj)
Rubinius.primitive :vm_object_locked_p
- raise PrimitiveFailure, "Rubinius.locked? failed"
+ raise PrimitiveFailure, "Rubinius.locked? primitive failed"
end
def self.unlock(obj)
Rubinius.primitive :vm_object_unlock
- raise PrimitiveFailure, "Rubinius.unlock failed"
+ raise PrimitiveFailure, "Rubinius.unlock primitive failed"
end
def self.synchronize(obj)
@@ -150,47 +150,47 @@ def self.synchronize(obj)
def self.memory_barrier
Rubinius.primitive :vm_memory_barrier
- raise PrimitiveFailure, "Rubinius.memory_barrier failed"
+ raise PrimitiveFailure, "Rubinius.memory_barrier primitive failed"
end
def self.ruby18?
Rubinius.primitive :vm_ruby18_p
- raise PrimitiveFailure, "Rubinius.ruby18? failed"
+ raise PrimitiveFailure, "Rubinius.ruby18? primitive failed"
end
def self.ruby19?
Rubinius.primitive :vm_ruby19_p
- raise PrimitiveFailure, "Rubinius.ruby19? failed"
+ raise PrimitiveFailure, "Rubinius.ruby19? primitive failed"
end
def self.ruby20?
Rubinius.primitive :vm_ruby20_p
- raise PrimitiveFailure, "Rubinius.ruby20? failed"
+ raise PrimitiveFailure, "Rubinius.ruby20? primitive failed"
end
def self.windows?
Rubinius.primitive :vm_windows_p
- raise PrimitiveFailure, "Rubinius.windows? failed"
+ raise PrimitiveFailure, "Rubinius.windows? primitive failed"
end
def self.darwin?
Rubinius.primitive :vm_darwin_p
- raise PrimitiveFailure, "Rubinius.darwin? failed"
+ raise PrimitiveFailure, "Rubinius.darwin? primitive failed"
end
def self.bsd?
Rubinius.primitive :vm_bsd_p
- raise PrimitiveFailure, "Rubinius.bsd? failed"
+ raise PrimitiveFailure, "Rubinius.bsd? primitive failed"
end
def self.linux?
Rubinius.primitive :vm_linux_p
- raise PrimitiveFailure, "Rubinius.linux? failed"
+ raise PrimitiveFailure, "Rubinius.linux? primitive failed"
end
def self.thread_state
Rubinius.primitive :vm_thread_state
- raise PrimitiveFailure, "Rubinius.thread_state failed"
+ raise PrimitiveFailure, "Rubinius.thread_state primitive failed"
end
# Used to invoke a CompiledCode +cm+ as a script body.
@@ -198,13 +198,13 @@ def self.thread_state
# (because why JIT a script you only run once).
def self.run_script(cm)
Rubinius.primitive :vm_run_script
- raise PrimitiveFailure, "Rubinius.run_script failed"
+ raise PrimitiveFailure, "Rubinius.run_script primitive failed"
end
module Tooling
def self.raw_load(str)
Rubinius.primitive :vm_load_tool
- raise PrimitiveFailure, "Tooling.raw_load failed"
+ raise PrimitiveFailure, "Tooling.raw_load primitive failed"
end
def self.load(str)
@@ -218,22 +218,22 @@ def self.load(str)
def self.available?
Rubinius.primitive :vm_tooling_available_p
- raise PrimitiveFailure, "Tooling.available? failed"
+ raise PrimitiveFailure, "Tooling.available? primitive failed"
end
def self.active?
Rubinius.primitive :vm_tooling_active_p
- raise PrimitiveFailure, "Tooling.active? failed"
+ raise PrimitiveFailure, "Tooling.active? primitive failed"
end
def self.enable
Rubinius.primitive :vm_tooling_enable
- raise PrimitiveFailure, "Tooling.enable failed"
+ raise PrimitiveFailure, "Tooling.enable primitive failed"
end
def self.disable
Rubinius.primitive :vm_tooling_disable
- raise PrimitiveFailure, "Tooling.disable failed"
+ raise PrimitiveFailure, "Tooling.disable primitive failed"
end
end
end
View
14 kernel/bootstrap/string.rb
@@ -78,24 +78,24 @@ def substring(start, count)
def find_string(pattern, start)
Rubinius.primitive :string_index
- raise PrimitiveFailure, "String#find_string failed"
+ raise PrimitiveFailure, "String#find_string primitive failed"
end
def find_string_reverse(pattern, start)
Rubinius.primitive :string_rindex
- raise PrimitiveFailure, "String#find_string_reverse failed"
+ raise PrimitiveFailure, "String#find_string_reverse primitive failed"
end
def ==(other)
Rubinius.primitive :string_equal
- raise PrimitiveFailure, "String#== failed"
+ raise PrimitiveFailure, "String#== primitive failed"
end
def secure_compare(other)
Rubinius.primitive :string_secure_compare
if other.kind_of?(String)
- raise PrimitiveFailure, "String#secure_compare failed"
+ raise PrimitiveFailure, "String#secure_compare primitive failed"
else
secure_compare StringValue(other)
end
@@ -103,7 +103,7 @@ def secure_compare(other)
def find_character(offset)
Rubinius.primitive :string_find_character
- raise PrimitiveFailure, "String#find_character failed"
+ raise PrimitiveFailure, "String#find_character primitive failed"
end
def size
@@ -126,11 +126,11 @@ def num_bytes=(bytes)
# In time, the JIT should be able to handle this as a ruby method.
def transform(tbl, respect_kcode)
Rubinius.primitive :string_transform
- raise PrimitiveFailure, "String#transform failed"
+ raise PrimitiveFailure, "String#transform primitive failed"
end
def resize_capacity(count)
Rubinius.primitive :string_resize_capacity
- raise PrimitiveFailure, "String#resize_capacity failed"
+ raise PrimitiveFailure, "String#resize_capacity primitive failed"
end
end
View
8 kernel/bootstrap/symbol.rb
@@ -8,21 +8,21 @@ def self.===(obj)
def index
Rubinius.primitive :symbol_index
- raise PrimitiveFailure, "Symbol#index failed."
+ raise PrimitiveFailure, "Symbol#index primitive failed."
end
def is_ivar?
Rubinius.primitive :symbol_is_ivar
- raise PrimitiveFailure, "Symbol#is_ivar failed."
+ raise PrimitiveFailure, "Symbol#is_ivar primitive failed."
end
def is_cvar?
Rubinius.primitive :symbol_is_cvar
- raise PrimitiveFailure, "Symbol#is_cvar failed."
+ raise PrimitiveFailure, "Symbol#is_cvar primitive failed."
end
def is_constant?
Rubinius.primitive :symbol_is_constant
- raise PrimitiveFailure, "Symbol#is_constant failed."
+ raise PrimitiveFailure, "Symbol#is_constant primitive failed."
end
end
View
10 kernel/bootstrap/thread.rb
@@ -38,22 +38,22 @@ def wakeup
def priority
Rubinius.primitive :thread_priority
- Kernel.raise ThreadError, "Unable to get Thread priority"
+ Kernel.raise ThreadError, "Thread#priority primitive failed"
end
def priority=(val)
Rubinius.primitive :thread_set_priority
- Kernel.raise ThreadError, "Unable to set Thread priority"
+ Kernel.raise ThreadError, "Thread#priority= primitive failed"
end
def __context__
Rubinius.primitive :thread_context
- Kernel.raise PrimitiveFailure, "Thread#__context__ failed"
+ Kernel.raise PrimitiveFailure, "Thread#__context__ primitive failed"
end
def native_join
Rubinius.primitive :thread_join
- Kernel.raise PrimitiveFailure, "Thread#native_join failed"
+ Kernel.raise PrimitiveFailure, "Thread#native_join primitive failed"
end
def mri_backtrace
@@ -63,7 +63,7 @@ def mri_backtrace
def unlock_locks
Rubinius.primitive :thread_unlock_locks
- Kernel.raise PrimitiveFailure, "Thread#unlock_locks failed"
+ Kernel.raise PrimitiveFailure, "Thread#unlock_locks primitive failed"
end
class Die < Exception; end # HACK
View
2  kernel/bootstrap/thread18.rb
@@ -3,7 +3,7 @@
class Thread
def self.set_critical(obj)
Rubinius.primitive :thread_set_critical
- Kernel.raise PrimitiveFailure, "Thread.set_critical failed"
+ Kernel.raise PrimitiveFailure, "Thread.set_critical primitive failed"
end
def self.start(*args)
View
12 kernel/bootstrap/thunk.rb
@@ -4,19 +4,19 @@ module Rubinius
class Thunk
def self.new(value)
Rubinius.primitive :thunk_create
- raise PrimitiveFailure, "Thunk.new failed"
+ raise PrimitiveFailure, "Thunk.new primitive failed"
end
end
class CallUnit
def self.constant_value(obj)
Rubinius.primitive :callunit_constant_value
- raise PrimitiveFailure, "CallUnit.constant_value failed"
+ raise PrimitiveFailure, "CallUnit.constant_value primitive failed"
end
def self.for_method_parts(mod, exec, name)
Rubinius.primitive :callunit_for_method_parts
- raise PrimitiveFailure, "CallUnit.for_method_parts failed"
+ raise PrimitiveFailure, "CallUnit.for_method_parts primitive failed"
end
def self.for_method(mo)
@@ -25,19 +25,19 @@ def self.for_method(mo)
def self.test(cond, c_then, c_else)
Rubinius.primitive :callunit_test
- raise PrimitiveFailure, "CallUnit.test failed"
+ raise PrimitiveFailure, "CallUnit.test primitive failed"
end
def self.test_kind_of(mod, which)
Rubinius.primitive :callunit_kind_of
- raise PrimitiveFailure, "CallUnit.test_kind_of failed"
+ raise PrimitiveFailure, "CallUnit.test_kind_of primitive failed"
end
end
class CallUnitAdapter
def self.new(unit)
Rubinius.primitive :callunitadapter_create
- raise PrimitiveFailure, "CallUnitAdapter.new failed"
+ raise PrimitiveFailure, "CallUnitAdapter.new primitive failed"
end
end
View
4 kernel/bootstrap/time.rb
@@ -22,12 +22,12 @@ def dup
def seconds
Rubinius.primitive :time_seconds
- raise PrimitiveFailure, "Time#second failed"
+ raise PrimitiveFailure, "Time#second primitive failed"
end
def usec
Rubinius.primitive :time_useconds
- raise PrimitiveFailure, "Time#usec failed"
+ raise PrimitiveFailure, "Time#usec primitive failed"
end
def to_a
View
14 kernel/bootstrap/type.rb
@@ -10,12 +10,12 @@ module Type
# overrides.
def self.object_kind_of?(obj, cls)
Rubinius.primitive :vm_object_kind_of
- raise PrimitiveFailure, "Rubinius::Type.object_kind_of? failed"
+ raise PrimitiveFailure, "Rubinius::Type.object_kind_of? primitive failed"
end
def self.object_class(obj)
Rubinius.primitive :vm_object_class
- raise PrimitiveFailure, "Rubinius::Type.object_class failed"
+ raise PrimitiveFailure, "Rubinius::Type.object_class primitive failed"
end
def self.object_singleton_class(obj)
@@ -25,22 +25,22 @@ def self.object_singleton_class(obj)
def self.singleton_class_object(mod)
Rubinius.primitive :vm_singleton_class_object
- raise PrimitiveFailure, "Rubinius::Type.singleton_class_object failed"
+ raise PrimitiveFailure, "Rubinius::Type.singleton_class_object primitive failed"
end
def self.object_respond_to?(obj, name)
Rubinius.primitive :vm_object_respond_to
- raise PrimitiveFailure, "Rubinius::Type.object_respond_to? failed"
+ raise PrimitiveFailure, "Rubinius::Type.object_respond_to? primitive failed"
end
def self.object_equal(a, b)
Rubinius.primitive :vm_object_equal
- raise PrimitiveFailure, "Rubinius::Type.object_equal failed"
+ raise PrimitiveFailure, "Rubinius::Type.object_equal primitive failed"
end
def self.module_name(mod)
Rubinius.primitive :vm_get_module_name
- raise PrimitiveFailure, "Rubinius::Type.module_name failed"
+ raise PrimitiveFailure, "Rubinius::Type.module_name primitive failed"
end
def self.module_inspect(mod)
@@ -66,7 +66,7 @@ def self.module_inspect(mod)
def self.set_module_name(mod, name, under)
Rubinius.primitive :vm_set_module_name
- raise PrimitiveFailure, "Rubinius::Type.set_module_name failed"
+ raise PrimitiveFailure, "Rubinius::Type.set_module_name primitive failed"
end
end
end
View
10 kernel/bootstrap/variable_scope.rb
@@ -4,27 +4,27 @@ module Rubinius
class VariableScope
def self.of_sender
Rubinius.primitive :variable_scope_of_sender
- raise PrimitiveFailure, "Unable to get VariableScope of sender"
+ raise PrimitiveFailure, "Rubinius::VariableScope.of_sender primitive failed"
end
def self.current
Rubinius.primitive :variable_scope_current
- raise PrimitiveFailure, "Unable to get current VariableScope"
+ raise PrimitiveFailure, "Rubinius::VariableScope.current primitive failed"
end
def self.synthesize(method, module_, parent, self_, block, locals)
Rubinius.primitive :variable_scope_synthesize
- raise PrimitiveFailure, "Unable to create a new VariableScope object"
+ raise PrimitiveFailure, "Rubinius::VariableScope.synthesize primitive failed"
end
def set_local(slot, obj)
Rubinius.primitive :variable_scope_set_local
- raise PrimitiveFailure, "Unable to set VariableScope locals"
+ raise PrimitiveFailure, "Rubinius::VariableScope#set_local primitive failed"
end
def locals
Rubinius.primitive :variable_scope_locals
- raise PrimitiveFailure, "Unable to get VariableScope locals"
+ raise PrimitiveFailure, "Rubinius::VariableScope#locals primitive failed"
end
# To handle Module#private, protected
View
2  kernel/bootstrap/vm.rb
@@ -22,7 +22,7 @@ def self.stats
def self.dump_heap(path)
Rubinius.primitive :vm_dump_heap
- raise PrimitiveFailure, "Rubinius::VM.dump_heap failed"
+ raise PrimitiveFailure, "Rubinius::VM.dump_heap primitive failed"
end
def self.__jit_info__
View
6 kernel/bootstrap/weakref.rb
@@ -6,17 +6,17 @@ class RefError < ::RuntimeError; end
def self.new
Rubinius.primitive :weakref_new
- raise PrimitiveFailure, "WeakRef.new failed"
+ raise PrimitiveFailure, "WeakRef.new primitive failed"
end
def __setobj__(obj)
Rubinius.primitive :weakref_set_object
- ::Kernel.raise PrimitiveFailure, "WeakRef#__setobj__ failed"
+ ::Kernel.raise PrimitiveFailure, "WeakRef#__setobj__ primitive failed"
end
def __object__
Rubinius.primitive :weakref_object
- ::Kernel.raise PrimitiveFailure, "WeakRef#__object__ failed"
+ ::Kernel.raise PrimitiveFailure, "WeakRef#__object__ primitive failed"
end
def __getobj__
View
8 kernel/common/fiber.rb
@@ -17,22 +17,22 @@ def self.new(size=0, &block)
def self.current
Rubinius.primitive :fiber_s_current
- raise PrimitiveFailure, "fiber_s_current failed"
+ raise PrimitiveFailure, "Rubinius::Fiber.current failed"
end
def self.yield(*args)
Rubinius.primitive :fiber_s_yield
- raise PrimitiveFailure, "fiber_s_yield failed"
+ raise PrimitiveFailure, "Rubinius::Fiber.yield failed"
end
def resume(*args)
Rubinius.primitive :fiber_resume
- raise PrimitiveFailure, "fiber_resume failed"
+ raise PrimitiveFailure, "Rubinius::Fiber#resume failed"
end
def transfer(*args)
Rubinius.primitive :fiber_transfer
- raise PrimitiveFailure, "fiber_transfer failed"
+ raise PrimitiveFailure, "Rubinius::Fiber#transfer failed"
end
def alive?
View
6 kernel/common/float.rb
@@ -155,18 +155,18 @@ def to_s
def to_s_minimal
Rubinius.primitive :float_to_s_minimal
- raise PrimitiveFailure, "minimally formatted string exceeds character buffer size"
+ raise PrimitiveFailure, "Float#to_s_minimal primitive failed: output exceeds buffer size"
end
def to_s_formatted(fmt)
Rubinius.primitive :float_to_s_formatted
- raise PrimitiveFailure, "String#to_s_formatted output exceeds buffer size"
+ raise PrimitiveFailure, "Float#to_s_formatted primitive failed: output exceeds buffer size"
end
private :to_s_formatted
def to_packed(size)
Rubinius.primitive :float_to_packed
- raise PrimitiveFailure, "float_to_packed failed"
+ raise PrimitiveFailure, "Float#to_packed primitive failed"
end
def ceil
View
2  kernel/common/float18.rb
@@ -9,6 +9,6 @@ def **(other)
def round
Rubinius.primitive :float_round
- raise PrimitiveFailure, "float_round failed"
+ raise PrimitiveFailure, "Float#round primitive failed"
end
end
View
6 kernel/common/kernel19.rb
@@ -124,12 +124,12 @@ def to_enum(method=:each, *args)
#
def send(message, *args)
Rubinius.primitive :object_send
- raise PrimitiveFailure, "#send primitive failed"
+ raise PrimitiveFailure, "Kernel#send primitive failed"
end
def public_send(message, *args)
Rubinius.primitive :object_public_send
- raise PrimitiveFailure, "#public_send primitive failed"
+ raise PrimitiveFailure, "Kernel#public_send primitive failed"
end
# In 1.8, :object_id is an alias to :__id__ because both methods are defined
@@ -137,7 +137,7 @@ def public_send(message, *args)
#
def object_id
Rubinius.primitive :object_id
- raise PrimitiveFailure, "#object_id primitive failed"
+ raise PrimitiveFailure, "Kernel#object_id primitive failed"
end
def proc(&prc)
View
2  kernel/common/module.rb
@@ -76,7 +76,7 @@ def remove_class_variable(name)
def __class_variables__
Rubinius.primitive :module_class_variables
- raise PrimitiveFailure, "module_class_variables failed"
+ raise PrimitiveFailure, "Module#__class_variables__ primitive failed"
end
def class_variables
View
2  kernel/common/native_method.rb
@@ -54,7 +54,7 @@ def self.load_extension(library, extension_name)
#
def self.load_entry_point(library, name, ptr)
Rubinius.primitive :nativemethod_load_extension_entry_point
- raise PrimitiveFailure, "Unable to load #{library}"
+ raise PrimitiveFailure, "Rubinius::NativeMethod3load_entry_point primitive failed: #{library}"
end
def lines
View
2  kernel/common/proc.rb
@@ -6,7 +6,7 @@ def self.__from_block__(env)
Rubinius.primitive :proc_from_env
if Rubinius::Type.object_kind_of? env, Rubinius::BlockEnvironment
- raise PrimitiveFailure, "Unable to create Proc from BlockEnvironment"
+ raise PrimitiveFailure, "Proc.__from_block__ primitive failed to create Proc from BlockEnvironment"
else
begin
env.to_proc
View
2  kernel/common/symbol.rb
@@ -7,7 +7,7 @@ class Symbol
def self.all_symbols
Rubinius.primitive :symbol_all_symbols
- raise PrimitiveFailure, "Symbol.all_symbols failed."
+ raise PrimitiveFailure, "Symbol.all_symbols primitive failed."
end
# Returns a Proc object which respond to the given method by sym.
View
2  kernel/common/time.rb
@@ -193,7 +193,7 @@ def gmt?
def gmt_offset
Rubinius.primitive :time_utc_offset
- raise PrimitiveFailure, "Time#gmt_offset failed"
+ raise PrimitiveFailure, "Time#gmt_offset primitive failed"
end
def gmtime
View
2  kernel/common/time19.rb
@@ -84,7 +84,7 @@ def inspect
def nsec
Rubinius.primitive :time_nseconds
- raise PrimitiveFailure, "Time#nsec failed"
+ raise PrimitiveFailure, "Time#nsec primitive failed"
end
alias_method :tv_nsec, :nsec
View
2  kernel/platform/ffi.rb
@@ -52,7 +52,7 @@ def type_size(type)
return type_size(TYPE_PTR)
end
- raise PrimitiveFailure, "Unable to find type size for #{type}"
+ raise PrimitiveFailure, "FFI.type_size primitive failed: #{type}"
end
def size_to_type(size)
View
4 kernel/platform/library.rb
@@ -8,12 +8,12 @@ class Rubinius::NativeFunction
module FFI
def self.generate_function(ptr, name, args, ret)
Rubinius.primitive :nativefunction_generate
- raise PrimitiveFailure, "FFI.generate_function failed"
+ raise PrimitiveFailure, "FFI.generate_function primitive failed"
end
def self.generate_trampoline(obj, name, args, ret)
Rubinius.primitive :nativefunction_generate_tramp
- raise PrimitiveFailure, "FFI.generate_function_tramp failed"
+ raise PrimitiveFailure, "FFI.generate_function_tramp primitive failed"
end
module Library
View
54 kernel/platform/pointer.rb
@@ -52,7 +52,7 @@ def inspect
# Return the address pointed to as an Integer
def address
Rubinius.primitive :pointer_address
- raise PrimitiveFailure, "Unable to find address"
+ raise PrimitiveFailure, "FFI::Pointer#address primitive failed"
end
alias_method :to_i, :address
@@ -60,7 +60,7 @@ def address
# Set the address pointed to from an Integer
def address=(address)
Rubinius.primitive :pointer_set_address
- raise PrimitiveFailure, "MemoryPointer#address= primitive failed"
+ raise PrimitiveFailure, "FFI::Pointer#address= primitive failed"
end
def null?
@@ -70,7 +70,7 @@ def null?
# Add +value+ to the address pointed to and return a new Pointer
def +(value)
Rubinius.primitive :pointer_add
- raise PrimitiveFailure, "Unable to add"
+ raise PrimitiveFailure, "FFI::Pointer#+ primitive failed"
end
# Indicates if +self+ and +other+ point to the same address
@@ -81,21 +81,21 @@ def ==(other)
def network_order(start, size)
Rubinius.primitive :pointer_network_order
- raise PrimitiveFailure, "Unable to convert to network order"
+ raise PrimitiveFailure, "FFI::Pointer#network_order primitive failed"
end
# Read +len+ bytes from the memory pointed to and return them as
# a String
def read_string_length(len)
Rubinius.primitive :pointer_read_string
- raise PrimitiveFailure, "Unable to read string"
+ raise PrimitiveFailure, "FFI::Pointer#read_string_length primitive failed"
end
# Read bytes from the memory pointed to until a NULL is seen, return
# the bytes as a String
def read_string_to_null
Rubinius.primitive :pointer_read_string_to_null
- raise PrimitiveFailure, "Unable to read string to null"
+ raise PrimitiveFailure, "FFI::Pointer#read_string_to_null primitive failed"
end
# Read bytes as a String from the memory pointed to
@@ -116,7 +116,7 @@ def get_bytes(offset, length)
# write up to +len+ bytes.
def write_string_length(str, len)
Rubinius.primitive :pointer_write_string
- raise PrimitiveFailure, "Unable to write string"
+ raise PrimitiveFailure, "FFI::Pointer#write_string_length primitive failed"
end
# Write a String +str+ as bytes to the memory pointed to.
@@ -159,13 +159,13 @@ def write_array_of_type(type, writer, ary)
# Read bytes from +offset+ from the memory pointed to as type +type+
def get_at_offset(offset, type)
Rubinius.primitive :pointer_get_at_offset
- raise PrimitiveFailure, "get_field failed"
+ raise PrimitiveFailure, "FFI::Pointer#get_at_offset primitive failed"
end
# Write +val+ as type +type+ to bytes from +offset+
def set_at_offset(offset, type, val)
Rubinius.primitive :pointer_set_at_offset
- raise PrimitiveFailure, "set_field failed"
+ raise PrimitiveFailure, "FFI::Pointer#set_at_offset primitive failed"
end
# Number of bytes taken up by a pointer.
@@ -176,82 +176,82 @@ def self.size
# Primitive methods
def primitive_read_char(signed)
Rubinius.primitive :pointer_read_char
- raise PrimitiveFailure, "Unable to read char"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_read_char primitive failed"
end
def primitive_write_char(obj)
Rubinius.primitive :pointer_write_char
- raise PrimitiveFailure, "Unable to write char"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_write_char primitive failed"
end
def primitive_read_short(signed)
Rubinius.primitive :pointer_read_short
- raise PrimitiveFailure, "Unable to read short"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_read_short primitive failed"
end
def primitive_write_short(obj)
Rubinius.primitive :pointer_write_short
- raise PrimitiveFailure, "Unable to write short"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_write_short primitive failed"
end
def primitive_read_int(signed)
Rubinius.primitive :pointer_read_int
- raise PrimitiveFailure, "Unable to read int"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_read_int primitive failed"
end
def primitive_write_int(obj)
Rubinius.primitive :pointer_write_int
- raise PrimitiveFailure, "Unable to write int"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_write_int primitive failed"
end
def primitive_read_long(signed)
Rubinius.primitive :pointer_read_long
- raise PrimitiveFailure, "Unable to read long"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_read_long primitive failed"
end
def primitive_write_long(obj)
Rubinius.primitive :pointer_write_long
- raise PrimitiveFailure, "Unable to write long"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_write_long primitive failed"
end
def primitive_read_long_long(signed)
Rubinius.primitive :pointer_read_long_long
- raise PrimitiveFailure, "Unable to read long"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_read_long_long primitive failed"
end
def primitive_write_long_long(obj)
Rubinius.primitive :pointer_write_long_long
- raise PrimitiveFailure, "Unable to write long_long"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_write_long_long primitive failed"
end
def primitive_read_float
Rubinius.primitive :pointer_read_float
- raise PrimitiveFailure, "Unable to read float"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_read_float primitive failed"
end
def primitive_write_float(obj)
Rubinius.primitive :pointer_write_float
- raise PrimitiveFailure, "Unable to write float"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_write_float primitive failed"
end
def primitive_read_double
Rubinius.primitive :pointer_read_double
- raise PrimitiveFailure, "Unable to read double"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_read_double primitive failed"
end
def primitive_write_double(obj)
Rubinius.primitive :pointer_write_double
- raise PrimitiveFailure, "Unable to write double"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_write_double primitive failed"
end
def primitive_read_pointer
Rubinius.primitive :pointer_read_pointer
- raise PrimitiveFailure, "Unable to read pointer"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_read_pointer primitive failed"
end
def primitive_write_pointer(obj)
Rubinius.primitive :pointer_write_pointer
- raise PrimitiveFailure, "Unable to write pointer"
+ raise PrimitiveFailure, "FFI::Pointer#primitive_write_pointer primitive failed"
end
NULL = Pointer.new(0x0)
@@ -318,7 +318,7 @@ def self.new(type, count=nil, clear=true)
def self.malloc(total)
Rubinius.primitive :pointer_malloc
- raise PrimitiveFailure, "Pointer.malloc failed"
+ raise PrimitiveFailure, "FFI::MemoryPointer.malloc primitive failed"
end
def self.from_string(str)
@@ -377,7 +377,7 @@ def free
# free() on it's address when it is garbage collected.
def autorelease=(val)
Rubinius.primitive :pointer_set_autorelease
- raise PrimitiveFailure, "Unable to change autorelease"
+ raise PrimitiveFailure, "FFI::MemoryPointer#autorelease= primitive failed"
end
end
Please sign in to comment.
Something went wrong with that request. Please try again.