static sexp sexp_object_size (sexp ctx, sexp self, sexp_sint_t n, sexp x) { sexp t; if ((! sexp_pointerp(x)) || (sexp_pointer_tag(x) >= sexp_context_num_types(ctx))) return SEXP_ZERO; t = sexp_object_type(ctx, x); return sexp_make_fixnum(sexp_type_size_of_object(t, x)); }
static sexp sexp_get_opcode_data (sexp ctx, sexp self, sexp_sint_t n, sexp op) { sexp data; sexp_assert_type(ctx, sexp_opcodep, SEXP_OPCODE, op); data = sexp_opcode_data(op); if (!data) return SEXP_VOID; return sexp_opcode_class(op) == SEXP_OPC_TYPE_PREDICATE && 0 <= sexp_unbox_fixnum(data) && sexp_unbox_fixnum(data) <= sexp_context_num_types(ctx) ? sexp_type_by_index(ctx, sexp_unbox_fixnum(data)) : data; }
sexp_uint_t sexp_allocated_bytes (sexp ctx, sexp x) { sexp_uint_t res; sexp t; if (!sexp_pointerp(x) || (sexp_pointer_tag(x) >= sexp_context_num_types(ctx))) return sexp_heap_align(1); t = sexp_object_type(ctx, x); res = sexp_type_size_of_object(t, x) + SEXP_GC_PAD; #if SEXP_USE_DEBUG_GC if (res == 0) { fprintf(stderr, SEXP_BANNER("%p zero-size object: %p"), ctx, x); return 1; } #endif return res; }