Skip to content
Permalink
Browse files
Merge branch 'master' into truffle-head
Conflicts:
	core/src/main/java/org/jruby/truffle/runtime/core/RubyRegexp.java
  • Loading branch information
chrisseaton committed Dec 4, 2014
2 parents e5247d3 + 0f281bc commit e2a3b8c2f746136a19579ac9fc548d3be1fbecb1
Showing with 2,117 additions and 1,150 deletions.
  1. +1 −1 .travis.yml
  2. +1 −1 bin/jirb
  3. +1 −1 core/pom.rb
  4. +1 −1 core/pom.xml
  5. +8 −0 core/src/main/java/org/jruby/RubyBasicObject.java
  6. +7 −2 core/src/main/java/org/jruby/RubyClassPathVariable.java
  7. +4 −1 core/src/main/java/org/jruby/RubyFile.java
  8. +1 −2 core/src/main/java/org/jruby/RubyFileTest.java
  9. +3 −3 core/src/main/java/org/jruby/RubyThread.java
  10. +5 −0 core/src/main/java/org/jruby/ast/DXStrNode.java
  11. +41 −15 core/src/main/java/org/jruby/ext/ffi/Enum.java
  12. +3 −1 core/src/main/java/org/jruby/ext/ffi/Enums.java
  13. 0 core/src/main/java/org/jruby/parser/Ruby19.java
  14. +1 −1 core/src/main/java/org/jruby/runtime/Frame.java
  15. +22 −0 core/src/main/java/org/jruby/runtime/callsite/CachingCallSite.java
  16. +2 −0 core/src/main/java/org/jruby/truffle/TruffleBridgeImpl.java
  17. +35 −0 core/src/main/java/org/jruby/truffle/nodes/AssignmentWrapperNode.java
  18. +1 −1 core/src/main/java/org/jruby/truffle/nodes/cast/LambdaNode.java
  19. +12 −7 core/src/main/java/org/jruby/truffle/nodes/cast/SplatCastNode.java
  20. +4 −4 core/src/main/java/org/jruby/truffle/nodes/control/WhenSplatNode.java
  21. +18 −5 core/src/main/java/org/jruby/truffle/nodes/core/ArrayNodes.java
  22. +11 −14 core/src/main/java/org/jruby/truffle/nodes/core/BasicObjectNodes.java
  23. +35 −0 core/src/main/java/org/jruby/truffle/nodes/core/BinaryCoreMethodNode.java
  24. +14 −3 core/src/main/java/org/jruby/truffle/nodes/core/CoreMethodNodeManager.java
  25. +16 −16 core/src/main/java/org/jruby/truffle/nodes/core/HashNodes.java
  26. +12 −11 core/src/main/java/org/jruby/truffle/nodes/core/KernelNodes.java
  27. +1 −1 core/src/main/java/org/jruby/truffle/nodes/core/ProcNodes.java
  28. +10 −9 core/src/main/java/org/jruby/truffle/nodes/core/RangeNodes.java
  29. +3 −8 core/src/main/java/org/jruby/truffle/nodes/core/RegexpNodes.java
  30. +3 −7 core/src/main/java/org/jruby/truffle/nodes/core/StringNodes.java
  31. +1 −1 core/src/main/java/org/jruby/truffle/nodes/core/TruffleDebugNodes.java
  32. +31 −0 core/src/main/java/org/jruby/truffle/nodes/core/UnaryCoreMethodNode.java
  33. +2 −11 core/src/main/java/org/jruby/truffle/nodes/dispatch/DispatchHeadNode.java
  34. +38 −0 core/src/main/java/org/jruby/truffle/nodes/dispatch/PredicateDispatchHeadNode.java
  35. +5 −0 core/src/main/java/org/jruby/truffle/nodes/literal/BooleanLiteralNode.java
  36. +4 −3 core/src/main/java/org/jruby/truffle/nodes/literal/HashLiteralNode.java
  37. +36 −0 core/src/main/java/org/jruby/truffle/nodes/literal/NilLiteralNode.java
  38. +11 −1 core/src/main/java/org/jruby/truffle/nodes/methods/BlockDefinitionNode.java
  39. +15 −0 core/src/main/java/org/jruby/truffle/nodes/methods/locals/ReadLevelVariableNode.java
  40. +10 −3 core/src/main/java/org/jruby/truffle/nodes/methods/locals/ReadLocalVariableNode.java
  41. +6 −0 core/src/main/java/org/jruby/truffle/nodes/methods/locals/WriteLevelVariableNode.java
  42. +5 −0 core/src/main/java/org/jruby/truffle/nodes/methods/locals/WriteLocalVariableNode.java
  43. +0 −2 core/src/main/java/org/jruby/truffle/nodes/objects/SelfNode.java
  44. +5 −0 core/src/main/java/org/jruby/truffle/nodes/objects/WriteClassVariableNode.java
  45. +6 −0 core/src/main/java/org/jruby/truffle/nodes/objects/WriteInstanceVariableNode.java
  46. +1 −0 core/src/main/java/org/jruby/truffle/nodes/respondto/RespondToNode.java
  47. +14 −5 core/src/main/java/org/jruby/truffle/nodes/supercall/AbstractGeneralSuperCallNode.java
  48. +2 −2 core/src/main/java/org/jruby/truffle/nodes/supercall/GeneralSuperCallNode.java
  49. +2 −2 core/src/main/java/org/jruby/truffle/nodes/supercall/GeneralSuperReCallNode.java
  50. +8 −5 core/src/main/java/org/jruby/truffle/runtime/RubyCallStack.java
  51. +0 −12 core/src/main/java/org/jruby/truffle/runtime/core/CoreLibrary.java
  52. +16 −3 core/src/main/java/org/jruby/truffle/runtime/core/RubyProc.java
  53. +59 −76 core/src/main/java/org/jruby/truffle/runtime/core/RubyRegexp.java
  54. +1 −1 core/src/main/java/org/jruby/truffle/runtime/core/RubySymbol.java
  55. +3 −0 core/src/main/java/org/jruby/truffle/runtime/methods/MethodLike.java
  56. +1 −0 core/src/main/java/org/jruby/truffle/runtime/methods/RubyMethod.java
  57. +67 −56 core/src/main/java/org/jruby/truffle/translator/BodyTranslator.java
  58. +2 −2 core/src/main/java/org/jruby/truffle/translator/MethodTranslator.java
  59. +1 −1 core/src/main/java/org/jruby/truffle/translator/TranslatorDriver.java
  60. +8 −0 core/src/main/java/org/jruby/truffle/translator/TranslatorEnvironment.java
  61. +4 −0 core/src/main/java/org/jruby/util/JarResource.java
  62. +7 −0 core/src/main/java/org/jruby/util/ShellLauncher.java
  63. +9 −0 core/src/main/ruby/jruby/truffle/core/kernel.rb
  64. +22 −2 lib/ruby/stdlib/ffi/library.rb
  65. +1 −1 lib/ruby/stdlib/rubygems.rb
  66. +1 −1 lib/ruby/stdlib/rubygems/commands/contents_command.rb
  67. +1 −1 lib/ruby/stdlib/rubygems/resolver/api_specification.rb
  68. +25 −0 lib/ruby/stdlib/rubygems/ssl_certs/AddTrustExternalCARoot-2048.pem
  69. +5 −6 spec/ffi/async_callback_spec.rb
  70. +10 −9 spec/ffi/bool_spec.rb
  71. +65 −38 spec/ffi/buffer_spec.rb
  72. +217 −115 spec/ffi/callback_spec.rb
  73. +2 −2 spec/ffi/custom_param_type.rb
  74. +6 −7 spec/ffi/custom_type_spec.rb
  75. +7 −9 spec/ffi/dup_spec.rb
  76. +332 −130 spec/ffi/enum_spec.rb
  77. +3 −3 spec/ffi/errno_spec.rb
  78. +5 −7 spec/ffi/ffi_spec.rb
  79. +17 −0 spec/ffi/fixtures/EnumTest.c
  80. +23 −12 spec/ffi/function_spec.rb
  81. +1 −1 spec/ffi/io_spec.rb
  82. +95 −37 spec/ffi/library_spec.rb
  83. +4 −5 spec/ffi/long_double.rb
  84. +6 −6 spec/ffi/managed_struct_spec.rb
  85. +8 −1 spec/ffi/memorypointer_spec.rb
  86. +44 −35 spec/ffi/number_spec.rb
  87. +77 −60 spec/ffi/platform_spec.rb
  88. +42 −33 spec/ffi/pointer_spec.rb
  89. +4 −5 spec/ffi/rbx/attach_function_spec.rb
  90. +25 −23 spec/ffi/rbx/memory_pointer_spec.rb
  91. +1 −2 spec/ffi/rbx/spec_helper.rb
  92. +2 −3 spec/ffi/rbx/struct_spec.rb
  93. +2 −0 spec/ffi/spec_helper.rb
  94. +23 −15 spec/ffi/string_spec.rb
  95. +7 −8 spec/ffi/strptr_spec.rb
  96. +5 −6 spec/ffi/struct_by_ref_spec.rb
  97. +7 −8 spec/ffi/struct_callback_spec.rb
  98. +3 −4 spec/ffi/struct_initialize_spec.rb
  99. +13 −15 spec/ffi/struct_packed_spec.rb
  100. +216 −132 spec/ffi/struct_spec.rb
  101. +18 −12 spec/ffi/typedef_spec.rb
  102. +9 −8 spec/ffi/union_spec.rb
  103. +27 −8 spec/ffi/variadic_spec.rb
  104. +3 −4 spec/java_integration/globals/classpath_spec.rb
  105. +1 −1 spec/jruby.2.2.mspec
  106. +20 −0 spec/regression/GH-2264_illegal_hex_characters_in_escape_pattern.rb
  107. +8 −0 spec/ruby/core/exception/backtrace_spec.rb
  108. +0 −11 spec/ruby/core/exception/redefining_backtrace.rb
  109. +5 −0 spec/ruby/core/float/divide_spec.rb
  110. +5 −0 spec/ruby/core/float/gt_spec.rb
  111. +5 −0 spec/ruby/core/float/gte_spec.rb
  112. +5 −0 spec/ruby/core/float/lt_spec.rb
  113. +5 −0 spec/ruby/core/float/lte_spec.rb
  114. +5 −0 spec/ruby/core/float/multiply_spec.rb
  115. +0 −1 spec/ruby/core/symbol/encoding_spec.rb
  116. 0 spec/ruby/core/symbol/versions/{encoding_1.9.rb → encoding_1.9_spec.rb}
  117. +0 −4 spec/ruby/language/def_spec.rb
  118. 0 spec/ruby/language/versions/{def_2.0.rb → def_2.0_spec.rb}
  119. 0 spec/tags/ruby/core/symbol/{encoding_tags.txt → versions/encoding_1.9_tags.txt}
  120. +1 −0 spec/truffle/tags/core/exception/backtrace_tags.txt
  121. +1 −0 spec/truffle/tags/core/float/divide_tags.txt
  122. +1 −0 spec/truffle/tags/core/float/multiply_tags.txt
  123. +0 −2 spec/truffle/tags/core/symbol/encoding_tags.txt
  124. +2 −0 spec/truffle/tags/core/symbol/versions/encoding_1.9_tags.txt
  125. +1 −1 spec/truffle/tags/language/block_tags.txt
  126. +0 −23 spec/truffle/tags/language/defined_tags.txt
  127. +0 −2 spec/truffle/tags/language/lambda_tags.txt
  128. +0 −7 spec/truffle/tags/language/method_tags.txt
  129. +0 −10 spec/truffle/tags/language/numbers_tags.txt
  130. +0 −2 spec/truffle/tags/language/predefined_tags.txt
  131. +0 −3 spec/truffle/tags/language/super_tags.txt
  132. +1 −1 spec/truffle/tags/language/variables_tags.txt
  133. 0 spec/truffle/tags/language/versions/{def_2.0.rb → def_2.0_tags.txt}
  134. +0 −2 spec/truffle/tags/language/while_tags.txt
  135. +0 −1 spec/truffle/truffle.mspec
  136. +8 −0 test/jruby/test_file.rb
  137. +3 −3 test/jruby/test_thread.rb
  138. +0 −1 test/mri/excludes/TestFileUtils.rb
@@ -86,5 +86,5 @@ notifications:
urls:
- "https://rubies.travis-ci.org/rebuild/jruby-head"
# we are on a branch
#on_success: always
on_success: always
on_failure: never
@@ -9,7 +9,7 @@

require "irb"

if __FILE__.sub(/file:/, '') == $0.sub(/file:/, '')
if __FILE__.sub(/file:/, '').gsub(/ /,'%20') == $0.gsub(/file:/, '').gsub(/ /,'%20')
IRB.start(__FILE__)
else
# check -e option
@@ -37,7 +37,7 @@
jar 'com.github.jnr:jnr-unixsocket:0.3'
jar 'com.github.jnr:jnr-posix:3.0.7'
jar 'com.github.jnr:jnr-constants:0.8.6-SNAPSHOT'
jar 'com.github.jnr:jnr-ffi:2.0.0-SNAPSHOT'
jar 'com.github.jnr:jnr-ffi:2.0.0'
jar 'com.github.jnr:jffi:${jffi.version}'
jar 'com.github.jnr:jffi:${jffi.version}:native'

@@ -81,7 +81,7 @@
<dependency>
<groupId>com.github.jnr</groupId>
<artifactId>jnr-ffi</artifactId>
<version>2.0.0-SNAPSHOT</version>
<version>2.0.0</version>
</dependency>
<dependency>
<groupId>com.github.jnr</groupId>
@@ -1690,6 +1690,8 @@ public IRubyObject instance_exec19(ThreadContext context, IRubyObject[] args, Bl
protected IRubyObject yieldUnder(final ThreadContext context, RubyModule under, IRubyObject[] args, Block block, EvalType evalType) {
context.preExecuteUnder(under, block);

IRubyObject savedBindingSelf = block.getBinding().getSelf();
IRubyObject savedFrameSelf = block.getBinding().getFrame().getSelf();
Visibility savedVisibility = block.getBinding().getVisibility();
block.getBinding().setVisibility(PUBLIC);

@@ -1706,6 +1708,8 @@ protected IRubyObject yieldUnder(final ThreadContext context, RubyModule under,
return (IRubyObject) bj.getValue();
} finally {
block.getBinding().setVisibility(savedVisibility);
block.getBinding().setSelf(savedBindingSelf);
block.getBinding().getFrame().setSelf(savedFrameSelf);

context.postExecuteUnder();
}
@@ -1728,6 +1732,8 @@ private Block setupBlock(Block block, EvalType evalType) {
protected IRubyObject yieldUnder(final ThreadContext context, RubyModule under, Block block, EvalType evalType) {
context.preExecuteUnder(under, block);

IRubyObject savedBindingSelf = block.getBinding().getSelf();
IRubyObject savedFrameSelf = block.getBinding().getFrame().getSelf();
Visibility savedVisibility = block.getBinding().getVisibility();
block.getBinding().setVisibility(PUBLIC);

@@ -1738,6 +1744,8 @@ protected IRubyObject yieldUnder(final ThreadContext context, RubyModule under,
return (IRubyObject) bj.getValue();
} finally {
block.getBinding().setVisibility(savedVisibility);
block.getBinding().setSelf(savedBindingSelf);
block.getBinding().getFrame().setSelf(savedFrameSelf);

context.postExecuteUnder();
}
@@ -66,10 +66,15 @@ public IRubyObject append(ThreadContext context, IRubyObject obj) {
paths = context.runtime.newArray(obj).toJavaArray();
}

boolean is1_8 = context.getRuntime().is1_8();
for (IRubyObject path: paths) {
String ss = path.convertToString().toString();
try {
URL url = getURL(ss);
URL url = getURL(path.convertToString().toString());
if (url.getProtocol().equals("file")) {
path = is1_8 ? RubyFile.expand_path(context, null, new IRubyObject[]{ path })
: RubyFile.expand_path19(context, null, new IRubyObject[]{ path });
url = getURL(path.convertToString().toString());
}
getRuntime().getJRubyClassLoader().addURL(url);
} catch (MalformedURLException mue) {
throw getRuntime().newArgumentError(mue.getLocalizedMessage());
@@ -934,7 +934,10 @@ public static IRubyObject rename(ThreadContext context, IRubyObject recv, IRubyO
JRubyFile oldFile = JRubyFile.create(runtime.getCurrentDirectory(), oldNameJavaString);
JRubyFile newFile = JRubyFile.create(runtime.getCurrentDirectory(), newNameJavaString);

if (!oldFile.exists() || !newFile.getParentFile().exists()) {
boolean isOldSymlink = RubyFileTest.symlink_p(recv, oldNameString).isTrue();
// Broken symlinks considered by exists() as non-existing,
// so we need to check for symlinks explicitly.
if (!(oldFile.exists() || isOldSymlink) || !newFile.getParentFile().exists()) {
throw runtime.newErrnoENOENTError(oldNameJavaString + " or " + newNameJavaString);
}

@@ -197,8 +197,7 @@ public static IRubyObject readable_p(ThreadContext context, IRubyObject recv, IR
filename = get_path(context, filename);
}

FileStat stat = fileResource(filename).stat();
return runtime.newBoolean(stat != null && stat.isReadable());
return runtime.newBoolean(fileResource(filename).canRead());
}

// Not exposed by filetest, but so similiar in nature that it is stored here
@@ -1259,10 +1259,10 @@ public <Data, Return> Return executeTask(ThreadContext context, Data data, Task<
this.unblockFunc = task;
this.unblockArg = data;

enterSleep();

// check for interrupt before going into blocking call
context.pollThreadEvents();
pollThreadEvents(context);

enterSleep();

return task.run(context, data);
} finally {
@@ -31,6 +31,7 @@
***** END LICENSE BLOCK *****/
package org.jruby.ast;

import org.jcodings.Encoding;
import org.jruby.ast.types.ILiteralNode;
import org.jruby.ast.visitor.NodeVisitor;
import org.jruby.lexer.yacc.ISourcePosition;
@@ -44,6 +45,10 @@ public DXStrNode(ISourcePosition position, DStrNode node) {
super(position);
addAll(node);
}

public DXStrNode(ISourcePosition position, Encoding encoding) {
super(position, encoding);
}

public DXStrNode(ISourcePosition position) {
super(position);
@@ -30,7 +30,7 @@

import java.util.IdentityHashMap;
import java.util.Map;
import org.jcodings.util.IntHash;
import java.util.concurrent.ConcurrentHashMap;
import org.jruby.anno.JRubyClass;
import org.jruby.anno.JRubyMethod;
import org.jruby.Ruby;
@@ -52,12 +52,12 @@
*/
@JRubyClass(name="FFI::Enum", parent="Object")
public final class Enum extends RubyObject {
private final IRubyObject nativeType;
private IRubyObject nativeType;
private final RubyHash kv_map;
private volatile IRubyObject tag;

private volatile Map<RubySymbol, RubyInteger> symbolToValue = new IdentityHashMap<RubySymbol, RubyInteger>();
private volatile IntHash<RubySymbol> valueToSymbol = new IntHash<RubySymbol>();
private volatile ConcurrentHashMap<Long, RubySymbol> valueToSymbol = new ConcurrentHashMap<Long, RubySymbol>();

public static RubyClass createEnumClass(Ruby runtime, RubyModule ffiModule) {
RubyClass enumClass = ffiModule.defineClassUnder("Enum", runtime.getObject(),
@@ -79,27 +79,53 @@ public final IRubyObject allocate(Ruby runtime, RubyClass klass) {

private Enum(Ruby runtime, RubyClass klass) {
super(runtime, klass);
nativeType = runtime.getModule("FFI").getClass("Type").getConstant("INT");
kv_map = RubyHash.newHash(runtime);
tag = runtime.getNil();
}

@JRubyMethod(name = "initialize", visibility = Visibility.PRIVATE)
public final IRubyObject initialize(ThreadContext context, IRubyObject values, IRubyObject tag) {
this.tag = tag;
return initialize(context, values);
public final IRubyObject initialize(ThreadContext context, IRubyObject arg) {
return initialize(context, null, null, arg);
}

@JRubyMethod(name = "initialize", visibility = Visibility.PRIVATE)
public final IRubyObject initialize(ThreadContext context, IRubyObject values) {
public final IRubyObject initialize(ThreadContext context, IRubyObject arg0, IRubyObject arg1) {
if (arg0 instanceof org.jruby.ext.ffi.Type)
return initialize(context, arg0, arg1, null);

if (arg1.isNil())
return initialize(context, null, arg0, null);

// Handles bad args and tag, values case.
return initialize(context, null, arg0, arg1);
}

@JRubyMethod(name = "initialize", visibility = Visibility.PRIVATE)
public final IRubyObject initialize(ThreadContext context, IRubyObject type, IRubyObject values, IRubyObject tag) {
int offset = 0;
if (type instanceof org.jruby.ext.ffi.Type) {
nativeType = type;
} else {
if (!(type == null || type.isNil()))
throw context.runtime.newTypeError(type, context.runtime.getModule("FFI").getClass("Type"));

nativeType = context.runtime.getModule("FFI").getClass("Type").getConstant("INT");
}

if (!(tag == null || tag.isNil() || tag instanceof RubySymbol))
throw context.runtime.newTypeError(tag, context.runtime.getSymbol());

this.tag = tag;

if (!(values instanceof RubyArray)) {
throw context.runtime.newTypeError(values, context.runtime.getArray());
}

RubyArray ary = (RubyArray) values;

Map<RubySymbol, RubyInteger> s2v = new IdentityHashMap<RubySymbol, RubyInteger>();
IRubyObject prevConstant = null;
int nextValue = 0;
long nextValue = 0;

for (int i = 0; i < ary.size(); i++) {
IRubyObject v = ary.entry(i);
@@ -109,24 +135,24 @@ public final IRubyObject initialize(ThreadContext context, IRubyObject values) {
prevConstant = v;
nextValue++;

} else if (v instanceof RubyFixnum) {
} else if (v instanceof RubyInteger) {
if (prevConstant == null) {
throw context.runtime.newArgumentError("invalid enum sequence - no symbol for value "
+ v);
}
s2v.put((RubySymbol) prevConstant, (RubyFixnum) v);
nextValue = (int) ((RubyInteger) v).getLongValue() + 1;
nextValue = ((RubyInteger) v).getLongValue() + 1;

} else {
throw context.runtime.newTypeError(v, context.runtime.getSymbol());
}
}

symbolToValue = new IdentityHashMap<RubySymbol, RubyInteger>(s2v);
valueToSymbol = new IntHash<RubySymbol>(symbolToValue.size());
valueToSymbol = new ConcurrentHashMap<Long, RubySymbol>(symbolToValue.size());
for (Map.Entry<RubySymbol, RubyInteger> e : symbolToValue.entrySet()) {
kv_map.fastASet(e.getKey(), e.getValue());
valueToSymbol.put((int) e.getValue().getLongValue(), e.getKey());
valueToSymbol.put(e.getValue().getLongValue(), e.getKey());
}

return this;
@@ -139,7 +165,7 @@ public final IRubyObject find(ThreadContext context, IRubyObject query) {
return value != null ? value : context.runtime.getNil();

} else if (query instanceof RubyInteger) {
RubySymbol symbol = valueToSymbol.get((int) ((RubyInteger) query).getLongValue());
RubySymbol symbol = valueToSymbol.get((Long)((RubyInteger) query).getLongValue());
return symbol != null ? symbol : context.runtime.getNil();

} else {
@@ -194,7 +220,7 @@ public final IRubyObject from_native(ThreadContext context, IRubyObject value, I

RubySymbol sym;

if (value instanceof RubyInteger && (sym = valueToSymbol.get((int) ((RubyInteger) value).getLongValue())) != null) {
if (value instanceof RubyInteger && (sym = valueToSymbol.get((Long)((RubyInteger) value).getLongValue())) != null) {
return sym;
}

@@ -93,7 +93,9 @@ public IRubyObject append(final ThreadContext context, IRubyObject item){
}
allEnums.append(item);
if (!(item == null || item == context.nil)){
taggedEnums.fastASet(((Enum)item).tag(context), item);
IRubyObject tag = ((Enum)item).tag(context);
if (tag != null && !tag.isNil())
taggedEnums.fastASet(tag, item);
}
symbolMap.merge_bang(context, ((Enum)item).symbol_map(context), Block.NULL_BLOCK);
return item;
Empty file.
@@ -253,7 +253,7 @@ public String getName() {
*
* @return The self for the frame
*/
IRubyObject getSelf() {
public IRubyObject getSelf() {
return self;
}

@@ -65,6 +65,8 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s

public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject... args) {
RubyClass selfType = getClass(self);
// This must be retrieved *once* to avoid racing with other threads.
CacheEntry cache = this.cache;
if (CacheEntry.typeOk(cache, selfType)) {
return cache.method.call(context, self, selfType, methodName, args);
}
@@ -73,6 +75,8 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s

private IRubyObject callBlock(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject[] args, Block block) {
RubyClass selfType = getClass(self);
// This must be retrieved *once* to avoid racing with other threads.
CacheEntry cache = this.cache;
if (CacheEntry.typeOk(cache, selfType)) {
return cache.method.call(context, self, selfType, methodName, args, block);
}
@@ -123,6 +127,8 @@ public IRubyObject callVarargsIter(ThreadContext context, IRubyObject caller, IR

public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self) {
RubyClass selfType = getClass(self);
// This must be retrieved *once* to avoid racing with other threads.
CacheEntry cache = this.cache;
if (CacheEntry.typeOk(cache, selfType)) {
return cache.method.call(context, self, selfType, methodName);
}
@@ -131,6 +137,8 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s

private IRubyObject callBlock(ThreadContext context, IRubyObject caller, IRubyObject self, Block block) {
RubyClass selfType = getClass(self);
// This must be retrieved *once* to avoid racing with other threads.
CacheEntry cache = this.cache;
if (CacheEntry.typeOk(cache, selfType)) {
return cache.method.call(context, self, selfType, methodName, block);
}
@@ -151,6 +159,8 @@ public IRubyObject callIter(ThreadContext context, IRubyObject caller, IRubyObje

public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg1) {
RubyClass selfType = getClass(self);
// This must be retrieved *once* to avoid racing with other threads.
CacheEntry cache = this.cache;
if (CacheEntry.typeOk(cache, selfType)) {
return cache.method.call(context, self, selfType, methodName, arg1);
}
@@ -159,6 +169,8 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s

private IRubyObject callBlock(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg1, Block block) {
RubyClass selfType = getClass(self);
// This must be retrieved *once* to avoid racing with other threads.
CacheEntry cache = this.cache;
if (CacheEntry.typeOk(cache, selfType)) {
return cache.method.call(context, self, selfType, methodName, arg1, block);
}
@@ -179,6 +191,8 @@ public IRubyObject callIter(ThreadContext context, IRubyObject caller, IRubyObje

public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg1, IRubyObject arg2) {
RubyClass selfType = getClass(self);
// This must be retrieved *once* to avoid racing with other threads.
CacheEntry cache = this.cache;
if (CacheEntry.typeOk(cache, selfType)) {
return cache.method.call(context, self, selfType, methodName, arg1, arg2);
}
@@ -187,6 +201,8 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s

private IRubyObject callBlock(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg1, IRubyObject arg2, Block block) {
RubyClass selfType = getClass(self);
// This must be retrieved *once* to avoid racing with other threads.
CacheEntry cache = this.cache;
if (CacheEntry.typeOk(cache, selfType)) {
return cache.method.call(context, self, selfType, methodName, arg1, arg2, block);
}
@@ -207,6 +223,8 @@ public IRubyObject callIter(ThreadContext context, IRubyObject caller, IRubyObje

public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3) {
RubyClass selfType = getClass(self);
// This must be retrieved *once* to avoid racing with other threads.
CacheEntry cache = this.cache;
if (CacheEntry.typeOk(cache, selfType)) {
return cache.method.call(context, self, selfType, methodName, arg1, arg2, arg3);
}
@@ -215,6 +233,8 @@ public IRubyObject call(ThreadContext context, IRubyObject caller, IRubyObject s

private IRubyObject callBlock(ThreadContext context, IRubyObject caller, IRubyObject self, IRubyObject arg1, IRubyObject arg2, IRubyObject arg3, Block block) {
RubyClass selfType = getClass(self);
// This must be retrieved *once* to avoid racing with other threads.
CacheEntry cache = this.cache;
if (CacheEntry.typeOk(cache, selfType)) {
return cache.method.call(context, self, selfType, methodName, arg1, arg2, arg3, block);
}
@@ -234,6 +254,8 @@ public IRubyObject callIter(ThreadContext context, IRubyObject caller, IRubyObje
}

public CacheEntry retrieveCache(RubyClass selfType, String methodName) {
// This must be retrieved *once* to avoid racing with other threads.
CacheEntry cache = this.cache;
if (CacheEntry.typeOk(cache, selfType)) {
return cache;
}

0 comments on commit e2a3b8c

Please sign in to comment.