Skip to content

Commit

Permalink
[Truffle] Added missing boundaries.
Browse files Browse the repository at this point in the history
  • Loading branch information
nirvdrum committed Oct 17, 2016
1 parent b607f52 commit 2334b3f
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 2 deletions.
Expand Up @@ -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;
Expand Down
Expand Up @@ -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);
Expand Down
Expand Up @@ -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);
Expand Down
Expand Up @@ -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();
Expand Down
Expand Up @@ -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));
}

Expand Down

0 comments on commit 2334b3f

Please sign in to comment.