mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-01 12:20:26 +02:00
bytevectors have internal parent field
* libguile/bytevectors.h (SCM_BYTEVECTOR_HEADER_SIZE): Bump, giving bytevectors another word: a parent pointer. Will allow for sub-bytevectors and efficient mmap bindings. * libguile/bytevectors.c (make_bytevector): (make_bytevector_from_buffer): Init parent to #f. (scm_c_take_bytevector, scm_c_take_typed_bytevector): Another argument, the parent, which gets set in the bytevector. * libguile/foreign.c (scm_pointer_to_bytevector): Use the parent field instead of registering a weak reference from bytevector to foreign pointer. * libguile/objcodes.c (scm_objcode_to_bytecode): Use the parent field to avoid copying the objcode. * libguile/srfi-4.c (DEFINE_SRFI_4_C_FUNCS): * libguile/strings.c (scm_from_stringn): * libguile/vm.c (really_make_boot_program): * libguile/r6rs-ports.c (scm_get_bytevector_some) (scm_get_bytevector_all, bytevector_output_port_procedure): Set the parent to #f.
This commit is contained in:
parent
5eb75b5de0
commit
059a588fed
8 changed files with 45 additions and 25 deletions
|
@ -308,17 +308,14 @@ SCM_DEFINE (scm_objcode_to_bytecode, "objcode->bytecode", 1, 0, 0,
|
|||
"")
|
||||
#define FUNC_NAME s_scm_objcode_to_bytecode
|
||||
{
|
||||
scm_t_int8 *s8vector;
|
||||
scm_t_uint32 len;
|
||||
|
||||
SCM_VALIDATE_OBJCODE (1, objcode);
|
||||
|
||||
len = sizeof (struct scm_objcode) + SCM_OBJCODE_TOTAL_LEN (objcode);
|
||||
|
||||
s8vector = scm_malloc (len);
|
||||
memcpy (s8vector, SCM_OBJCODE_DATA (objcode), len);
|
||||
|
||||
return scm_c_take_bytevector (s8vector, len);
|
||||
return scm_c_take_bytevector ((scm_t_int8*)SCM_OBJCODE_DATA (objcode),
|
||||
len, objcode);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue