Skip to content

Commit

Permalink
[Truffle] Just use inheritance for static delegation, it is much simp…
Browse files Browse the repository at this point in the history
…ler.
  • Loading branch information
eregon committed Oct 13, 2014
1 parent f444f8c commit 754bf41
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 22 deletions.
12 changes: 1 addition & 11 deletions core/src/main/java/org/jruby/truffle/nodes/core/GCNodes.java
Expand Up @@ -27,23 +27,13 @@
public abstract class GCNodes {

@CoreMethod(names = "start", onSingleton = true, maxArgs = 0)
public abstract static class StartNode extends CoreMethodNode {

@Child protected GarbageCollectNode gcNode;

public abstract static class StartNode extends GarbageCollectNode {
public StartNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
gcNode = GCNodesFactory.GarbageCollectNodeFactory.create(context, sourceSection, null);
}

public StartNode(StartNode prev) {
super(prev);
this.gcNode = prev.gcNode;
}

@Specialization
public NilPlaceholder start() {
return gcNode.executeGC();
}
}

Expand Down
Expand Up @@ -116,23 +116,13 @@ public RubyProc defineFinalizer(Object object, RubyProc finalizer) {
}

@CoreMethod(names = "garbage_collect", isModuleFunction = true, maxArgs = 0)
public abstract static class GarbageCollectNode extends CoreMethodNode {

@Child protected GCNodes.GarbageCollectNode gcNode;

public abstract static class GarbageCollectNode extends GCNodes.GarbageCollectNode {
public GarbageCollectNode(RubyContext context, SourceSection sourceSection) {
super(context, sourceSection);
gcNode = GCNodesFactory.GarbageCollectNodeFactory.create(context, sourceSection, null);
}

public GarbageCollectNode(GarbageCollectNode prev) {
super(prev);
this.gcNode = prev.gcNode;
}

@Specialization
public NilPlaceholder garbageCollect() {
return gcNode.executeGC();
}
}

Expand Down

0 comments on commit 754bf41

Please sign in to comment.