Inline is{Integer,Double,Symbol,List,...} with instanceof
Most places that type-test a Term immediately downcast if the type
test is successful. The Java JIT is used to seeing "x instanceof Foo"
before "((Foo) x)" and can optimize the type-test and downcast logic
in machine code to only check the type once.
Take advantage of that by swapping out the isXxx() methods on Term
for proper instanceof checks in the Java code.
Flip the logic for $cut around to be more like human written code
where the common success path is the term is the correct type and
can be immediately downcast. JITs expect this flow as it happens
so often in Java source, and $cut happens often in the Prolog meta
interpreter.
Change-Id: I4ba34cab751b6060a3b1cc1adbf75ed0019b36fd
A fork of Mutsunori BANBARA‘s PrologCafe to support Gerrit Code Review’s customizable project rules.
To bootstrap Buck and SWI-Prolog >= 6.6.4 must be installed and then build the runtime and compiler with:
buck build all
To package for Maven into the local ~/.m2/repository directory:
buck build install
To publish to the gerrit-maven storage bucket:
buck build deploy