Skip to content
Snippets Groups Projects
Commit 580981cf authored by Henrik (Grubba) Grubbström's avatar Henrik (Grubba) Grubbström
Browse files

Added Pike.get_runtime_info().

Rev: lib/modules/Pike.pmod/module.pmod:1.13
Rev: src/builtin.cmod:1.184
parent 9d618808
Branches
Tags
No related merge requests found
...@@ -3,7 +3,7 @@ ...@@ -3,7 +3,7 @@
// Pike core things that don't belong anywhere else. // Pike core things that don't belong anywhere else.
// //
// $Id: module.pmod,v 1.12 2004/10/30 11:39:21 mast Exp $ // $Id: module.pmod,v 1.13 2006/03/25 20:43:20 grubba Exp $
constant WEAK_INDICES = __builtin.PIKE_WEAK_INDICES; constant WEAK_INDICES = __builtin.PIKE_WEAK_INDICES;
constant WEAK_VALUES = __builtin.PIKE_WEAK_VALUES; constant WEAK_VALUES = __builtin.PIKE_WEAK_VALUES;
...@@ -40,6 +40,8 @@ constant DefaultBackend = __builtin.__backend; ...@@ -40,6 +40,8 @@ constant DefaultBackend = __builtin.__backend;
constant gc_parameters = __builtin.gc_parameters; constant gc_parameters = __builtin.gc_parameters;
constant get_runtime_info = __builtin.get_runtime_info;
program Encoder = [program] master()->Encoder; program Encoder = [program] master()->Encoder;
program Decoder = [program] master()->Decoder; program Decoder = [program] master()->Decoder;
program Codec = [program] master()->Codec; program Codec = [program] master()->Codec;
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
|| This file is part of Pike. For copyright information see COPYRIGHT. || This file is part of Pike. For copyright information see COPYRIGHT.
|| Pike is distributed under GPL, LGPL and MPL. See the file COPYING || Pike is distributed under GPL, LGPL and MPL. See the file COPYING
|| for more information. || for more information.
|| $Id: builtin.cmod,v 1.183 2006/03/22 20:00:10 grubba Exp $ || $Id: builtin.cmod,v 1.184 2006/03/25 20:40:52 grubba Exp $
*/ */
#include "global.h" #include "global.h"
...@@ -1492,6 +1492,69 @@ PIKECLASS backtrace_frame ...@@ -1492,6 +1492,69 @@ PIKECLASS backtrace_frame
/*! @endclass /*! @endclass
*/ */
/*! @decl mapping(string:int|string) get_runtime_info()
*!
*! Get information about the Pike runtime.
*!
*! @returns
*! Returns a mapping with the following content:
*! @mapping
*! @member string "bytecode_method"
*! A string describing the bytecode method used by
*! the Pike interpreter.
*! @member int "abi"
*! The number of bits in the ABI. Usually @expr{32@} or @expr{64@}.
*! @member int "native_byteorder"
*! The byte order used by the native cpu.
*! Usually @expr{1234@} (aka little endian) or @{4321@} (aka bigendian).
*! @member int "int_size"
*! The number of bits in the native integer type.
*! Usually @expr{32@} or @expr{64@}.
*! @member int "float_size"
*! The number of bits in the native floating point type.
*! Usually @expr{32@} or @expr{64@}.
*! @member int(0..1) "auto_bignum"
*! Present if integers larger than the native size are automatically
*! converted into bignums.
*! @endmapping
*/
PIKEFUN mapping(string:int|string) get_runtime_info()
optflags OPT_TRY_OPTIMIZE;
{
pop_n_elems(args);
push_constant_text("bytecode_method");
push_constant_text(
#if PIKE_BYTECODE_METHOD == PIKE_BYTECODE_IA32
"ia32"
#elif PIKE_BYTECODE_METHOD == PIKE_BYTECODE_SPARC
"sparc"
#elif PIKE_BYTECODE_METHOD == PIKE_BYTECODE_PPC32
"ppc32"
#elif PIKE_BYTECODE_METHOD == PIKE_BYTECODE_GOTO
"computed_goto"
#elif PIKE_BYTECODE_METHOD == PIKE_BYTECODE_DEFAULT
"default"
#else
"unknown"
#endif
);
push_constant_text("abi");
push_int(sizeof(void *) * 8);
push_constant_text("native_byteorder");
push_int(PIKE_BYTEORDER);
push_constant_text("int_size");
push_int(sizeof(INT_TYPE) * 8);
push_constant_text("float_size");
push_int(sizeof(FLOAT_TYPE) * 8);
#ifdef AUTO_BIGNUM
push_constant_text("auto_bignum");
push_int(1);
f_aggregate_mapping(6*2);
#else
f_aggregate_mapping(5*2);
#endif
}
/*! @endmodule /*! @endmodule
*/ */
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment