Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: jruby/jruby
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: fce94b535c0b
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 8a86f38ea106
Choose a head ref
  • 2 commits
  • 4 files changed
  • 1 contributor

Commits on Dec 15, 2016

  1. Copy the full SHA
    2015a71 View commit details
  2. [Truffle] Cleanup rubinius.rb.

    eregon committed Dec 15, 2016
    Copy the full SHA
    8a86f38 View commit details
Showing with 8 additions and 63 deletions.
  1. +2 −2 truffle/src/main/ruby/core/enumerator.rb
  2. +5 −26 truffle/src/main/ruby/core/kernel.rb
  3. +0 −3 truffle/src/main/ruby/core/process.rb
  4. +1 −32 truffle/src/main/ruby/core/rubinius.rb
4 changes: 2 additions & 2 deletions truffle/src/main/ruby/core/enumerator.rb
Original file line number Diff line number Diff line change
@@ -515,10 +515,10 @@ def rewind

def reset
@done = false
@fiber = Rubinius::Fiber.new(0) do
@fiber = Fiber.new do
obj = @object
@result = obj.each do |*val|
Rubinius::Fiber.yield *val
Fiber.yield *val
end
@done = true
end
31 changes: 5 additions & 26 deletions truffle/src/main/ruby/core/kernel.rb
Original file line number Diff line number Diff line change
@@ -552,37 +552,16 @@ def system(*args)

def trace_var(name, cmd = nil, &block)
if !cmd && !block
raise(
ArgumentError,
'The 2nd argument should be a Proc/String, alternatively use a block'
)
raise ArgumentError,
"The 2nd argument should be a Proc/String, alternatively use a block"
end

# We have to use a custom proc since set_hook passes in both the variable
# name and value.
set = proc do |_, value|
if cmd.is_a?(String)
eval(cmd)

# In MRI if one passes both a proc in `cmd` and a block the latter will
# be ignored.
elsif cmd.is_a?(Proc)
cmd.call(value)

elsif block
block.call(value)
end
end

Rubinius::Globals.set_hook(name, :[], set)
# Truffle: not yet implemented
end
module_function :trace_var

# In MRI one can specify a 2nd argument to remove a specific tracer.
# Rubinius::Globals however only supports one hook per variable, hence the
# 2nd dummy argument.
def untrace_var(name, *args)
Rubinius::Globals.remove_hook(name)
def untrace_var(name, cmd)
# Truffle: not yet implemented
end
module_function :untrace_var

3 changes: 0 additions & 3 deletions truffle/src/main/ruby/core/process.rb
Original file line number Diff line number Diff line change
@@ -541,9 +541,6 @@ class << self
alias_method :waitpid2, :wait2
end

Rubinius::Globals.read_only :$?
Rubinius::Globals.set_hook(:$?) { Thread.current[:$?] }

def self.daemon(stay_in_dir=false, keep_stdio_open=false)
# Do not run at_exit handlers in the parent
exit!(0) if fork
33 changes: 1 addition & 32 deletions truffle/src/main/ruby/core/rubinius.rb
Original file line number Diff line number Diff line change
@@ -55,20 +55,6 @@ def self.mathn_loaded?
false
end

#def self.asm
# No-op.
#end

class Fiber < ::Fiber

ENABLED = true

def initialize(size, &block)
super(&block)
end

end

module FFI
class DynamicLibrary
end
@@ -77,24 +63,9 @@ class DynamicLibrary
# jnr-posix hard codes this value
PATH_MAX = 1024

# Rubinius has a method for modifying attributes on global variables. We handle that internally in JRuby+Truffle.
# The shim API here is just to allow Rubinius code to run unmodified.
class Globals
def self.read_only(var)
# No-op.
end

def self.set_hook(var)
# No-op.
end
end

class Backtrace
end

def self.watch_signal(sig, ignored)
Truffle.primitive :vm_watch_signal
raise PrimitiveFailure, "Rubinius.vm_watch_signal primitive failed" # Truffle: simplified failure
raise PrimitiveFailure, "Rubinius.vm_watch_signal primitive failed"
end

def self.extended_modules(obj)
@@ -139,7 +110,6 @@ def self.synchronize(object, &block)
end

module Metrics

def self.data
{
:'gc.young.count' => 0,
@@ -159,7 +129,6 @@ def self.data
:'memory.code.bytes' => 0
}
end

end
end