]> gitweb.factorcode.org Git - factor.git/commitdiff
record the C++ compiler version in the VM, and expose it with a vm-compiler word
authorJoe Groff <arcata@gmail.com>
Mon, 1 Mar 2010 21:32:07 +0000 (13:32 -0800)
committerJoe Groff <arcata@gmail.com>
Mon, 1 Mar 2010 21:32:07 +0000 (13:32 -0800)
core/alien/strings/strings.factor
core/system/system.factor
vm/factor.cpp
vm/master.hpp
vm/objects.hpp

index 0ad4f6c85ad3db2498190977cc8a6699150adfb8..435ceb2a96b470419f0625f0c25f3844dd9013f7 100644 (file)
@@ -66,6 +66,7 @@ M: string string>symbol string>symbol* ;
 M: sequence string>symbol [ string>symbol* ] map ;
 
 [
-    8 special-object utf8 alien>string string>cpu \ cpu set-global
-    9 special-object utf8 alien>string string>os \ os set-global
+     8 special-object utf8 alien>string string>cpu \ cpu set-global
+     9 special-object utf8 alien>string string>os \ os set-global
+    67 special-object utf8 alien>string \ vm-compiler set-global
 ] "alien.strings" add-startup-hook
index 715564c64dcf8c91cd8bd965890fb1ec2549b09a..765861c62f3790e8f0632164f5b72f749624cfa8 100644 (file)
@@ -24,6 +24,8 @@ UNION: unix bsd solaris linux haiku ;
 
 : os ( -- class ) \ os get-global ; foldable
 
+: vm-compiler ( -- string ) \ vm-compiler get-global ; foldable
+
 <PRIVATE
 
 : string>cpu ( str -- class )
index fb14336ae41ffd8266a7cf963ead858fc1b62e49..4433095173b74b54c949a9fa3cd5e48de2afc481 100755 (executable)
@@ -136,6 +136,7 @@ void factor_vm::init_factor(vm_parameters *p)
        special_objects[OBJ_EXECUTABLE] = allot_alien(false_object,(cell)p->executable_path);
        special_objects[OBJ_ARGS] = false_object;
        special_objects[OBJ_EMBEDDED] = false_object;
+       special_objects[OBJ_VM_COMPILER] = allot_alien(false_object,(cell)FACTOR_COMPILER_VERSION);
 
        /* We can GC now */
        gc_off = false;
index 70736c1bd9d127dbe26c29b5bf7b75a885dd848b..9ba4ebd64b0166ac02ed9b5b29affef782b2498c 100755 (executable)
 #include <vector>
 #include <iostream>
 
+/* Record compiler version */
+#if defined(__clang__)
+       #define FACTOR_COMPILER_VERSION "Clang (GCC " __VERSION__ ")"
+#elif defined(__INTEL_COMPILER)
+       #define FACTOR_COMPILER_VERSION "Intel C Compiler " #__INTEL_COMPILER
+#elif defined(__GNUC__)
+       #define FACTOR_COMPILER_VERSION "GCC " __VERSION__
+#elif defined(_MSC_FULL_VER)
+       #define FACTOR_COMPILER_VERSION "Microsoft Visual C++ " #_MSC_FULL_VER
+#else
+       #define FACTOR_COMPILER_VERSION "unknown"
+#endif
+
 /* Detect target CPU type */
 #if defined(__arm__)
        #define FACTOR_ARM
index fdc5758a8d2159bb6730307c764f2bc7ff8f6202..2d777ac5165454788600daafad79b11779f55f18 100644 (file)
@@ -95,6 +95,8 @@ enum special_object {
        OBJ_THREADS = 64,
        OBJ_RUN_QUEUE = 65,
        OBJ_SLEEP_QUEUE = 66,
+
+       OBJ_VM_COMPILER = 67,    /* version string of the compiler we were built with */
 };
 
 /* save-image-and-exit discards special objects that are filled in on startup