|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
#include <refl-cpp/refl.hpp> |
|
#include <iostream> |
|
|
|
template < |
|
class CPPCompiler, |
|
class SchemeCompiler, |
|
class MachineArchitecture, |
|
class OS, |
|
class ConfigurationVariables, |
|
class Guix, |
|
class SelfReferencialTokens, |
|
class LexicalIntrospection, |
|
class Introspection, |
|
class GuileIntrospectorSelf |
|
> class GuileConfig { |
|
#include "config.h" |
|
}; |
|
|
|
extern "C" { |
|
|
|
#include "strings.h" |
|
#include "symbols.h" |
|
#include "vports.h" |
|
#include "numbers.h" |
|
#include "posix.h" |
|
#include "print.h" |
|
#include "scm.h" |
|
#include "intrinsics.h" |
|
#include "loader.h" |
|
} |
|
|
|
|
|
|
|
union scm_vm_stack_element |
|
{ |
|
uintptr_t as_uint; |
|
uint32_t *as_vcode; |
|
uint8_t *as_mcode; |
|
SCM as_scm; |
|
double as_f64; |
|
uint64_t as_u64; |
|
int64_t as_s64; |
|
|
|
|
|
void *as_ptr; |
|
scm_t_bits as_bits; |
|
}; |
|
|
|
|
|
REFL_TYPE( scm_vm_stack_element) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
REFL_END |
|
|
|
REFL_TYPE( scm_vm) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
REFL_FIELD( stack_size) |
|
|
|
|
|
|
|
|
|
|
|
|
|
REFL_FIELD( overflow_handler_stack) |
|
|
|
|
|
|
|
REFL_END |
|
|
|
|
|
|
|
REFL_TYPE(scm_t_dynstack) |
|
|
|
|
|
|
|
REFL_FIELD( base ) |
|
|
|
|
|
|
|
REFL_END |
|
|
|
|
|
|
|
REFL_TYPE( __pthread_cond_s) |
|
|
|
|
|
REFL_FIELD(__g_refs) |
|
REFL_FIELD(__g_size) |
|
REFL_FIELD( __g1_orig_size) |
|
REFL_FIELD( __wrefs ) |
|
REFL_FIELD( __g_signals) |
|
REFL_END |
|
|
|
REFL_TYPE(scm_thread ) |
|
|
|
REFL_FIELD( vm) |
|
REFL_FIELD( pending_asyncs) |
|
|
|
|
|
REFL_FIELD( pointerless_freelists) |
|
|
|
|
|
|
|
|
|
|
|
REFL_FIELD( needs_unregister) |
|
|
|
|
|
|
|
|
|
|
|
REFL_FIELD( continuation_root) |
|
REFL_FIELD( continuation_base) |
|
REFL_FIELD( base) |
|
|
|
|
|
REFL_END |
|
|
|
template < |
|
class AnsibleLikeSSH, |
|
class TerraformInfrastructureCreation, |
|
class NeuralNet, |
|
class LLM, |
|
class Graph, |
|
class Storage, |
|
class Linux, |
|
|
|
|
|
class CPPCompiler, |
|
class SchemeCompiler, |
|
class SchemeVirtualMachine, |
|
class MachineArchitecture, |
|
class VirtualMachine, |
|
class Guix, |
|
class GuixBuildSystem, |
|
class GuixBuildSystemPyProject, |
|
class GuixBuildSystemGNU, |
|
class DockerLikeContainerization, |
|
class ProofInMetaCoqLikeSystem, |
|
class MonteCarloTreeSearch, |
|
class TreeSearch, |
|
class PolicyGraph, |
|
class ValueGraph, |
|
class Identifiers, |
|
class Mathematics, |
|
class Topology, |
|
class AbstractAlgebra, |
|
class AbstractDataClasss, |
|
class AbstractSyntaxTrees, |
|
class ClassDeclarations, |
|
class ClassClassDeclarations, |
|
class TemplateClassClassDeclarations, |
|
class TemplateClassClassDeclarationParameters, |
|
class SelfReferencialTemplateClassClassDeclarationParameters, |
|
class SelfReferencialTokens, |
|
class LexicalIntrospection, |
|
class Introspection, |
|
class Observe, |
|
class Orient, |
|
class Decide, |
|
class Act, |
|
class Life, |
|
class LifeSimulation, |
|
class UniverseSimulation, |
|
class UniverseOfUniverses, |
|
class Unimath, |
|
class Researcher, |
|
class Agent, |
|
class Swarm, |
|
class GuileIntrospectorSelf |
|
> class GuileIntrospector { |
|
|
|
}; |
|
|
|
|
|
extern "C" { |
|
#include "ports.h" |
|
#include "backtrace.h" |
|
|
|
#include "introspector.h" |
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
void |
|
spct_invoke_generic_hook (const char * name, scm_thread * thread) { |
|
std::cout << name << std::endl; |
|
|
|
refl::runtime::debug(std::cout,*thread); |
|
|
|
struct scm_vm *vp; |
|
vp = &thread->vm; |
|
|
|
auto port = scm_current_output_port (); |
|
|
|
|
|
|
|
|
|
auto stack_depth = vp->stack_top - vp->sp; |
|
std::cout << "depth: " << stack_depth << std::endl; |
|
for (int i = 0; i < stack_depth; i++) { |
|
|
|
std::cout << " Item: " << i << ":"; |
|
auto s = vp->sp[i].as_scm; |
|
|
|
|
|
|
|
|
|
|
|
|
|
std::cout << "DEBUG:"; |
|
refl::runtime::debug(std::cout,s); |
|
|
|
std::cout << std::endl; |
|
} |
|
} |
|
|
|
void |
|
spct_invoke_apply_hook (scm_thread * thread) { |
|
spct_invoke_generic_hook ("apply", thread); |
|
} |
|
|
|
void |
|
spct_invoke_return_hook (scm_thread * thread) { |
|
spct_invoke_generic_hook ("return", thread); |
|
} |
|
|
|
void |
|
spct_invoke_next_hook (scm_thread * thread) { |
|
spct_invoke_generic_hook ("next", thread); |
|
} |
|
|
|
void |
|
spct_invoke_abort_hook (scm_thread * thread) { |
|
spct_invoke_generic_hook ("abort", thread); |
|
} |
|
|