Skip to content

Commit

Permalink
Showing 5 changed files with 11 additions and 2 deletions.
Original file line number Diff line number Diff line change
@@ -100,6 +100,7 @@ public void defineAlias(int encodingListIndex, String name) {
LOOKUP.put(name.toLowerCase(Locale.ENGLISH), rubyEncoding);
}

@TruffleBoundary
public synchronized DynamicObject replicateEncoding(Encoding encoding, String name) {
if (getRubyEncoding(name) != null) {
return null;
Original file line number Diff line number Diff line change
@@ -108,6 +108,7 @@ public DynamicObject name(DynamicObject method) {
@CoreMethod(names = "hash")
public abstract static class HashNode extends CoreMethodArrayArgumentsNode {

@TruffleBoundary
@Specialization
public long hash(DynamicObject rubyMethod) {
final InternalMethod method = Layouts.METHOD.getMethod(rubyMethod);
Original file line number Diff line number Diff line change
@@ -104,6 +104,7 @@ protected DynamicObject metaClass(Object object) {
@CoreMethod(names = "hash")
public abstract static class HashNode extends CoreMethodArrayArgumentsNode {

@TruffleBoundary
@Specialization
public long hash(DynamicObject rubyMethod) {
final InternalMethod method = Layouts.UNBOUND_METHOD.getMethod(rubyMethod);
Original file line number Diff line number Diff line change
@@ -188,12 +188,13 @@ public int getGID() {
@CoreMethod(names = "getgroups", isModuleFunction = true, required = 2, lowerFixnum = 1, unsafe = {UnsafeGroup.MEMORY, UnsafeGroup.PROCESSES})
public abstract static class GetGroupsNode extends CoreMethodArrayArgumentsNode {

@TruffleBoundary
@Specialization(guards = "isNil(pointer)")
public int getGroupsNil(int max, DynamicObject pointer) {
return getContext().getNativePlatform().getPosix().getgroups().length;
}

@CompilerDirectives.TruffleBoundary
@TruffleBoundary
@Specialization(guards = "isRubyPointer(pointer)")
public int getGroups(int max, DynamicObject pointer) {
final long[] groups = getContext().getNativePlatform().getPosix().getgroups();
Original file line number Diff line number Diff line change
@@ -126,13 +126,18 @@ private String findFeatureWithExactPath(String path) {
}
}

@TruffleBoundary
private boolean isSulongAvailable() {
return context.getEnv().isMimeTypeSupported(RubyLanguage.CEXT_MIME_TYPE);
}

public void ensureCExtImplementationLoaded(VirtualFrame frame, String feature, IndirectCallNode callNode) {
synchronized (cextImplementationLock) {
if (cextImplementationLoaded) {
return;
}

if (!context.getEnv().isMimeTypeSupported(RubyLanguage.CEXT_MIME_TYPE)) {
if (!isSulongAvailable()) {
throw new RaiseException(context.getCoreExceptions().loadError("Sulong is required to support C extensions, and it doesn't appear to be available", feature, null));
}

0 comments on commit 2334b3f

Please sign in to comment.