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: 9e3082a112a1
Choose a base ref
...
head repository: jruby/jruby
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 962deb055894
Choose a head ref
  • 4 commits
  • 6 files changed
  • 1 contributor

Commits on May 11, 2015

  1. Copy the full SHA
    5a72f5c View commit details
  2. Copy the full SHA
    92b7653 View commit details
  3. Copy the full SHA
    b73fef5 View commit details
  4. [Truffle] Fix Kernel#singleton_methods to not include the logical cla…

    …ss methods or above.
    eregon committed May 11, 2015
    Copy the full SHA
    962deb0 View commit details
Original file line number Diff line number Diff line change
@@ -1548,7 +1548,7 @@ public RubyArray singletonMethods(VirtualFrame frame, Object self, boolean inclu

CompilerDirectives.transferToInterpreter();
return RubyArray.fromObjects(getContext().getCoreLibrary().getArrayClass(),
metaClass.filterMethods(includeAncestors, MethodFilter.PUBLIC_PROTECTED).toArray());
metaClass.filterSingletonMethods(includeAncestors, MethodFilter.PUBLIC_PROTECTED).toArray());
}

@Specialization
Original file line number Diff line number Diff line change
@@ -33,7 +33,7 @@ public class ThreadBacktraceLocationNodes {

static {
Shape.Allocator allocator = RubyBasicObject.LAYOUT.createAllocator();
ACTIVATION_PROPERTY = Property.create(ACTIVATION_IDENTIFIER, allocator.locationForType(ReentrantLock.class, EnumSet.of(LocationModifier.NonNull)), 0);
ACTIVATION_PROPERTY = Property.create(ACTIVATION_IDENTIFIER, allocator.locationForType(Activation.class, EnumSet.of(LocationModifier.NonNull)), 0);
}

public static Allocator createThreadBacktraceLocationAllocator(Shape emptyShape) {
Original file line number Diff line number Diff line change
@@ -210,7 +210,8 @@ public int write(VirtualFrame frame, RubyBasicObject file, RubyString string) {

final ByteList byteList = string.getByteList();

final ByteBuffer buffer = ByteBuffer.wrap(byteList.bytes(), byteList.begin(), byteList.length());
// TODO (eregon, 11 May 2015): review consistency under concurrent modification
final ByteBuffer buffer = ByteBuffer.wrap(byteList.unsafeBytes(), byteList.begin(), byteList.length());

int total = 0;

Original file line number Diff line number Diff line change
@@ -192,6 +192,26 @@ public static Map<String, InternalMethod> getAllMethods(RubyModule module) {
return methods;
}

@TruffleBoundary
public static Map<String, InternalMethod> getMethodsBeforeLogicalClass(RubyModule module) {
final Map<String, InternalMethod> methods = new HashMap<>();

for (RubyModule ancestor : module.ancestors()) {
// When we find a class which is not a singleton class, we are done
if (ancestor instanceof RubyClass && !((RubyClass) ancestor).isSingleton()) {
break;
}

for (InternalMethod method : ancestor.getMethods().values()) {
if (!methods.containsKey(method.getName())) {
methods.put(method.getName(), method);
}
}
}

return methods;
}

@TruffleBoundary
public static Map<String, InternalMethod> getMethodsUntilLogicalClass(RubyModule module) {
final Map<String, InternalMethod> methods = new HashMap<>();
Original file line number Diff line number Diff line change
@@ -557,23 +557,36 @@ public boolean filter(InternalMethod method) {
}

public Collection<RubySymbol> filterMethods(boolean includeAncestors, MethodFilter filter) {
return filterMethods(includeAncestors, false, filter);
final Map<String, InternalMethod> allMethods;
if (includeAncestors) {
allMethods = ModuleOperations.getAllMethods(this);
} else {
allMethods = getMethods();
}
return filterMethods(allMethods, filter);
}

public Collection<RubySymbol> filterMethodsOnObject(boolean includeAncestors, MethodFilter filter) {
return filterMethods(includeAncestors, true, filter);
}

private Collection<RubySymbol> filterMethods(boolean includeAncestors, boolean untilLogicalClass, MethodFilter filter) {
final Map<String, InternalMethod> allMethods;
if (includeAncestors) {
allMethods = ModuleOperations.getAllMethods(this);
} else if (untilLogicalClass) {
} else {
allMethods = ModuleOperations.getMethodsUntilLogicalClass(this);
}
return filterMethods(allMethods, filter);
}

public Collection<RubySymbol> filterSingletonMethods(boolean includeAncestors, MethodFilter filter) {
final Map<String, InternalMethod> allMethods;
if (includeAncestors) {
allMethods = ModuleOperations.getMethodsBeforeLogicalClass(this);
} else {
allMethods = getMethods();
}
return filterMethods(allMethods, filter);
}

private Collection<RubySymbol> filterMethods(Map<String, InternalMethod> allMethods, MethodFilter filter) {
final Map<String, InternalMethod> methods = ModuleOperations.withoutUndefinedMethods(allMethods);

final Set<RubySymbol> filtered = new HashSet<>();
18 changes: 9 additions & 9 deletions truffle/src/main/ruby/core/config.rb
Original file line number Diff line number Diff line change
@@ -7,13 +7,13 @@
# GNU Lesser General Public License version 2.1

module RbConfig
CONFIG = {
'ruby_install_name' => 'rubytruffle',
'RUBY_INSTALL_NAME' => 'rubytruffle',
'exeext' => '',
'EXEEXT' => 'rubytruffle',
'ruby_version' => '2.2.0',
'libdir' => "#{Truffle::Primitive.home_directory}/lib/ruby/truffle",
'host_os' => Truffle::Primitive.host_os
}
CONFIG = {
'exeext' => '',
'EXEEXT' => 'rubytruffle',
'host_os' => Truffle::Primitive.host_os,
'libdir' => "#{Truffle::Primitive.home_directory}/lib/ruby/truffle",
'ruby_install_name' => 'rubytruffle',
'RUBY_INSTALL_NAME' => 'rubytruffle',
'ruby_version' => '2.2.0',
}
end