Skip to content

Instantly share code, notes, and snippets.

@bakkdoor
Created December 15, 2010 00:08
Show Gist options
  • Save bakkdoor/741389 to your computer and use it in GitHub Desktop.
Save bakkdoor/741389 to your computer and use it in GitHub Desktop.
rubinius push_const_fast instruction
# [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>
bakkdoor:~/projekte/fancy/fancy-lang[master*]> fancy -cv lib/rbx.fy
Compiling lib/rbx.fy
============= :__script__ ==============
Arguments: 0 required, 0 total
Locals: 0
Stack size: 2
Lines to IP: 8: 0-11, 9: 12-23, 10: 24-35, 11: 36-47, 12: 48-59, 13: 60-71, 14: 72-83, 15: 84-95, 16: 96-107, 17: 108-119, 18: 120-131, 19: 132-143, 20: 144-155, 21: 156-167, 22: 168-179, 23: 180-191, 24: 192-203, 25: 204-215, 26: 216-227, 27: 228-239, 28: 240-251, 29: 252-263, 30: 264-275, 31: 276-287, 32: 288-299, 33: 300-311, 34: 312-325
0000: push_const_fast :Fancy, 1
0003: find_const 2
0005: push_literal "rbx/documentation"
0007: string_dup
0008: send_stack :"require:", 1
0011: pop
0012: push_const_fast :Fancy, 5
0015: find_const 2
0017: push_literal "rbx/object"
0019: string_dup
0020: send_stack :"require:", 1
0023: pop
0024: push_const_fast :Fancy, 7
0027: find_const 2
0029: push_literal "rbx/class"
0031: string_dup
0032: send_stack :"require:", 1
0035: pop
0036: push_const_fast :Fancy, 9
0039: find_const 2
0041: push_literal "rbx/console"
0043: string_dup
0044: send_stack :"require:", 1
0047: pop
0048: push_const_fast :Fancy, 11
0051: find_const 2
0053: push_literal "rbx/array"
0055: string_dup
0056: send_stack :"require:", 1
0059: pop
0060: push_const_fast :Fancy, 13
0063: find_const 2
0065: push_literal "rbx/hash"
0067: string_dup
0068: send_stack :"require:", 1
0071: pop
0072: push_const_fast :Fancy, 15
0075: find_const 2
0077: push_literal "rbx/false_class"
0079: string_dup
0080: send_stack :"require:", 1
0083: pop
0084: push_const_fast :Fancy, 17
0087: find_const 2
0089: push_literal "rbx/string"
0091: string_dup
0092: send_stack :"require:", 1
0095: pop
0096: push_const_fast :Fancy, 19
0099: find_const 2
0101: push_literal "rbx/symbol"
0103: string_dup
0104: send_stack :"require:", 1
0107: pop
0108: push_const_fast :Fancy, 21
0111: find_const 2
0113: push_literal "rbx/fixnum"
0115: string_dup
0116: send_stack :"require:", 1
0119: pop
0120: push_const_fast :Fancy, 23
0123: find_const 2
0125: push_literal "rbx/float"
0127: string_dup
0128: send_stack :"require:", 1
0131: pop
0132: push_const_fast :Fancy, 25
0135: find_const 2
0137: push_literal "rbx/bignum"
0139: string_dup
0140: send_stack :"require:", 1
0143: pop
0144: push_const_fast :Fancy, 27
0147: find_const 2
0149: push_literal "rbx/block"
0151: string_dup
0152: send_stack :"require:", 1
0155: pop
0156: push_const_fast :Fancy, 29
0159: find_const 2
0161: push_literal "rbx/tuple"
0163: string_dup
0164: send_stack :"require:", 1
0167: pop
0168: push_const_fast :Fancy, 31
0171: find_const 2
0173: push_literal "rbx/range"
0175: string_dup
0176: send_stack :"require:", 1
0179: pop
0180: push_const_fast :Fancy, 33
0183: find_const 2
0185: push_literal "rbx/system"
0187: string_dup
0188: send_stack :"require:", 1
0191: pop
0192: push_const_fast :Fancy, 35
0195: find_const 2
0197: push_literal "rbx/exception"
0199: string_dup
0200: send_stack :"require:", 1
0203: pop
0204: push_const_fast :Fancy, 37
0207: find_const 2
0209: push_literal "rbx/io"
0211: string_dup
0212: send_stack :"require:", 1
0215: pop
0216: push_const_fast :Fancy, 39
0219: find_const 2
0221: push_literal "rbx/file"
0223: string_dup
0224: send_stack :"require:", 1
0227: pop
0228: push_const_fast :Fancy, 41
0231: find_const 2
0233: push_literal "rbx/tcp_server"
0235: string_dup
0236: send_stack :"require:", 1
0239: pop
0240: push_const_fast :Fancy, 43
0243: find_const 2
0245: push_literal "rbx/tcp_socket"
0247: string_dup
0248: send_stack :"require:", 1
0251: pop
0252: push_const_fast :Fancy, 45
0255: find_const 2
0257: push_literal "rbx/regexp"
0259: string_dup
0260: send_stack :"require:", 1
0263: pop
0264: push_const_fast :Fancy, 47
0267: find_const 2
0269: push_literal "rbx/directory"
0271: string_dup
0272: send_stack :"require:", 1
0275: pop
0276: push_const_fast :Fancy, 49
0279: find_const 2
0281: push_literal "rbx/method"
0283: string_dup
0284: send_stack :"require:", 1
0287: pop
0288: push_const_fast :Fancy, 51
0291: find_const 2
0293: push_literal "rbx/environment_variables"
0295: string_dup
0296: send_stack :"require:", 1
0299: pop
0300: push_const_fast :Fancy, 53
0303: find_const 2
0305: push_literal "rbx/name_error"
0307: string_dup
0308: send_stack :"require:", 1
0311: pop
0312: push_const_fast :Fancy, 55
0315: find_const 2
0317: push_literal "rbx/no_method_error"
0319: string_dup
0320: send_stack :"require:", 1
0323: pop
0324: push_true
0325: ret
----------------------------------------
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment