record the C++ compiler version in the VM, and expose it with a vm-compiler word
parent
2c5deba1d1
commit
ac979619e6
|
@ -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
|
||||
|
|
|
@ -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 )
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -29,6 +29,19 @@
|
|||
#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
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue