Skip to content

Instantly share code, notes, and snippets.

@palkan
Created June 28, 2020 08:01
Show Gist options
  • Save palkan/dcab4ed0978dfe6f55f9b6533d3e80a9 to your computer and use it in GitHub Desktop.
Save palkan/dcab4ed0978dfe6f55f9b6533d3e80a9 to your computer and use it in GitHub Desktop.
compile.c ADD_STACKPRINT
#define ADD_STACKPRINT(label, depth) do {\
ADD_INSN1(ret, line, putobject, rb_fstring_lit(label));\
ADD_SEND(ret, line, rb_intern("putme"), INT2FIX(0));\
ADD_INSN(ret, line, pop);\
for (int x = 0; x < depth ; x++ ){\
ADD_INSN1(ret, line, topn, INT2FIX(x));\
ADD_SEND(ret, line, rb_intern("putme"), INT2FIX(0));\
ADD_INSN(ret, line, pop);\
}\
} while(0)
module Kernel
def putme(val = self)
p val
end
end
# some code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment