vm/instructions.rb
# [Operation]
#   Pushes a constant onto the stack. Caches the lookup to provide
#   faster future lookup
# [Format]
#   \push_const_fast symbol_index association_index
# [Stack Before]
#   * ...
# [Stack After]
#   * const
#   * ...
# [Description]
#   Locates the constant indicated by the literal +constant+ from the
#   current context, and pushes it onto the stack. If the constant cannot be
#   found in the current context, nothing is pushed onto the stack, and a
#   NameError exception is raised.
#
#   Internally, the constant is cached via the internal Association object
#   in the literals spot specified by the second arg. This allows for future
#   lookup to not require the full LookupTable resolution.
# [Example]
#   <code>
#     engine = RUBY_ENGINE # RUBY_ENGINE is a constant defined by Rubinius
#   </code>
[Operation]
Pushes a constant onto the stack. Caches the lookup to provide
faster future lookup
[Format]
\push_const_fast symbol_index association_index
[Stack Before]

[Stack After]
const

[Description]
Locates the constant indicated by the literal +constant+ from the
current context, and pushes it onto the stack. If the constant cannot be
found in the current context, nothing is pushed onto the stack, and a
NameError exception is raised.

Internally, the constant is cached via the internal Association object
in the literals spot specified by the second arg. This allows for future
lookup to not require the full LookupTable resolution.
[Example]

engine = RUBY_ENGINE # RUBY_ENGINE is a constant defined by Rubinius
[ Operation ] Pushes a constant onto the stack . Caches the lookup to provide faster future lookup [ Format ] \ push_const_fast symbol_index association_index [ Stack Before ] [ Stack After ] const [ Description ] Locates the constant indicated by the literal + constant + from the current context and pushes it onto the stack . If the constant cannot be found in the current context nothing is pushed onto the stack and a NameError exception is raised . Internally the constant is cached via the internal Association object in the literals spot specified by the second arg . This allows for future lookup to not require the full LookupTable resolution . [ Example ] engine = RUBY_ENGINE # RUBY_ENGINE is a constant defined by Rubinius
def push_const_fast(symbol_index, association_index)
    <<-CODE
    bool found;
    Object* res = 0;
    Object* assoc = call_frame->cm->literals()->at(state, association_index);
    // The association has been set, return the value from it directly.
    if(!assoc->nil_p()) {
      LookupTableAssociation* real_assoc = as<LookupTableAssociation>(assoc);
      if(real_assoc->active() != Qfalse) {
        res = real_assoc->value();
      }
    }
    if(!res) {
      Symbol* sym = as<Symbol>(call_frame->cm->literals()->at(state, symbol_index));
      LookupTableAssociation* assoc = Helpers::const_get_association(state, call_frame, sym, &found);
      if(found) {
        call_frame->cm->literals()->put(state, association_index, assoc);
        res = assoc->value();
      } else {
        Module* under;
        StaticScope* scope = call_frame->static_scope;
        if(scope->nil_p()) {
          under = G(object);
        } else {
          under = scope->module();
        }
        res = Helpers::const_missing(state, under, sym, call_frame);
      }
    }
    HANDLE_EXCEPTION(res);
    if(Autoload* autoload = try_as<Autoload>(res)) {
      res = autoload->resolve(state, call_frame);
    }
    HANDLE_EXCEPTION(res);
    stack_push(res);
    CODE
  end
def push_const_fast ( symbol_index , association_index ) <<-CODE 
    bool found;
    Object* res = 0;

    Object* assoc = call_frame->cm->literals()->at(state, association_index);
    // The association has been set, return the value from it directly.
    if(!assoc->nil_p()) {
      LookupTableAssociation* real_assoc = as<LookupTableAssociation>(assoc);
      if(real_assoc->active() != Qfalse) {
        res = real_assoc->value();
      }
    }

    if(!res) {
      Symbol* sym = as<Symbol>(call_frame->cm->literals()->at(state, symbol_index));
      LookupTableAssociation* assoc = Helpers::const_get_association(state, call_frame, sym, &found);
      if(found) {
        call_frame->cm->literals()->put(state, association_index, assoc);
        res = assoc->value();
      } else {
        Module* under;
        StaticScope* scope = call_frame->static_scope;
        if(scope->nil_p()) {
          under = G(object);
        } else {
          under = scope->module();
        }
        res = Helpers::const_missing(state, under, sym, call_frame);
      }
    }

    HANDLE_EXCEPTION(res);

    if(Autoload* autoload = try_as<Autoload>(res)) {
      res = autoload->resolve(state, call_frame);
    }

    HANDLE_EXCEPTION(res);

    stack_push(res);
     CODE end
[Operation]
Pushes a constant onto the stack.
[ Operation ] Pushes a constant onto the stack .
symbol_index
<not_specific>
association_index
<not_specific>