# Curious: How does Prolog "Byte code" compare to .NET IL (and some thoughts about enterprise ready systems)

**URL:** <https://swi-prolog.discourse.group/t/curious-how-does-prolog-byte-code-compare-to-net-il-and-some-thoughts-about-enterprise-ready-systems/1101>\
**Category:** Help!\
**Created:** [August 21, 2019, 3:27pm UTC](https://swi-prolog.discourse.group/t/curious-how-does-prolog-byte-code-compare-to-net-il-and-some-thoughts-about-enterprise-ready-systems/1101 "2019-08-21T15:27:02Z")\
**Posts on this page:** 1\
**Showing post:** 9

<div class="post-metadata">

**Author:** ![jan](https://yyz2.discourse-cdn.com/free1/user_avatar/swi-prolog.discourse.group/jan/32/4_2.png) [@jan](https://swi-prolog.discourse.group/u/jan)\
**Post date:** [August 22, 2019, 9:29am UTC](https://swi-prolog.discourse.group/t/curious-how-does-prolog-byte-code-compare-to-net-il-and-some-thoughts-about-enterprise-ready-systems/1101/9 "2019-08-22T09:29:09Z")

</div>

> [@EricGT](#):
>
> So what is the relationship between [vm\_list/1](https://www.swi-prolog.org/pldoc/man?predicate=vm_list/1), the source files [pl-wam.c](https://github.com/SWI-Prolog/swipl-devel/blob/ea88f5f4b6bfe3ad87bbc86a930125fdf2b18842/src/pl-wam.c)  
> [pl-vmi.c](https://github.com/SWI-Prolog/swipl-devel/blob/bf5ff3dae48f263ddceb487899c9ba0b3874c6c0/src/pl-vmi.c) and the implementation of the predicates using [PRED\_IMPL](https://github.com/SWI-Prolog/swipl-devel/search?q=PRED_IMPL&unscoped_q=PRED_IMPL)?
> 
> When I look at the instructions for the WAM, e.g. `unify_value` I would expect to see them in the result from `vm_list(=)` . So what is vm\_list/1 really returning?

A predicate is implemented by what is called the _supervisor_ code. That can be regarded a _preamble_ and depends on how the predicate is defined. If it is foreign, this uses one of the i\_fcall\* instructions which creates the arguments for the C function and calls it. If is a normal predicate it depends on things such as being thread-local, dynamic or static and in the latter case on the indexing opportunities. The supervisor is created on the first call (actually, the initial supervisor is `S_VIRGIN`, which analyses the predicate and replaces itself by the real supervisor on the first call. reloading the predicate resets the supervisor to `S_VIRGIN`).

Unification is a very special case. The VM defines many unification instructions and the predicate is hardly ever called. It is there to support meta calling it (e.g, `maplist(=(x), LIst)`) and such that you can reason about programs using reflexive predicates such as predicate\_property/2. Being foreign, =/2 only has a supervisor and no clauses.

---

_[View the full topic](https://swi-prolog.discourse.group/t/curious-how-does-prolog-byte-code-compare-to-net-il-and-some-thoughts-about-enterprise-ready-systems/1101)._
