コード例 #1
0
 @TruffleBoundary
 protected InternalMethod doLookup(InternalMethod currentMethod, DynamicObject selfMetaClass) {
   assert RubyGuards.isRubyClass(selfMetaClass);
   InternalMethod superMethod = ModuleOperations.lookupSuperMethod(currentMethod, selfMetaClass);
   // TODO (eregon, 12 June 2015): Is this correct?
   if (superMethod != null && superMethod.isUndefined()) {
     superMethod = null;
   }
   return superMethod;
 }
コード例 #2
0
 @Override
 public String toString() {
   return String.format(
       "CachedBoxedDispatchNode(:%s, %s@%x, %s)",
       getCachedNameAsSymbol().toString(),
       expectedReceiver,
       expectedReceiver.hashCode(),
       method == null ? "null" : method.toString());
 }
コード例 #3
0
  @Override
  public Object execute(VirtualFrame frame) {
    final DynamicObject module = (DynamicObject) definingModule.execute(frame);
    final InternalMethod definition =
        prepareLexicalScope(module, definitionMethod.executeMethod(frame));

    return callModuleDefinitionNode.call(
        frame,
        definition.getCallTarget(),
        RubyArguments.pack(
            null,
            null,
            definition,
            DeclarationContext.MODULE,
            null,
            module,
            null,
            new Object[] {}));
  }
コード例 #4
0
  public CachedSingletonDispatchNode(
      RubyContext context,
      Object cachedName,
      DispatchNode next,
      DynamicObject expectedReceiver,
      DynamicObject expectedClass,
      InternalMethod method,
      DispatchAction dispatchAction) {
    super(context, cachedName, next, dispatchAction);

    this.expectedReceiver = expectedReceiver;
    this.unmodifiedAssumption = Layouts.MODULE.getFields(expectedClass).getUnmodifiedAssumption();
    this.next = next;
    this.method = method;
    this.callNode = Truffle.getRuntime().createDirectCallNode(method.getCallTarget());
    applySplittingInliningStrategy(callNode, method);
  }
コード例 #5
0
 @TruffleBoundary
 private InternalMethod prepareLexicalScope(DynamicObject module, InternalMethod definition) {
   lexicalScope.unsafeSetLiveModule(module);
   Layouts.MODULE.getFields(lexicalScope.getParent().getLiveModule()).addLexicalDependent(module);
   return definition.withDeclaringModule(module);
 }