mirror of
https://git.savannah.gnu.org/git/guile.git
synced 2025-05-18 18:40:22 +02:00
Fixed the compiler, got the disassembler working.
* doc/guile-vm.texi: Texified and cleaned up. * src/vm.c: Use `scm_from_locale_string ()' instead of `scm_makfrom0str ()'. * src/vm_engine.c: Likewise. * src/programs.c (scm_program_bytecode): Return a u8vector instead of a string. * module/system/vm/conv.scm (make-byte-decoder): Fixed a few things wrt. to the string to u8vector transition. * src/objcodes.c (bytecode->objcode): Fixed a bug where the last 10 bytes of the bytecode where ignored. * module/system/vm/assemble.scm (dump-object!): Don't convert everything to a u8vector, keep strings where it makes sense. * module/system/vm/conv.scm (code->bytes): Accordingly, convert strings to u8vectors when needed. (make-byte-decoder): Accordingly too, when decoding instructions, return variable-length instructions' argument as strings except for `load-program'. * module/system/vm/disasm.scm: Export `disassemble-bytecode'. git-archimport-id: lcourtes@laas.fr--2004-libre/guile-vm--revival--0.6--patch-4
This commit is contained in:
parent
054599f117
commit
fa19602c28
9 changed files with 223 additions and 135 deletions
|
@ -188,15 +188,26 @@ SCM_DEFINE (scm_program_external, "program-external", 1, 0, 0,
|
|||
|
||||
SCM_DEFINE (scm_program_bytecode, "program-bytecode", 1, 0, 0,
|
||||
(SCM program),
|
||||
"")
|
||||
"Return a u8vector containing @var{program}'s bytecode.")
|
||||
#define FUNC_NAME s_scm_program_bytecode
|
||||
{
|
||||
size_t size;
|
||||
char *c_bytecode;
|
||||
|
||||
SCM_VALIDATE_PROGRAM (1, program);
|
||||
return scm_makfromstr (SCM_PROGRAM_DATA (program)->base,
|
||||
SCM_PROGRAM_DATA (program)->size, 0);
|
||||
|
||||
size = SCM_PROGRAM_DATA (program)->size;
|
||||
c_bytecode = malloc (size);
|
||||
if (!c_bytecode)
|
||||
return SCM_BOOL_F;
|
||||
|
||||
memcpy (c_bytecode, SCM_PROGRAM_DATA (program)->base, size);
|
||||
|
||||
return scm_take_u8vector (c_bytecode, size);
|
||||
}
|
||||
#undef FUNC_NAME
|
||||
|
||||
|
||||
|
||||
void
|
||||
scm_init_programs (void)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue