mirror of
https://github.com/justinethier/cyclone.git
synced 2025-05-22 07:09:17 +02:00
Temporarily disable using immediate ints
Also bugfix to let equal() work with immediates
This commit is contained in:
parent
750bd80619
commit
580a674525
2 changed files with 18 additions and 8 deletions
16
runtime.c
16
runtime.c
|
@ -414,11 +414,15 @@ int equal(x, y) object x, y;
|
|||
if (nullp(x)) return nullp(y);
|
||||
if (nullp(y)) return nullp(x);
|
||||
if (obj_is_char(x)) return obj_is_char(y) && x == y;
|
||||
if (obj_is_int(x)) return obj_is_int(y) && x == y;
|
||||
if (obj_is_int(x)) return (obj_is_int(y) && x == y) ||
|
||||
(is_object_type(y) &&
|
||||
type_of(y) == integer_tag &&
|
||||
integer_value(y) == obj_obj2int(x));
|
||||
switch(type_of(x)) {
|
||||
case integer_tag:
|
||||
return (obj_is_int(y) && obj_obj2int(y) == integer_value(x)) ||
|
||||
(type_of(y) == integer_tag &&
|
||||
(is_object_type(y) &&
|
||||
type_of(y) == integer_tag &&
|
||||
((integer_type *) x)->value == ((integer_type *) y)->value);
|
||||
case double_tag:
|
||||
return (is_object_type(y) &&
|
||||
|
@ -1529,10 +1533,10 @@ object Cyc_num_op_va_list(void *data, int argc, object (fn_op(void *, common_typ
|
|||
fn_op(data, buf, va_arg(ns, object));
|
||||
}
|
||||
|
||||
// TODO: if result is integer, could convert to an immediate here
|
||||
if (type_of(buf) == integer_tag) {
|
||||
return obj_int2obj(buf->integer_t.value);
|
||||
}
|
||||
// // TODO: if result is integer, could convert to an immediate here
|
||||
// if (type_of(buf) == integer_tag) {
|
||||
// return obj_int2obj(buf->integer_t.value);
|
||||
// }
|
||||
|
||||
return buf;
|
||||
}
|
||||
|
|
|
@ -405,8 +405,14 @@
|
|||
((vector? exp)
|
||||
(c-compile-vector exp))
|
||||
((integer? exp)
|
||||
(c-code (string-append "obj_int2obj("
|
||||
(number->string exp) ")")))
|
||||
(let ((cvar-name (mangle (gensym 'c))))
|
||||
(c-code/vars
|
||||
(string-append "&" cvar-name) ; Code is just the variable name
|
||||
(list ; Allocate integer on the C stack
|
||||
(string-append
|
||||
"make_int(" cvar-name ", " (number->string exp) ");")))))
|
||||
; (c-code (string-append "obj_int2obj("
|
||||
; (number->string exp) ")")))
|
||||
((real? exp)
|
||||
(let ((cvar-name (mangle (gensym 'c))))
|
||||
(c-code/vars
|
||||
|
|
Loading…
Add table
Reference in a new issue