Skip to content
Permalink
Browse files
Merge branch 'master' into mcjit
  • Loading branch information
brixen committed Dec 28, 2015
2 parents c04d794 + 5e6fe27 commit 15a805f278e40e3d076a3ca2b70cdafef2106c58
Show file tree
Hide file tree
Showing 6 changed files with 203 additions and 185 deletions.
@@ -1365,28 +1365,38 @@ def sample(count=undefined, options=undefined)
else
if size / count > 3
abandon = false
spin = 0

result = Array.new count
i = 1

result[0] = rng.rand(size)
while i < count
k = rng.rand(size)
j = 0

while j < i
while k == result[j]
spin += 1
if spin > 100
spin = false
spin_count = 0

while true
j = 0
while j < i
if k == result[j]
spin = true
break
end

j += 1
end

if spin
if (spin_count += 1) > 100
abandon = true
break
end

k = rng.rand(size)
else
break
end
break if abandon

j += 1
end

break if abandon
@@ -57,7 +57,7 @@ namespace :gems do
unless BUILD_CONFIG[:darwin] and
`which brew`.chomp.size > 0 and
$?.success? and
(openssl = `brew --prefix openssl`.chomp).size > 0
(openssl = `brew --prefix #{ENV["RBX_OPENSSL"] || "openssl"}`.chomp).size > 0
openssl = false
end

@@ -10,7 +10,7 @@
unless BUILD_CONFIG[:darwin] and
`which brew`.chomp.size > 0 and
$?.success? and
(openssl = `brew --prefix openssl`.chomp).size > 0
(openssl = `brew --prefix #{ENV["RBX_OPENSSL"] || "openssl"}`.chomp).size > 0
openssl = false
end

@@ -1,100 +1,102 @@
require File.expand_path("../spec_helper", __FILE__)

describe "JIT compiling a call site" do
context "to m()" do
before :each do
klass = Class.new do
def m() :m end
def call() m() end
with_feature :jit do
describe "JIT compiling a call site" do
context "to m()" do
before :each do
klass = Class.new do
def m() :m end
def call() m() end
end

@o = klass.new

jit(@o, :call) { @o.call }
end

@o = klass.new
it "compiles" do
@o.method(:call).executable.jitted?.should be_true
end

jit(@o, :call) { @o.call }
it "returns the result of calling the method" do
@o.call.should equal(:m)
end
end

it "compiles" do
@o.method(:call).executable.jitted?.should be_true
end
context "to m() defined in an included module" do
before :each do
mod = Module.new do
def m() :m end
end
klass = Class.new do
def call() m() end
include mod
end

it "returns the result of calling the method" do
@o.call.should equal(:m)
end
end
@o = klass.new

context "to m() defined in an included module" do
before :each do
mod = Module.new do
def m() :m end
end
klass = Class.new do
def call() m() end
include mod
jit(@o, :call) { @o.call }
end

@o = klass.new
it "compiles" do
@o.method(:call).executable.jitted?.should be_true
end

jit(@o, :call) { @o.call }
it "returns the result of calling the included method" do
@o.call.should equal(:m)
end
end

it "compiles" do
@o.method(:call).executable.jitted?.should be_true
end
context "to m() defined in a prepended module" do
before :each do

it "returns the result of calling the included method" do
@o.call.should equal(:m)
end
end
mod = Module.new do
def m() :m end
end
klass = Class.new do
def m() :shadowed end
def call() m() end
prepend mod
end

context "to m() defined in a prepended module" do
before :each do
o = @o = klass.new

mod = Module.new do
def m() :m end
end
klass = Class.new do
def m() :shadowed end
def call() m() end
prepend mod
jit(o, :call) { o.call }
end

o = @o = klass.new
it "compiles" do
@o.method(:call).executable.jitted?.should be_true
end

jit(o, :call) { o.call }
it "returns the result of calling the prepended method" do
@o.call.should equal(:m)
end
end

it "compiles" do
@o.method(:call).executable.jitted?.should be_true
end
context "to m() that calls super defined in a prepended module" do
before :each do

it "returns the result of calling the prepended method" do
@o.call.should equal(:m)
end
end
mod = Module.new do
def m() super; :m end
end
klass = Class.new do
def m() :shadowed end
def call() m() end
prepend mod
end

context "to m() that calls super defined in a prepended module" do
before :each do
o = @o = klass.new

mod = Module.new do
def m() super; :m end
end
klass = Class.new do
def m() :shadowed end
def call() m() end
prepend mod
jit(o, :call) { o.call }
end

o = @o = klass.new

jit(o, :call) { o.call }
end

it "compiles" do
@o.method(:call).executable.jitted?.should be_true
end
it "compiles" do
@o.method(:call).executable.jitted?.should be_true
end

it "returns the result of calling the prepended method" do
@o.call.should equal(:m)
it "returns the result of calling the prepended method" do
@o.call.should equal(:m)
end
end
end
end

0 comments on commit 15a805f

Please sign in to comment.