Пример #1
0
 @TruffleBoundary
 protected CallTarget findCallTarget(TruffleObject truffleObject) {
   final ForeignAccess fa = truffleObject.getForeignAccess();
   final CallTarget ct = fa.access(access);
   if (ct == null) {
     throw messageNotRecognizedException(fa);
   }
   return ct;
 }
Пример #2
0
 @Override
 public Object execute(VirtualFrame frame) {
   if (RubyGuards.isRubyString(ForeignAccess.getReceiver(frame))) {
     final DynamicObject string = (DynamicObject) ForeignAccess.getReceiver(frame);
     final int index = (int) ForeignAccess.getArguments(frame).get(labelIndex);
     if (index >= Layouts.STRING.getRope(string).byteLength()) {
       return 0;
     } else {
       return (byte) StringOperations.getByteListReadOnly(string).get(index);
     }
   } else {
     CompilerDirectives.transferToInterpreter();
     throw new IllegalStateException("Not implemented");
   }
 }