(flo:flonum? obj)
(symbol? obj)
(string? obj)
+ (bytevector? obj)
(bit-string? obj)
(scode/primitive-procedure? obj)
;; The runtime system needs the following
(bit-string->unsigned-integer obj)
16))))
(build/push-nat (bit-string-length obj) prog)))
+ ((bytevector? obj)
+ (build/string stackify-opcode/push-bytevector
+ (let ((string
+ (make-vector-8b (bytevector-length obj))))
+ (do ((i 0 (+ i 1)))
+ ((>= i (bytevector-length obj)))
+ (vector-8b-set! string i (bytevector-u8-ref obj i)))
+ string)
+ prog))
((scode/primitive-procedure? obj)
(let ((arity (primitive-procedure-arity obj))
(name (symbol->string (primitive-procedure-name obj))))
push-primitive-6 ; name in string table
push-primitive-7 ; name in string table
;; 8
+
+push-bytevector ; in string table
)
\f
(define stackify/fast-fixnum-opcodes
#define C_STRING_TO_SCHEME_STRING(len, str) \
(MEMORY_TO_STRING ((len), ((const uint8_t *) (str))))
+#define C_STRING_TO_SCHEME_BYTEVECTOR(len, str) \
+ (MEMORY_TO_BYTEVECTOR ((len), ((const uint8_t *) (str))))
+
#define C_SYM_INTERN(len, str) \
(MEMORY_TO_SYMBOL ((len), ((const uint8_t *) (str))))
#define MAKE_PRIMITIVE(str, arity) \
(make_primitive (((const char *) (str)), ((int) (arity))))
+#define MEMORY_TO_BYTEVECTOR memory_to_bytevector
#define MEMORY_TO_STRING memory_to_string
#define MEMORY_TO_SYMBOL memory_to_symbol
#define MAKE_VECTOR make_vector
stackify_opcode_push_primitive_5 = 0305,
stackify_opcode_push_primitive_6 = 0306,
stackify_opcode_push_primitive_7 = 0307,
- N_STACKIFY_OPCODE = 0310
+ stackify_opcode_push_bytevector = 0310,
+ N_STACKIFY_OPCODE = 0311
} stackify_opcode_t;
#endif /* !STACKOPS_H */
"stackify-opcode/push-primitive-5",
"stackify-opcode/push-primitive-6",
"stackify-opcode/push-primitive-7",
- "unknown-0310",
+ "stackify-opcode/push-bytevector",
"unknown-0311",
"unknown-0312",
"unknown-0313",
unstackify_push (C_STRING_TO_SCHEME_STRING (len, str));
}
+static void
+stackify_push_bytevector (stackify_opcode_t op)
+{
+ unsigned long len;
+ char * str = (unstackify_read_string (&len));
+ unstackify_push (C_STRING_TO_SCHEME_BYTEVECTOR (len, str));
+}
+
static void
stackify_push_symbol (stackify_opcode_t op)
{
stackify_push_string (op);
break;
+ case stackify_opcode_push_bytevector:
+ stackify_push_bytevector (op);
+ break;
+
case stackify_opcode_push_symbol:
stackify_push_symbol (op);
break;