Skip to content

Instantly share code, notes, and snippets.

View methodmissing's full-sized avatar

Lourens Naudé methodmissing

View GitHub Profile
typedef unsigned long rb_value_t;
typedef unsigned long rb_id_t;
typedef unsigned long st_data_t;
struct st_table_entry {
unsigned int hash;
st_data_t key;
st_data_t record;
caddr_t next;
};
pid$target::st_lookup:entry {
self->arg2 = arg2;
printf("\nKey %d, value %d\n", arg1, *(uint32_t *)copyin(self->arg2, 4));
}
require 'rubygems'
require 'ffi'
module Aio
extend FFI::Library
READ_CALLBACK = Proc.new do |sigval|
req = sigval.sival_ptr
if aio_error( req ) == 0
ret = aio_return( req );
Sampling process 3522 for 3 seconds with 1 millisecond of run time between samples
Sampling completed, processing symbols...
Analysis of sampling ruby (pid 3522) every 1 millisecond
Call graph:
2185 Thread_2507
2185 start
2185 main
2185 ruby_run_node
2185 ruby_exec_node
2185 rb_iseq_eval_main
void
rb_include_module(klass, module)
VALUE klass, module;
{
VALUE p, c;
int changed = 0;
rb_frozen_class_p(klass);
if (!OBJ_TAINTED(klass)) {
rb_secure(4);
VALUE
rb_hash_aref(hash, key)
VALUE hash, key;
{
VALUE val;
if (!st_lookup(RHASH(hash)->tbl, key, &val)) {
return rb_funcall(hash, id_default, 1, key);
}
return val;
/* This is a public domain general purpose hash table package written by Peter Moore @ UCB. */
/* @(#) st.h 5.1 89/12/14 */
#ifndef RUBY_ST_H
#define RUBY_ST_H 1
#if defined(__cplusplus)
extern "C" {
#if 0
/* This is a public domain general purpose hash table package written by Peter Moore @ UCB. */
/* @(#) st.h 5.1 89/12/14 */
#ifndef ST_INCLUDED
#define ST_INCLUDED
#if SIZEOF_LONG == SIZEOF_VOIDP
typedef unsigned long st_data_t;
static void
gc_mark(ptr, lev)
VALUE ptr;
int lev;
{
register RVALUE *obj;
obj = RANY(ptr);
if (rb_special_const_p(ptr)) return; /* special const not marked */
if (obj->as.basic.flags == 0) return; /* free cell */
VALUE
rb_str_buf_new(capa)
long capa;
{
VALUE str = str_alloc(rb_cString);
if (capa < STR_BUF_MIN_SIZE) {
capa = STR_BUF_MIN_SIZE;
}
RSTRING(str)->ptr = 0;