Skip to content

Instantly share code, notes, and snippets.

View tenderlove's full-sized avatar
©️
 ​[object Object] :trollface:

Aaron Patterson tenderlove

©️
 ​[object Object] :trollface:
View GitHub Profile
# extract dead objects from the heap
require 'json'
require 'set'
class Slot
attr_reader :info, :address_to_slot
def initialize info, address_to_slot
@info = info
require 'ds9'
require 'socket'
require 'uri'
require 'google/protobuf'
require 'io/wait'
require 'helloworld_pb'
class MySession < DS9::Client
def initialize sock
@sock = sock
require 'uart'
require 'io/wait'
class Sample < Struct.new(:time,
:pm1_0_standard, :pm2_5_standard, :pm10_standard,
:pm1_0_env, :pm2_5_env,
:concentration_unit,
:particle_03um, :particle_05um, :particle_10um,
:particle_25um, :particle_50um, :particle_100um)
end
#!/Users/aaron/.rbenv/versions/ruby-trunk/bin/ruby
require 'benchmark/ips'
require './lib/track_obj'
if ARGV[0] == "--trace"
tp = TrackObj.make_tp
tp.enable
end
cons = lambda { |a, b|
lambda { |m| m.call(a, b) }
}
car = lambda { |m| m.call(lambda { |a, _| a }) }
cdr = lambda { |m| m.call(lambda { |_, b| b }) }
# A list that only uses lambdas
list = cons.call(1, cons.call(2, cons.call(3, nil)))
def foo ;
puts ;
end
foo "hello"
def foo  
puts  
end
foo "hello"
diff --git a/compile.c b/compile.c
index 5415d684a6..5d37c730ef 100644
--- a/compile.c
+++ b/compile.c
@@ -1596,6 +1596,9 @@ iseq_set_arguments_keywords(rb_iseq_t *iseq, LINK_ANCHOR *const optargs,
for (i = 0; i < RARRAY_LEN(default_values); i++) {
VALUE dv = RARRAY_AREF(default_values, i);
if (dv == complex_mark) dv = Qundef;
+ if (!SPECIAL_CONST_P(dv)) {
+ RB_OBJ_WRITTEN(iseq, Qundef, dv);
diff --git a/compile.c b/compile.c
index 5415d684a6..666c679328 100644
--- a/compile.c
+++ b/compile.c
@@ -1596,6 +1596,9 @@ iseq_set_arguments_keywords(rb_iseq_t *iseq, LINK_ANCHOR *const optargs,
for (i = 0; i < RARRAY_LEN(default_values); i++) {
VALUE dv = RARRAY_AREF(default_values, i);
if (dv == complex_mark) dv = Qundef;
+ if (!SPECIAL_CONST_P(dv)) {
+ RB_OBJ_WRITTEN(iseq, Qundef, dv);