On this page:

5.21 Virtual Machine Primitives🔗

 (require ffi/unsafe/vm) package: base
The ffi/unsafe/vm library provides access to functionality in the underlying virtual machine that is used to implement Racket.

Added in version of package base.


(vm-primitive name)  any/c

  name : symbol?
Accesses a primitive values at the level of the running Racket virtual machine, or returns #f if name is not the name of a primitive.

Virtual-machine primitives are the ones that can be referenced in a linklet body. The specific set of primitives depends on the virtual machine. Many “primitives” at the racket/base level or even the '#%kernel level are not primitives at the virtual-machine level. For example, if 'eval is available as a primitive, it is not the eval from racket/base.

In general, primitives are unsafe and can only be used with enough knowledge about Racket’s implementation. Here are some tips for currently available virtual machines:


(vm-eval s-expr)  any/c

  s-expr : any/c
Evaluates s-expr using the most primitive available evaluator:

See vm-primitive for some information about how virtual-machine primitives interact with Racket.