@Override public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { IRubyObject value = currDynScope.getValue(offset, scopeDepth); if (value == null) value = context.nil; return value; }
@Override public Object retrieve(ThreadContext context, IRubyObject self, StaticScope currScope, DynamicScope currDynScope, Object[] temp) { IRubyObject value = currDynScope.getValue(offset, scopeDepth); if (value == null) value = context.nil; return value; }
@Override public Object retrieve(ThreadContext context, IRubyObject self, DynamicScope currDynScope, Object[] temp) { IRubyObject value = currDynScope.getValue(offset, scopeDepth); if (value == null) value = context.nil; return value; }
@Override public Object retrieve(ThreadContext context, IRubyObject self, DynamicScope currDynScope, Object[] temp) { IRubyObject value = currDynScope.getValue(offset, scopeDepth); if (value == null) value = context.nil; return value; }
/** * Get value from current scope or one of its captured scopes. * * FIXME: block variables are not getting primed to nil so we need to null check those * until we prime them properly. Also add assert back in. * * @param offset zero-indexed value that represents where variable lives * @param depth how many captured scopes down this variable should be set * @return the value here */ public IRubyObject getValue(int offset, int depth) { assert depth != 0: SIZE_ERROR; return parent.getValue(offset, depth - 1); }
/** * Get value from current scope or one of its captured scopes. * * FIXME: block variables are not getting primed to nil so we need to null check those * until we prime them properly. Also add assert back in. * * @param offset zero-indexed value that represents where variable lives * @param depth how many captured scopes down this variable should be set * @return the value here */ public IRubyObject getValue(int offset, int depth) { assert depth != 0: SIZE_ERROR; return parent.getValue(offset, depth - 1); }
/** * Get value from current scope or one of its captured scopes. * * FIXME: block variables are not getting primed to nil so we need to null check those * until we prime them properly. Also add assert back in. * * @param offset zero-indexed value that represents where variable lives * @param depth how many captured scopes down this variable should be set * @return the value here */ @Override public IRubyObject getValue(int offset, int depth) { if (depth > 0) { return parent.getValue(offset, depth - 1); } assert offset < SIZE : SIZE_ERROR; return variableValueZero; }
/** * Get value from current scope or one of its captured scopes. * * FIXME: block variables are not getting primed to nil so we need to null check those * until we prime them properly. Also add assert back in. * * @param offset zero-indexed value that represents where variable lives * @param depth how many captured scopes down this variable should be set * @return the value here */ @Override public IRubyObject getValue(int offset, int depth) { if (depth > 0) { return parent.getValue(offset, depth - 1); } assert offset < SIZE : SIZE_ERROR; return variableValueZero; }
/** * Variation of getValue for depth 0 */ @JIT public IRubyObject getValueDepthZero(int offset) { return getValue(offset, 0); }
/** * Variation of getValue for depth 0 */ @JIT public IRubyObject getValueDepthZero(int offset) { return getValue(offset, 0); }
/** * Get value from current scope or one of its captured scopes. * * FIXME: block variables are not getting primed to nil so we need to null check those * until we prime them properly. Also add assert back in. * * @param offset zero-indexed value that represents where variable lives * @param depth how many captured scopes down this variable should be set * @return the value here */ public IRubyObject getValue(int offset, int depth) { if (depth > 0) { return parent.getValue(offset, depth - 1); } assertGetValue(offset, depth); // &foo are not getting set from somewhere...I want the following assert to be true though //assert variableValues[offset] != null : "Getting unassigned: " + staticScope.getVariables()[offset]; return variableValues[offset]; }
/** * Get value from current scope or one of its captured scopes. * * FIXME: block variables are not getting primed to nil so we need to null check those * until we prime them properly. Also add assert back in. * * @param offset zero-indexed value that represents where variable lives * @param depth how many captured scopes down this variable should be set * @return the value here */ public IRubyObject getValue(int offset, int depth) { if (depth > 0) { return parent.getValue(offset, depth - 1); } assertGetValue(offset, depth); // &foo are not getting set from somewhere...I want the following assert to be true though //assert variableValues[offset] != null : "Getting unassigned: " + staticScope.getVariables()[offset]; return variableValues[offset]; }
protected static Object retrieveOp(Operand r, ThreadContext context, IRubyObject self, DynamicScope currDynScope, StaticScope currScope, Object[] temp) { Object res; if (r instanceof Self) { return self; } else if (r instanceof TemporaryLocalVariable) { res = temp[((TemporaryLocalVariable)r).offset]; return res == null ? context.nil : res; } else if (r instanceof LocalVariable) { LocalVariable lv = (LocalVariable)r; res = currDynScope.getValue(lv.getLocation(), lv.getScopeDepth()); return res == null ? context.nil : res; } else { return r.retrieve(context, self, currScope, currDynScope, temp); } }
private static Object retrieveOp(Operand r, ThreadContext context, IRubyObject self, DynamicScope currDynScope, Object[] temp) { Object res; if (r instanceof Self) { return self; } else if (r instanceof TemporaryVariable) { res = temp[((TemporaryVariable)r).offset]; return res == null ? context.nil : res; } else if (r instanceof LocalVariable) { LocalVariable lv = (LocalVariable)r; res = currDynScope.getValue(lv.getLocation(), lv.getScopeDepth()); return res == null ? context.nil : res; } else { return r.retrieve(context, self, currDynScope, temp); } }
protected static Object retrieveOp(Operand r, ThreadContext context, IRubyObject self, DynamicScope currDynScope, StaticScope currScope, Object[] temp) { Object res; if (r instanceof Self) { return self; } else if (r instanceof TemporaryLocalVariable) { res = temp[((TemporaryLocalVariable)r).offset]; return res == null ? context.nil : res; } else if (r instanceof LocalVariable) { LocalVariable lv = (LocalVariable)r; res = currDynScope.getValue(lv.getLocation(), lv.getScopeDepth()); return res == null ? context.nil : res; } else { return r.retrieve(context, self, currScope, currDynScope, temp); } }
private static Object retrieveOp(Operand r, ThreadContext context, IRubyObject self, DynamicScope currDynScope, Object[] temp) { Object res; if (r instanceof Self) { return self; } else if (r instanceof TemporaryVariable) { res = temp[((TemporaryVariable)r).offset]; return res == null ? context.nil : res; } else if (r instanceof LocalVariable) { LocalVariable lv = (LocalVariable)r; res = currDynScope.getValue(lv.getLocation(), lv.getScopeDepth()); return res == null ? context.nil : res; } else { return r.retrieve(context, self, currDynScope, temp); } }
@Override public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) { // System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject result = context.getCurrentScope().getValue(getIndex(), getDepth()); return result == null ? runtime.getNil() : result; }
@Override public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) { // System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject obj = context.getCurrentScope().getValue(getIndex(), getDepth()); // FIXME: null check is removable once we figure out how to assign to unset named block args return obj == null ? runtime.getNil() : obj; }
@Override public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) { // System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject obj = context.getCurrentScope().getValue(getIndex(), getDepth()); // FIXME: null check is removable once we figure out how to assign to unset named block args return obj == null ? runtime.getNil() : obj; }
@Override public IRubyObject interpret(Ruby runtime, ThreadContext context, IRubyObject self, Block aBlock) { // System.out.println("DGetting: " + iVisited.getName() + " at index " + iVisited.getIndex() + " and at depth " + iVisited.getDepth()); IRubyObject result = context.getCurrentScope().getValue(getIndex(), getDepth()); return result == null ? runtime.getNil() : result; }