summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndy Wingo <wingo@pobox.com>2018-04-10 18:27:08 +0200
committerAndy Wingo <wingo@pobox.com>2018-04-10 18:32:31 +0200
commit954bfad26288f65e4a00a2ab886bd6cdd0fdc743 (patch)
tree3b5ec6a89645fda562899b1d6835af440781c8cb
parentd1ed64d9003caa35af2c494da0bc201dddabb1f7 (diff)
Class-of is intrinsic
* libguile/vm-engine.c (class-of): Disable. * module/language/cps/reify-primitives.scm (compute-known-primitives): Add class-of as macro-instruction. * libguile/intrinsics.c (scm_bootstrap_intrinsics): Add class-of. * libguile/intrinsics.h (SCM_FOR_ALL_VM_INTRINSICS): Add class-of. * module/system/vm/assembler.scm (class-of): Define as intrinsic.
-rw-r--r--libguile/intrinsics.c1
-rw-r--r--libguile/intrinsics.h1
-rw-r--r--libguile/vm-engine.c10
-rw-r--r--module/language/cps/reify-primitives.scm1
-rw-r--r--module/system/vm/assembler.scm3
5 files changed, 6 insertions, 10 deletions
diff --git a/libguile/intrinsics.c b/libguile/intrinsics.c
index b974ce177..8bb99472e 100644
--- a/libguile/intrinsics.c
+++ b/libguile/intrinsics.c
@@ -90,6 +90,7 @@ scm_bootstrap_intrinsics (void)
scm_vm_intrinsics.string_to_number = string_to_number;
scm_vm_intrinsics.string_to_symbol = scm_string_to_symbol;
scm_vm_intrinsics.symbol_to_keyword = scm_symbol_to_keyword;
+ scm_vm_intrinsics.class_of = scm_class_of;
scm_c_register_extension ("libguile-" SCM_EFFECTIVE_VERSION,
"scm_init_intrinsics",
diff --git a/libguile/intrinsics.h b/libguile/intrinsics.h
index b9cc8e4d3..a70669a92 100644
--- a/libguile/intrinsics.h
+++ b/libguile/intrinsics.h
@@ -45,6 +45,7 @@ typedef SCM (*scm_t_scm_from_scm_intrinsic) (SCM);
M(scm_from_scm, string_to_number, "string->number", STRING_TO_NUMBER) \
M(scm_from_scm, string_to_symbol, "string->symbol", STRING_TO_SYMBOL) \
M(scm_from_scm, symbol_to_keyword, "symbol->keyword", SYMBOL_TO_KEYWORD) \
+ M(scm_from_scm, class_of, "class-of", CLASS_OF) \
/* Add new intrinsics here; also update scm_bootstrap_intrinsics. */
enum scm_vm_intrinsic
diff --git a/libguile/vm-engine.c b/libguile/vm-engine.c
index e4a72e4a7..59ed35751 100644
--- a/libguile/vm-engine.c
+++ b/libguile/vm-engine.c
@@ -2196,15 +2196,7 @@ VM_NAME (scm_i_thread *thread, struct scm_vm *vp,
abort (); /* never reached */
}
-
-
-
-
- /* class-of dst:12 type:12
- *
- * Store the vtable of SRC into DST.
- */
- VM_DEFINE_OP (113, class_of, "class-of", OP1 (X8_S12_S12) | OP_DST)
+ VM_DEFINE_OP (113, unused_113, NULL, NOP)
{
ARGS1 (obj);
/* FIXME: restore fast path for direct instances. */
diff --git a/module/language/cps/reify-primitives.scm b/module/language/cps/reify-primitives.scm
index 057b3bfcb..6f09024af 100644
--- a/module/language/cps/reify-primitives.scm
+++ b/module/language/cps/reify-primitives.scm
@@ -216,6 +216,7 @@
string->number
string->symbol
symbol->keyword
+ class-of
u64->s64
s64->u64
cache-current-module!
diff --git a/module/system/vm/assembler.scm b/module/system/vm/assembler.scm
index 08e0366d0..f1c2db220 100644
--- a/module/system/vm/assembler.scm
+++ b/module/system/vm/assembler.scm
@@ -199,6 +199,7 @@
emit-string->number
emit-string->symbol
emit-symbol->keyword
+ emit-class-of
emit-call
emit-call-label
@@ -259,7 +260,6 @@
emit-ursh/immediate
emit-srsh/immediate
emit-ulsh/immediate
- emit-class-of
emit-make-array
emit-scm->f64
emit-load-f64
@@ -1311,6 +1311,7 @@ returned instead."
(define-scm<-scm-intrinsic string->number)
(define-scm<-scm-intrinsic string->symbol)
(define-scm<-scm-intrinsic symbol->keyword)
+(define-scm<-scm-intrinsic class-of)
(define-macro-assembler (begin-program asm label properties)
(emit-label asm label)