Merge branch 'slimconfigure'
authorMichael Wallner <mike@php.net>
Mon, 16 Apr 2018 07:16:34 +0000 (09:16 +0200)
committerMichael Wallner <mike@php.net>
Mon, 16 Apr 2018 07:16:34 +0000 (09:16 +0200)
103 files changed:
Makefile.frag
config.m4
m4/psi/psi.m4
php_psi_posix.h.in
psi.d/arpa_inet.psi
psi.d/stat.psi
psi.d/uname.psi
scripts/_include.php
scripts/gen_calc_bin.php
scripts/gen_calc_bool.php
scripts/gen_calc_unary.php [new file with mode: 0644]
src/calc.h
src/calc/basic.h
src/calc/bin.h
src/calc/bool.h
src/calc/cast.h
src/calc/cmp.h
src/calc/unary.h [new file with mode: 0644]
src/context.c
src/context.h
src/cpp.c
src/data.c
src/data.h
src/error.h
src/marshal.c
src/module.c
src/parser.c
src/parser.re
src/parser_proc.c
src/parser_proc.h
src/parser_proc_grammar.y
src/plist.c
src/token.h
src/types.h
src/types/assert_stmt.c
src/types/assert_stmt.h
src/types/const.c
src/types/const.h
src/types/const_type.c [deleted file]
src/types/const_type.h [deleted file]
src/types/cpp_macro_decl.c
src/types/decl.c
src/types/decl.h
src/types/decl_arg.c
src/types/decl_arg.h
src/types/decl_enum_item.c
src/types/decl_extvar.c
src/types/decl_extvar.h
src/types/decl_struct.c
src/types/decl_struct.h
src/types/decl_type.c
src/types/decl_type.h
src/types/decl_union.c
src/types/decl_union.h
src/types/decl_var.c
src/types/decl_var.h
src/types/free_exp.c
src/types/free_exp.h
src/types/free_stmt.c
src/types/free_stmt.h
src/types/impl.c
src/types/impl.h
src/types/impl_arg.c
src/types/impl_def_val.c
src/types/impl_def_val.h
src/types/impl_func.c
src/types/impl_func.h
src/types/impl_type.c
src/types/impl_type.h
src/types/impl_var.c
src/types/impl_var.h
src/types/let_callback.c
src/types/let_callback.h
src/types/let_exp.c
src/types/let_exp.h
src/types/let_func.c
src/types/let_func.h
src/types/let_stmt.c
src/types/let_stmt.h
src/types/num_exp.c
src/types/num_exp.h
src/types/number.c
src/types/number.h
src/types/return_exp.c
src/types/return_exp.h
src/types/return_stmt.c
src/types/return_stmt.h
src/types/set_exp.c
src/types/set_exp.h
src/types/set_func.c
src/types/set_func.h
src/types/set_stmt.c
src/types/set_stmt.h
src/validate.c [new file with mode: 0644]
src/validate.h [new file with mode: 0644]
tests/calc/calc.psi
tests/ndbm/gdbm.psi [new file with mode: 0644]
tests/ndbm/ndbm.psi
tests/ndbm/ndbm001.phpt
tests/pipe/pipe.psi
tests/sqlite/sqlite.psi
tests/uname/uname001.phpt
tests/yaml/yaml.psi

index 5ca422e..91499f6 100644 (file)
@@ -27,10 +27,11 @@ $(PHP_PSI_SRCDIR)/src/parser.c: $(PHP_PSI_SRCDIR)/src/parser.re
 $(PHP_PSI_SRCDIR)/src/calc/%.h: $(PHP_PSI_SRCDIR)/scripts/gen_calc_%.php
        $(PHP_EXECUTABLE) $< >$@
 
 $(PHP_PSI_SRCDIR)/src/calc/%.h: $(PHP_PSI_SRCDIR)/scripts/gen_calc_%.php
        $(PHP_EXECUTABLE) $< >$@
 
-$(PHP_PSI_SRCDIR)/src/calc.h: | $(PHP_PSI_SRCDIR)/src/calc/basic.h $(PHP_PSI_SRCDIR)/src/calc/bin.h $(PHP_PSI_SRCDIR)/src/calc/bool.h $(PHP_PSI_SRCDIR)/src/calc/cast.h $(PHP_PSI_SRCDIR)/src/calc/cmp.h $(PHP_PSI_SRCDIR)/src/calc/oper.h
+$(PHP_PSI_SRCDIR)/src/calc.h: | $(PHP_PSI_SRCDIR)/src/calc/basic.h $(PHP_PSI_SRCDIR)/src/calc/bin.h $(PHP_PSI_SRCDIR)/src/calc/bool.h $(PHP_PSI_SRCDIR)/src/calc/unary.h $(PHP_PSI_SRCDIR)/src/calc/cast.h $(PHP_PSI_SRCDIR)/src/calc/cmp.h $(PHP_PSI_SRCDIR)/src/calc/oper.h
 
 .PHONY: psi-generated
 psi-generated: $(PHP_PSI_GENERATED)
 
 .PHONY: psi-generated
 psi-generated: $(PHP_PSI_GENERATED)
+       
 
 PHP_PSI_DEPEND = $(patsubst $(PHP_PSI_SRCDIR)/%,$(PHP_PSI_BUILDDIR)/%,$(PHP_PSI_SOURCES:.c=.dep))
 
 
 PHP_PSI_DEPEND = $(patsubst $(PHP_PSI_SRCDIR)/%,$(PHP_PSI_BUILDDIR)/%,$(PHP_PSI_SOURCES:.c=.dep))
 
@@ -88,6 +89,10 @@ psi-clean-depend:
 
 psi-clean: psi-clean-depend
 
 
 psi-clean: psi-clean-depend
 
+.PHONY: psi-watch
+psi-watch:
+       -while inotifywait -q -e modify -r $(PHP_PSI_SRCDIR); do $(MAKE); done
+
 install-headers: psi-build-headers
 clean: psi-clean-headers psi-clean-aux
 ifneq ($(PSI_DEPS),)
 install-headers: psi-build-headers
 clean: psi-clean-headers psi-clean-aux
 ifneq ($(PSI_DEPS),)
index f25cc06..01a82a2 100644 (file)
--- a/config.m4
+++ b/config.m4
@@ -164,7 +164,7 @@ if test "$PHP_PSI" != no; then
 
        PHP_PSI_HEADERS=" \
                src/calc/basic.h src/calc/bin.h src/calc/bool.h src/calc/cast.h \
 
        PHP_PSI_HEADERS=" \
                src/calc/basic.h src/calc/bin.h src/calc/bool.h src/calc/cast.h \
-               src/calc/cmp.h src/calc/oper.h \
+               src/calc/unary.h src/calc/cmp.h src/calc/oper.h \
                `(cd $PHP_PSI_SRCDIR/src && ls *.h types/*.h)` \
        "
        # parser* should come first
                `(cd $PHP_PSI_SRCDIR/src && ls *.h types/*.h)` \
        "
        # parser* should come first
@@ -177,7 +177,7 @@ if test "$PHP_PSI" != no; then
        PHP_PSI_GENERATED=" \
                src/parser_proc.c src/parser.c \
                src/calc/basic.h src/calc/bin.h src/calc/bool.h src/calc/cast.h \
        PHP_PSI_GENERATED=" \
                src/parser_proc.c src/parser.c \
                src/calc/basic.h src/calc/bin.h src/calc/bool.h src/calc/cast.h \
-               src/calc/cmp.h src/calc/oper.h \
+               src/calc/unary.h src/calc/cmp.h src/calc/oper.h \
        "
 
        PHP_NEW_EXTENSION(psi, $PHP_PSI_SOURCES, $ext_shared)
        "
 
        PHP_NEW_EXTENSION(psi, $PHP_PSI_SOURCES, $ext_shared)
index 470a7a6..ba86907 100644 (file)
@@ -106,7 +106,9 @@ AC_DEFUN(PSI_CONFIG_DONE, [
        
        if $PSI_FAST_CONFIG; then
                for conf_env in $PSI_CONFIG_TMP/*/conf.env; do
        
        if $PSI_FAST_CONFIG; then
                for conf_env in $PSI_CONFIG_TMP/*/conf.env; do
-                       source $conf_env
+                       if test "$conf_env" != "$PSI_CONFIG_TMP/*/conf.env"; then
+                               source $conf_env
+                       fi
                done
        fi
        
                done
        fi
        
index 882e30c..6131448 100644 (file)
@@ -110,6 +110,16 @@ static struct psi_func_redir {
        const char *name;
        psi_func_ptr func;
 } psi_func_redirs[] = {
        const char *name;
        psi_func_ptr func;
 } psi_func_redirs[] = {
+       {"fstat", (psi_func_ptr) fstat},
+       {"fstatat", (psi_func_ptr) fstatat},
+       {"lstat", (psi_func_ptr) lstat},
+       {"mknod", (psi_func_ptr) mknod},
+       {"mknodat", (psi_func_ptr) mknodat},
+       {"stat", (psi_func_ptr) stat},
+       {"getaddrinfo_a", (psi_func_ptr) getaddrinfo_a},
+       {"gai_suspend", (psi_func_ptr) gai_suspend},
+       {"gai_error", (psi_func_ptr) gai_error},
+       {"gai_cancel", (psi_func_ptr) gai_cancel},
 @PSI_REDIRS@
        {0}
 };
 @PSI_REDIRS@
        {0}
 };
index f9aae9e..6fdf0fb 100644 (file)
@@ -34,7 +34,7 @@ function psi\inet_ntoa(array $in) : string {
 function psi\inet_ntop(int $af, string $src) : string {
        let af = intval($af);
        let src = strval($src);
 function psi\inet_ntop(int $af, string $src) : string {
        let af = intval($af);
        let src = strval($src);
-       let size = psi\SIZEOF_STRUCT_SOCKADDR_STORAGE;
+       let size = sizeof(struct sockaddr_storage);
        let dst = calloc(1, size);
        return inet_ntop(af, src, dst, size) as to_string(inet_ntop);
 }
        let dst = calloc(1, size);
        return inet_ntop(af, src, dst, size) as to_string(inet_ntop);
 }
@@ -42,7 +42,7 @@ function psi\inet_ntop(int $af, string $src) : string {
 function psi\inet_pton(int $af, string $src, string &$dst) : int {
        let af = intval($af);
        let src = strval($src);
 function psi\inet_pton(int $af, string $src, string &$dst) : int {
        let af = intval($af);
        let src = strval($src);
-       let dst = calloc(1, psi\SIZEOF_STRUCT_SOCKADDR_STORAGE);
+       let dst = calloc(1, sizeof(struct sockaddr_storage));
        return inet_pton(af, src, dst) as to_int(inet_pton);
        return inet_pton(af, src, dst) as to_int(inet_pton);
-       set $dst = to_string(dst, psi\SIZEOF_STRUCT_SOCKADDR_STORAGE);
+       set $dst = to_string(dst, sizeof(struct sockaddr_storage));
 }
\ No newline at end of file
 }
\ No newline at end of file
index 3d0e623..68f6781 100644 (file)
@@ -2,7 +2,7 @@
 // extern int stat(char *path, struct stat *buf);
 function psi\stat(string $path, array &$buf = NULL) : int {
        let path = strval($path);
 // extern int stat(char *path, struct stat *buf);
 function psi\stat(string $path, array &$buf = NULL) : int {
        let path = strval($path);
-       let buf = calloc(1, psi\SIZEOF_STRUCT_STAT);
+       let buf = calloc(1, sizeof(struct stat));
        return stat(path, buf) as to_int(stat);
        set $buf = to_array(*buf,
                to_int(st_dev),
        return stat(path, buf) as to_int(stat);
        set $buf = to_array(*buf,
                to_int(st_dev),
index e5144da..404399c 100644 (file)
@@ -1,7 +1,7 @@
 #include <sys/utsname.h>
 
 function psi\uname(array &$u = NULL) : int {
 #include <sys/utsname.h>
 
 function psi\uname(array &$u = NULL) : int {
-       let name = calloc(1, psi\SIZEOF_STRUCT_UTSNAME);
+       let name = calloc(1, sizeof(struct utsname));
        return uname(name) as to_int(uname);
        set $u = to_array(*name,
                to_string(sysname),
        return uname(name) as to_int(uname);
        set $u = to_array(*name,
                to_string(sysname),
index acd539b..67a73ca 100644 (file)
@@ -12,6 +12,8 @@ $types = [
                "UINT32" => "u32",
                "INT64" => "i64",
                "UINT64" => "u64",
                "UINT32" => "u32",
                "INT64" => "i64",
                "UINT64" => "u64",
+               "INT128" => "i128",
+               "UINT128" => "u128",
                "FLOAT" => "fval",
                "DOUBLE" => "dval",
                "LONG_DOUBLE" => "ldval",
                "FLOAT" => "fval",
                "DOUBLE" => "dval",
                "LONG_DOUBLE" => "ldval",
@@ -29,6 +31,8 @@ function t_is_int($t) {
 
 function t_is_special($t) {
        switch ($t) {
 
 function t_is_special($t) {
        switch ($t) {
+               case "INT128_T":
+               case "UINT128_T":
                case "LONG_DOUBLE":
                        return true;
                default:
                case "LONG_DOUBLE":
                        return true;
                default:
index c7dbf01..5ee92a8 100644 (file)
@@ -64,35 +64,3 @@ static inline token_t psi_calc_bin_<?=$op_name?>(token_t t1, impl_val *v1, token
        return PSI_T_UINT64;
 }
 <?php endforeach; ?>
        return PSI_T_UINT64;
 }
 <?php endforeach; ?>
-
-static inline token_t psi_calc_bin_not(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
-{
-       impl_val i1;
-
-       (void) t2;
-       (void) v2;
-       
-       switch (t1) {<?php /*nobr*/ ?>
-       <?php foreach ($types as $t1 => $v1) : ?>
-       <?php if (t_is_special($t1)) :?>
-       
-#if HAVE_<?=$t1?>
-       <?php endif; ?>
-
-       case PSI_T_<?=$t1?>:
-               i1.u64 = v1-><?=$v1?>;
-               break;
-       <?php if (t_is_special($t1)) : ?>
-
-#endif
-       <?php endif; ?>
-       <?php endforeach; ?>
-
-       default:
-               assert(0);
-               break;
-       }
-
-       res->u64 = ~i1.u64;
-       return PSI_T_UINT64;
-}
\ No newline at end of file
index 1aaad08..1b5b339 100644 (file)
@@ -2,35 +2,6 @@
 include __DIR__."/_include.php";
 ?>
 
 include __DIR__."/_include.php";
 ?>
 
-
-static inline token_t psi_calc_bool_not(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
-{
-       (void) t2;
-       (void) v2;
-       
-       switch (t1) {<?php /*nobr */ ?>
-       <?php foreach ($types as $t1 => $v1) : ?>
-       <?php if (t_is_special($t1)) :?>
-       
-#if HAVE_<?=$t1?>
-       <?php endif; ?>
-
-       case PSI_T_<?=$t1?>:
-               res->u8 = !v1-><?=$v1?>;
-               break;<?php /*nobr */ ?>
-       <?php if (t_is_special($t1)) : ?>
-
-#endif
-       <?php endif; ?>
-       <?php endforeach; ?>
-
-       default:
-               assert(0);
-               break;
-       }
-       return PSI_T_UINT8;
-}
-
 static inline token_t psi_calc_bool_or(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
 {
        switch (t1) {<?php /*nobr */ ?>
 static inline token_t psi_calc_bool_or(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
 {
        switch (t1) {<?php /*nobr */ ?>
diff --git a/scripts/gen_calc_unary.php b/scripts/gen_calc_unary.php
new file mode 100644 (file)
index 0000000..ef20720
--- /dev/null
@@ -0,0 +1,93 @@
+<?php
+include __DIR__."/_include.php"
+?>
+
+static inline token_t psi_calc_minus(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
+{
+       (void) t2;
+       (void) v2;
+       
+       switch (t1) {<?php /*nobr */ ?>
+       <?php foreach ($types as $t1 => $v1) : ?>
+       <?php if (t_is_special($t1)) :?>
+       
+#if HAVE_<?=$t1?>
+       <?php endif; ?>
+
+       case PSI_T_<?=$t1?>:
+               res-><?=$v1?> = -v1-><?=$v1?>;
+               break;<?php /*nobr */ ?>
+       <?php if (t_is_special($t1)) : ?>
+
+#endif
+       <?php endif; ?>
+       <?php endforeach; ?>
+
+       default:
+               assert(0);
+               break;
+       }
+       return t1;
+}
+
+
+static inline token_t psi_calc_bool_not(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
+{
+       (void) t2;
+       (void) v2;
+       
+       switch (t1) {<?php /*nobr */ ?>
+       <?php foreach ($types as $t1 => $v1) : ?>
+       <?php if (t_is_special($t1)) :?>
+       
+#if HAVE_<?=$t1?>
+       <?php endif; ?>
+
+       case PSI_T_<?=$t1?>:
+               res->u8 = !v1-><?=$v1?>;
+               break;<?php /*nobr */ ?>
+       <?php if (t_is_special($t1)) : ?>
+
+#endif
+       <?php endif; ?>
+       <?php endforeach; ?>
+
+       default:
+               assert(0);
+               break;
+       }
+       return PSI_T_UINT8;
+}
+
+
+static inline token_t psi_calc_bin_not(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
+{
+       impl_val i1;
+
+       (void) t2;
+       (void) v2;
+       
+       switch (t1) {<?php /*nobr*/ ?>
+       <?php foreach ($types as $t1 => $v1) : ?>
+       <?php if (t_is_special($t1)) :?>
+       
+#if HAVE_<?=$t1?>
+       <?php endif; ?>
+
+       case PSI_T_<?=$t1?>:
+               i1.u64 = v1-><?=$v1?>;
+               break;
+       <?php if (t_is_special($t1)) : ?>
+
+#endif
+       <?php endif; ?>
+       <?php endforeach; ?>
+
+       default:
+               assert(0);
+               break;
+       }
+
+       res->u64 = ~i1.u64;
+       return PSI_T_UINT64;
+}
\ No newline at end of file
index 49114ef..21ece7b 100644 (file)
 #include "token.h"
 #include "types/impl_val.h"
 
 #include "token.h"
 #include "types/impl_val.h"
 
-#define PRIfval "f"
-#define PRIdval "lf"
-#define PRIldval "Lf"
+#define PRIfval ".13gF"
+#define PRIdval ".53lg"
+#define PRIldval ".64LgL"
 
 typedef token_t (*psi_calc)(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res);
 
 #include "calc/basic.h"
 #include "calc/bin.h"
 #include "calc/bool.h"
 
 typedef token_t (*psi_calc)(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res);
 
 #include "calc/basic.h"
 #include "calc/bin.h"
 #include "calc/bool.h"
+#include "calc/unary.h"
 #include "calc/cast.h"
 #include "calc/cmp.h"
 #include "calc/oper.h"
 #include "calc/cast.h"
 #include "calc/cmp.h"
 #include "calc/oper.h"
index ac021e0..ec42112 100644 (file)
@@ -58,6 +58,12 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i8 + v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i8 + v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i8 + v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i8 + v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i8 + v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i8 + v2->fval;
                        return PSI_T_FLOAT;
@@ -101,6 +107,12 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u8 + v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u8 + v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u8 + v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u8 + v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u8 + v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u8 + v2->fval;
                        return PSI_T_FLOAT;
@@ -144,6 +156,12 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i16 + v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i16 + v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i16 + v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i16 + v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i16 + v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i16 + v2->fval;
                        return PSI_T_FLOAT;
@@ -187,6 +205,12 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u16 + v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u16 + v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u16 + v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u16 + v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u16 + v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u16 + v2->fval;
                        return PSI_T_FLOAT;
@@ -230,6 +254,12 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i32 + v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i32 + v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i32 + v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i32 + v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i32 + v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i32 + v2->fval;
                        return PSI_T_FLOAT;
@@ -273,6 +303,12 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u32 + v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u32 + v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u32 + v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u32 + v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u32 + v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u32 + v2->fval;
                        return PSI_T_FLOAT;
@@ -316,6 +352,12 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i64 + v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i64 + v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i64 + v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i64 + v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i64 + v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i64 + v2->fval;
                        return PSI_T_FLOAT;
@@ -359,6 +401,12 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u64 + v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u64 + v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u64 + v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u64 + v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u64 + v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u64 + v2->fval;
                        return PSI_T_FLOAT;
@@ -371,6 +419,104 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                        return PSI_T_LONG_DOUBLE;
 #      endif
 
                        return PSI_T_LONG_DOUBLE;
 #      endif
 
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_INT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->i128 = v1->i128 + v2->i8;
+                       return PSI_T_INT128;
+               case PSI_T_UINT8:
+                       res->i128 = v1->i128 + v2->u8;
+                       return PSI_T_INT128;
+               case PSI_T_INT16:
+                       res->i128 = v1->i128 + v2->i16;
+                       return PSI_T_INT128;
+               case PSI_T_UINT16:
+                       res->i128 = v1->i128 + v2->u16;
+                       return PSI_T_INT128;
+               case PSI_T_INT32:
+                       res->i128 = v1->i128 + v2->i32;
+                       return PSI_T_INT128;
+               case PSI_T_UINT32:
+                       res->i128 = v1->i128 + v2->u32;
+                       return PSI_T_INT128;
+               case PSI_T_INT64:
+                       res->i128 = v1->i128 + v2->i64;
+                       return PSI_T_INT128;
+               case PSI_T_UINT64:
+                       res->i128 = v1->i128 + v2->u64;
+                       return PSI_T_INT128;
+               case PSI_T_INT128:
+                       res->i128 = v1->i128 + v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i128 + v2->u128;
+                       return PSI_T_UINT128;
+               case PSI_T_FLOAT:
+                       res->fval = v1->i128 + v2->fval;
+                       return PSI_T_FLOAT;
+               case PSI_T_DOUBLE:
+                       res->dval = v1->i128 + v2->dval;
+                       return PSI_T_DOUBLE;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->ldval = v1->i128 + v2->ldval;
+                       return PSI_T_LONG_DOUBLE;
+#      endif
+
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_UINT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u128 = v1->u128 + v2->i8;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT8:
+                       res->u128 = v1->u128 + v2->u8;
+                       return PSI_T_UINT128;
+               case PSI_T_INT16:
+                       res->u128 = v1->u128 + v2->i16;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT16:
+                       res->u128 = v1->u128 + v2->u16;
+                       return PSI_T_UINT128;
+               case PSI_T_INT32:
+                       res->u128 = v1->u128 + v2->i32;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT32:
+                       res->u128 = v1->u128 + v2->u32;
+                       return PSI_T_UINT128;
+               case PSI_T_INT64:
+                       res->u128 = v1->u128 + v2->i64;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT64:
+                       res->u128 = v1->u128 + v2->u64;
+                       return PSI_T_UINT128;
+               case PSI_T_INT128:
+                       res->u128 = v1->u128 + v2->i128;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u128 + v2->u128;
+                       return PSI_T_UINT128;
+               case PSI_T_FLOAT:
+                       res->fval = v1->u128 + v2->fval;
+                       return PSI_T_FLOAT;
+               case PSI_T_DOUBLE:
+                       res->dval = v1->u128 + v2->dval;
+                       return PSI_T_DOUBLE;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->ldval = v1->u128 + v2->ldval;
+                       return PSI_T_LONG_DOUBLE;
+#      endif
+
                default:
                        assert(0);
                        break;
                default:
                        assert(0);
                        break;
@@ -402,6 +548,12 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->fval = v1->fval + v2->u64;
                        return PSI_T_FLOAT;
                case PSI_T_UINT64:
                        res->fval = v1->fval + v2->u64;
                        return PSI_T_FLOAT;
+               case PSI_T_INT128:
+                       res->fval = v1->fval + v2->i128;
+                       return PSI_T_FLOAT;
+               case PSI_T_UINT128:
+                       res->fval = v1->fval + v2->u128;
+                       return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->fval + v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->fval + v2->fval;
                        return PSI_T_FLOAT;
@@ -445,6 +597,12 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->dval = v1->dval + v2->u64;
                        return PSI_T_DOUBLE;
                case PSI_T_UINT64:
                        res->dval = v1->dval + v2->u64;
                        return PSI_T_DOUBLE;
+               case PSI_T_INT128:
+                       res->dval = v1->dval + v2->i128;
+                       return PSI_T_DOUBLE;
+               case PSI_T_UINT128:
+                       res->dval = v1->dval + v2->u128;
+                       return PSI_T_DOUBLE;
                case PSI_T_FLOAT:
                        res->dval = v1->dval + v2->fval;
                        return PSI_T_DOUBLE;
                case PSI_T_FLOAT:
                        res->dval = v1->dval + v2->fval;
                        return PSI_T_DOUBLE;
@@ -489,6 +647,12 @@ static inline token_t psi_calc_add(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->ldval = v1->ldval + v2->u64;
                        return PSI_T_LONG_DOUBLE;
                case PSI_T_UINT64:
                        res->ldval = v1->ldval + v2->u64;
                        return PSI_T_LONG_DOUBLE;
+               case PSI_T_INT128:
+                       res->ldval = v1->ldval + v2->i128;
+                       return PSI_T_LONG_DOUBLE;
+               case PSI_T_UINT128:
+                       res->ldval = v1->ldval + v2->u128;
+                       return PSI_T_LONG_DOUBLE;
                case PSI_T_FLOAT:
                        res->ldval = v1->ldval + v2->fval;
                        return PSI_T_LONG_DOUBLE;
                case PSI_T_FLOAT:
                        res->ldval = v1->ldval + v2->fval;
                        return PSI_T_LONG_DOUBLE;
@@ -545,6 +709,12 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i8 - v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i8 - v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i8 - v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i8 - v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i8 - v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i8 - v2->fval;
                        return PSI_T_FLOAT;
@@ -588,6 +758,12 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u8 - v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u8 - v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u8 - v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u8 - v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u8 - v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u8 - v2->fval;
                        return PSI_T_FLOAT;
@@ -631,6 +807,12 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i16 - v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i16 - v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i16 - v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i16 - v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i16 - v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i16 - v2->fval;
                        return PSI_T_FLOAT;
@@ -674,6 +856,12 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u16 - v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u16 - v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u16 - v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u16 - v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u16 - v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u16 - v2->fval;
                        return PSI_T_FLOAT;
@@ -717,6 +905,12 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i32 - v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i32 - v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i32 - v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i32 - v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i32 - v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i32 - v2->fval;
                        return PSI_T_FLOAT;
@@ -760,6 +954,12 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u32 - v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u32 - v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u32 - v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u32 - v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u32 - v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u32 - v2->fval;
                        return PSI_T_FLOAT;
@@ -803,6 +1003,12 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i64 - v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i64 - v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i64 - v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i64 - v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i64 - v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i64 - v2->fval;
                        return PSI_T_FLOAT;
@@ -846,6 +1052,12 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u64 - v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u64 - v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u64 - v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u64 - v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u64 - v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u64 - v2->fval;
                        return PSI_T_FLOAT;
@@ -858,6 +1070,104 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                        return PSI_T_LONG_DOUBLE;
 #      endif
 
                        return PSI_T_LONG_DOUBLE;
 #      endif
 
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_INT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->i128 = v1->i128 - v2->i8;
+                       return PSI_T_INT128;
+               case PSI_T_UINT8:
+                       res->i128 = v1->i128 - v2->u8;
+                       return PSI_T_INT128;
+               case PSI_T_INT16:
+                       res->i128 = v1->i128 - v2->i16;
+                       return PSI_T_INT128;
+               case PSI_T_UINT16:
+                       res->i128 = v1->i128 - v2->u16;
+                       return PSI_T_INT128;
+               case PSI_T_INT32:
+                       res->i128 = v1->i128 - v2->i32;
+                       return PSI_T_INT128;
+               case PSI_T_UINT32:
+                       res->i128 = v1->i128 - v2->u32;
+                       return PSI_T_INT128;
+               case PSI_T_INT64:
+                       res->i128 = v1->i128 - v2->i64;
+                       return PSI_T_INT128;
+               case PSI_T_UINT64:
+                       res->i128 = v1->i128 - v2->u64;
+                       return PSI_T_INT128;
+               case PSI_T_INT128:
+                       res->i128 = v1->i128 - v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i128 - v2->u128;
+                       return PSI_T_UINT128;
+               case PSI_T_FLOAT:
+                       res->fval = v1->i128 - v2->fval;
+                       return PSI_T_FLOAT;
+               case PSI_T_DOUBLE:
+                       res->dval = v1->i128 - v2->dval;
+                       return PSI_T_DOUBLE;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->ldval = v1->i128 - v2->ldval;
+                       return PSI_T_LONG_DOUBLE;
+#      endif
+
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_UINT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u128 = v1->u128 - v2->i8;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT8:
+                       res->u128 = v1->u128 - v2->u8;
+                       return PSI_T_UINT128;
+               case PSI_T_INT16:
+                       res->u128 = v1->u128 - v2->i16;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT16:
+                       res->u128 = v1->u128 - v2->u16;
+                       return PSI_T_UINT128;
+               case PSI_T_INT32:
+                       res->u128 = v1->u128 - v2->i32;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT32:
+                       res->u128 = v1->u128 - v2->u32;
+                       return PSI_T_UINT128;
+               case PSI_T_INT64:
+                       res->u128 = v1->u128 - v2->i64;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT64:
+                       res->u128 = v1->u128 - v2->u64;
+                       return PSI_T_UINT128;
+               case PSI_T_INT128:
+                       res->u128 = v1->u128 - v2->i128;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u128 - v2->u128;
+                       return PSI_T_UINT128;
+               case PSI_T_FLOAT:
+                       res->fval = v1->u128 - v2->fval;
+                       return PSI_T_FLOAT;
+               case PSI_T_DOUBLE:
+                       res->dval = v1->u128 - v2->dval;
+                       return PSI_T_DOUBLE;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->ldval = v1->u128 - v2->ldval;
+                       return PSI_T_LONG_DOUBLE;
+#      endif
+
                default:
                        assert(0);
                        break;
                default:
                        assert(0);
                        break;
@@ -889,6 +1199,12 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->fval = v1->fval - v2->u64;
                        return PSI_T_FLOAT;
                case PSI_T_UINT64:
                        res->fval = v1->fval - v2->u64;
                        return PSI_T_FLOAT;
+               case PSI_T_INT128:
+                       res->fval = v1->fval - v2->i128;
+                       return PSI_T_FLOAT;
+               case PSI_T_UINT128:
+                       res->fval = v1->fval - v2->u128;
+                       return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->fval - v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->fval - v2->fval;
                        return PSI_T_FLOAT;
@@ -932,6 +1248,12 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->dval = v1->dval - v2->u64;
                        return PSI_T_DOUBLE;
                case PSI_T_UINT64:
                        res->dval = v1->dval - v2->u64;
                        return PSI_T_DOUBLE;
+               case PSI_T_INT128:
+                       res->dval = v1->dval - v2->i128;
+                       return PSI_T_DOUBLE;
+               case PSI_T_UINT128:
+                       res->dval = v1->dval - v2->u128;
+                       return PSI_T_DOUBLE;
                case PSI_T_FLOAT:
                        res->dval = v1->dval - v2->fval;
                        return PSI_T_DOUBLE;
                case PSI_T_FLOAT:
                        res->dval = v1->dval - v2->fval;
                        return PSI_T_DOUBLE;
@@ -976,6 +1298,12 @@ static inline token_t psi_calc_sub(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->ldval = v1->ldval - v2->u64;
                        return PSI_T_LONG_DOUBLE;
                case PSI_T_UINT64:
                        res->ldval = v1->ldval - v2->u64;
                        return PSI_T_LONG_DOUBLE;
+               case PSI_T_INT128:
+                       res->ldval = v1->ldval - v2->i128;
+                       return PSI_T_LONG_DOUBLE;
+               case PSI_T_UINT128:
+                       res->ldval = v1->ldval - v2->u128;
+                       return PSI_T_LONG_DOUBLE;
                case PSI_T_FLOAT:
                        res->ldval = v1->ldval - v2->fval;
                        return PSI_T_LONG_DOUBLE;
                case PSI_T_FLOAT:
                        res->ldval = v1->ldval - v2->fval;
                        return PSI_T_LONG_DOUBLE;
@@ -1032,6 +1360,12 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i8 * v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i8 * v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i8 * v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i8 * v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i8 * v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i8 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1075,6 +1409,12 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u8 * v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u8 * v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u8 * v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u8 * v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u8 * v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u8 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1118,6 +1458,12 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i16 * v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i16 * v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i16 * v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i16 * v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i16 * v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i16 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1161,6 +1507,12 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u16 * v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u16 * v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u16 * v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u16 * v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u16 * v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u16 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1204,6 +1556,12 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i32 * v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i32 * v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i32 * v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i32 * v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i32 * v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i32 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1247,6 +1605,12 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u32 * v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u32 * v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u32 * v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u32 * v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u32 * v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u32 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1290,6 +1654,12 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i64 * v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i64 * v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i64 * v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i64 * v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i64 * v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i64 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1333,6 +1703,12 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u64 * v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u64 * v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u64 * v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u64 * v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u64 * v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u64 * v2->fval;
                        return PSI_T_FLOAT;
@@ -1345,6 +1721,104 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                        return PSI_T_LONG_DOUBLE;
 #      endif
 
                        return PSI_T_LONG_DOUBLE;
 #      endif
 
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_INT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->i128 = v1->i128 * v2->i8;
+                       return PSI_T_INT128;
+               case PSI_T_UINT8:
+                       res->i128 = v1->i128 * v2->u8;
+                       return PSI_T_INT128;
+               case PSI_T_INT16:
+                       res->i128 = v1->i128 * v2->i16;
+                       return PSI_T_INT128;
+               case PSI_T_UINT16:
+                       res->i128 = v1->i128 * v2->u16;
+                       return PSI_T_INT128;
+               case PSI_T_INT32:
+                       res->i128 = v1->i128 * v2->i32;
+                       return PSI_T_INT128;
+               case PSI_T_UINT32:
+                       res->i128 = v1->i128 * v2->u32;
+                       return PSI_T_INT128;
+               case PSI_T_INT64:
+                       res->i128 = v1->i128 * v2->i64;
+                       return PSI_T_INT128;
+               case PSI_T_UINT64:
+                       res->i128 = v1->i128 * v2->u64;
+                       return PSI_T_INT128;
+               case PSI_T_INT128:
+                       res->i128 = v1->i128 * v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i128 * v2->u128;
+                       return PSI_T_UINT128;
+               case PSI_T_FLOAT:
+                       res->fval = v1->i128 * v2->fval;
+                       return PSI_T_FLOAT;
+               case PSI_T_DOUBLE:
+                       res->dval = v1->i128 * v2->dval;
+                       return PSI_T_DOUBLE;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->ldval = v1->i128 * v2->ldval;
+                       return PSI_T_LONG_DOUBLE;
+#      endif
+
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_UINT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u128 = v1->u128 * v2->i8;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT8:
+                       res->u128 = v1->u128 * v2->u8;
+                       return PSI_T_UINT128;
+               case PSI_T_INT16:
+                       res->u128 = v1->u128 * v2->i16;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT16:
+                       res->u128 = v1->u128 * v2->u16;
+                       return PSI_T_UINT128;
+               case PSI_T_INT32:
+                       res->u128 = v1->u128 * v2->i32;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT32:
+                       res->u128 = v1->u128 * v2->u32;
+                       return PSI_T_UINT128;
+               case PSI_T_INT64:
+                       res->u128 = v1->u128 * v2->i64;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT64:
+                       res->u128 = v1->u128 * v2->u64;
+                       return PSI_T_UINT128;
+               case PSI_T_INT128:
+                       res->u128 = v1->u128 * v2->i128;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u128 * v2->u128;
+                       return PSI_T_UINT128;
+               case PSI_T_FLOAT:
+                       res->fval = v1->u128 * v2->fval;
+                       return PSI_T_FLOAT;
+               case PSI_T_DOUBLE:
+                       res->dval = v1->u128 * v2->dval;
+                       return PSI_T_DOUBLE;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->ldval = v1->u128 * v2->ldval;
+                       return PSI_T_LONG_DOUBLE;
+#      endif
+
                default:
                        assert(0);
                        break;
                default:
                        assert(0);
                        break;
@@ -1376,6 +1850,12 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->fval = v1->fval * v2->u64;
                        return PSI_T_FLOAT;
                case PSI_T_UINT64:
                        res->fval = v1->fval * v2->u64;
                        return PSI_T_FLOAT;
+               case PSI_T_INT128:
+                       res->fval = v1->fval * v2->i128;
+                       return PSI_T_FLOAT;
+               case PSI_T_UINT128:
+                       res->fval = v1->fval * v2->u128;
+                       return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->fval * v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->fval * v2->fval;
                        return PSI_T_FLOAT;
@@ -1419,6 +1899,12 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->dval = v1->dval * v2->u64;
                        return PSI_T_DOUBLE;
                case PSI_T_UINT64:
                        res->dval = v1->dval * v2->u64;
                        return PSI_T_DOUBLE;
+               case PSI_T_INT128:
+                       res->dval = v1->dval * v2->i128;
+                       return PSI_T_DOUBLE;
+               case PSI_T_UINT128:
+                       res->dval = v1->dval * v2->u128;
+                       return PSI_T_DOUBLE;
                case PSI_T_FLOAT:
                        res->dval = v1->dval * v2->fval;
                        return PSI_T_DOUBLE;
                case PSI_T_FLOAT:
                        res->dval = v1->dval * v2->fval;
                        return PSI_T_DOUBLE;
@@ -1463,6 +1949,12 @@ static inline token_t psi_calc_mul(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->ldval = v1->ldval * v2->u64;
                        return PSI_T_LONG_DOUBLE;
                case PSI_T_UINT64:
                        res->ldval = v1->ldval * v2->u64;
                        return PSI_T_LONG_DOUBLE;
+               case PSI_T_INT128:
+                       res->ldval = v1->ldval * v2->i128;
+                       return PSI_T_LONG_DOUBLE;
+               case PSI_T_UINT128:
+                       res->ldval = v1->ldval * v2->u128;
+                       return PSI_T_LONG_DOUBLE;
                case PSI_T_FLOAT:
                        res->ldval = v1->ldval * v2->fval;
                        return PSI_T_LONG_DOUBLE;
                case PSI_T_FLOAT:
                        res->ldval = v1->ldval * v2->fval;
                        return PSI_T_LONG_DOUBLE;
@@ -1519,6 +2011,12 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i8 / v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i8 / v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i8 / v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i8 / v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i8 / v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i8 / v2->fval;
                        return PSI_T_FLOAT;
@@ -1562,6 +2060,12 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u8 / v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u8 / v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u8 / v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u8 / v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u8 / v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u8 / v2->fval;
                        return PSI_T_FLOAT;
@@ -1605,6 +2109,12 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i16 / v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i16 / v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i16 / v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i16 / v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i16 / v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i16 / v2->fval;
                        return PSI_T_FLOAT;
@@ -1648,6 +2158,12 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u16 / v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u16 / v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u16 / v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u16 / v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u16 / v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u16 / v2->fval;
                        return PSI_T_FLOAT;
@@ -1691,6 +2207,12 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i32 / v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i32 / v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i32 / v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i32 / v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i32 / v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i32 / v2->fval;
                        return PSI_T_FLOAT;
@@ -1734,6 +2256,12 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u32 / v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u32 / v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u32 / v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u32 / v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u32 / v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u32 / v2->fval;
                        return PSI_T_FLOAT;
@@ -1777,6 +2305,12 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->i64 = v1->i64 / v2->u64;
                        return PSI_T_INT64;
                case PSI_T_UINT64:
                        res->i64 = v1->i64 / v2->u64;
                        return PSI_T_INT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->i64 / v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i64 / v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->i64 / v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->i64 / v2->fval;
                        return PSI_T_FLOAT;
@@ -1820,6 +2354,12 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->u64 = v1->u64 / v2->u64;
                        return PSI_T_UINT64;
                case PSI_T_UINT64:
                        res->u64 = v1->u64 / v2->u64;
                        return PSI_T_UINT64;
+               case PSI_T_INT128:
+                       res->i128 = v1->u64 / v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u64 / v2->u128;
+                       return PSI_T_UINT128;
                case PSI_T_FLOAT:
                        res->fval = v1->u64 / v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->u64 / v2->fval;
                        return PSI_T_FLOAT;
@@ -1832,6 +2372,104 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                        return PSI_T_LONG_DOUBLE;
 #      endif
 
                        return PSI_T_LONG_DOUBLE;
 #      endif
 
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_INT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->i128 = v1->i128 / v2->i8;
+                       return PSI_T_INT128;
+               case PSI_T_UINT8:
+                       res->i128 = v1->i128 / v2->u8;
+                       return PSI_T_INT128;
+               case PSI_T_INT16:
+                       res->i128 = v1->i128 / v2->i16;
+                       return PSI_T_INT128;
+               case PSI_T_UINT16:
+                       res->i128 = v1->i128 / v2->u16;
+                       return PSI_T_INT128;
+               case PSI_T_INT32:
+                       res->i128 = v1->i128 / v2->i32;
+                       return PSI_T_INT128;
+               case PSI_T_UINT32:
+                       res->i128 = v1->i128 / v2->u32;
+                       return PSI_T_INT128;
+               case PSI_T_INT64:
+                       res->i128 = v1->i128 / v2->i64;
+                       return PSI_T_INT128;
+               case PSI_T_UINT64:
+                       res->i128 = v1->i128 / v2->u64;
+                       return PSI_T_INT128;
+               case PSI_T_INT128:
+                       res->i128 = v1->i128 / v2->i128;
+                       return PSI_T_INT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->i128 / v2->u128;
+                       return PSI_T_UINT128;
+               case PSI_T_FLOAT:
+                       res->fval = v1->i128 / v2->fval;
+                       return PSI_T_FLOAT;
+               case PSI_T_DOUBLE:
+                       res->dval = v1->i128 / v2->dval;
+                       return PSI_T_DOUBLE;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->ldval = v1->i128 / v2->ldval;
+                       return PSI_T_LONG_DOUBLE;
+#      endif
+
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_UINT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u128 = v1->u128 / v2->i8;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT8:
+                       res->u128 = v1->u128 / v2->u8;
+                       return PSI_T_UINT128;
+               case PSI_T_INT16:
+                       res->u128 = v1->u128 / v2->i16;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT16:
+                       res->u128 = v1->u128 / v2->u16;
+                       return PSI_T_UINT128;
+               case PSI_T_INT32:
+                       res->u128 = v1->u128 / v2->i32;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT32:
+                       res->u128 = v1->u128 / v2->u32;
+                       return PSI_T_UINT128;
+               case PSI_T_INT64:
+                       res->u128 = v1->u128 / v2->i64;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT64:
+                       res->u128 = v1->u128 / v2->u64;
+                       return PSI_T_UINT128;
+               case PSI_T_INT128:
+                       res->u128 = v1->u128 / v2->i128;
+                       return PSI_T_UINT128;
+               case PSI_T_UINT128:
+                       res->u128 = v1->u128 / v2->u128;
+                       return PSI_T_UINT128;
+               case PSI_T_FLOAT:
+                       res->fval = v1->u128 / v2->fval;
+                       return PSI_T_FLOAT;
+               case PSI_T_DOUBLE:
+                       res->dval = v1->u128 / v2->dval;
+                       return PSI_T_DOUBLE;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->ldval = v1->u128 / v2->ldval;
+                       return PSI_T_LONG_DOUBLE;
+#      endif
+
                default:
                        assert(0);
                        break;
                default:
                        assert(0);
                        break;
@@ -1863,6 +2501,12 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->fval = v1->fval / v2->u64;
                        return PSI_T_FLOAT;
                case PSI_T_UINT64:
                        res->fval = v1->fval / v2->u64;
                        return PSI_T_FLOAT;
+               case PSI_T_INT128:
+                       res->fval = v1->fval / v2->i128;
+                       return PSI_T_FLOAT;
+               case PSI_T_UINT128:
+                       res->fval = v1->fval / v2->u128;
+                       return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->fval / v2->fval;
                        return PSI_T_FLOAT;
                case PSI_T_FLOAT:
                        res->fval = v1->fval / v2->fval;
                        return PSI_T_FLOAT;
@@ -1906,6 +2550,12 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->dval = v1->dval / v2->u64;
                        return PSI_T_DOUBLE;
                case PSI_T_UINT64:
                        res->dval = v1->dval / v2->u64;
                        return PSI_T_DOUBLE;
+               case PSI_T_INT128:
+                       res->dval = v1->dval / v2->i128;
+                       return PSI_T_DOUBLE;
+               case PSI_T_UINT128:
+                       res->dval = v1->dval / v2->u128;
+                       return PSI_T_DOUBLE;
                case PSI_T_FLOAT:
                        res->dval = v1->dval / v2->fval;
                        return PSI_T_DOUBLE;
                case PSI_T_FLOAT:
                        res->dval = v1->dval / v2->fval;
                        return PSI_T_DOUBLE;
@@ -1950,6 +2600,12 @@ static inline token_t psi_calc_div(token_t t1, impl_val *v1, token_t t2, impl_va
                case PSI_T_UINT64:
                        res->ldval = v1->ldval / v2->u64;
                        return PSI_T_LONG_DOUBLE;
                case PSI_T_UINT64:
                        res->ldval = v1->ldval / v2->u64;
                        return PSI_T_LONG_DOUBLE;
+               case PSI_T_INT128:
+                       res->ldval = v1->ldval / v2->i128;
+                       return PSI_T_LONG_DOUBLE;
+               case PSI_T_UINT128:
+                       res->ldval = v1->ldval / v2->u128;
+                       return PSI_T_LONG_DOUBLE;
                case PSI_T_FLOAT:
                        res->ldval = v1->ldval / v2->fval;
                        return PSI_T_LONG_DOUBLE;
                case PSI_T_FLOAT:
                        res->ldval = v1->ldval / v2->fval;
                        return PSI_T_LONG_DOUBLE;
@@ -2015,6 +2671,14 @@ static inline token_t psi_calc_mod(token_t t1, impl_val *v1, token_t t2, impl_va
                i1.i64 = v1->u64;
                break;
 
                i1.i64 = v1->u64;
                break;
 
+       case PSI_T_INT128:
+               i1.i64 = v1->i128;
+               break;
+
+       case PSI_T_UINT128:
+               i1.i64 = v1->u128;
+               break;
+
        case PSI_T_FLOAT:
                i1.i64 = v1->fval;
                break;
        case PSI_T_FLOAT:
                i1.i64 = v1->fval;
                break;
@@ -2060,6 +2724,12 @@ static inline token_t psi_calc_mod(token_t t1, impl_val *v1, token_t t2, impl_va
        case PSI_T_UINT64:
                i2.i64 = v2->u64;
                break;
        case PSI_T_UINT64:
                i2.i64 = v2->u64;
                break;
+       case PSI_T_INT128:
+               i2.i64 = v2->i128;
+               break;
+       case PSI_T_UINT128:
+               i2.i64 = v2->u128;
+               break;
        case PSI_T_FLOAT:
                i2.i64 = v2->fval;
                break;
        case PSI_T_FLOAT:
                i2.i64 = v2->fval;
                break;
index 3e9e4a0..772bd98 100644 (file)
@@ -65,6 +65,14 @@ static inline token_t psi_calc_bin_lshift(token_t t1, impl_val *v1, token_t t2,
                i1.u64 = v1->u64;
                break;
 
                i1.u64 = v1->u64;
                break;
 
+       case PSI_T_INT128:
+               i1.u64 = v1->i128;
+               break;
+
+       case PSI_T_UINT128:
+               i1.u64 = v1->u128;
+               break;
+
        case PSI_T_FLOAT:
                i1.u64 = v1->fval;
                break;
        case PSI_T_FLOAT:
                i1.u64 = v1->fval;
                break;
@@ -110,6 +118,12 @@ static inline token_t psi_calc_bin_lshift(token_t t1, impl_val *v1, token_t t2,
        case PSI_T_UINT64:
                i2.u64 = v2->u64;
                break;
        case PSI_T_UINT64:
                i2.u64 = v2->u64;
                break;
+       case PSI_T_INT128:
+               i2.u64 = v2->i128;
+               break;
+       case PSI_T_UINT128:
+               i2.u64 = v2->u128;
+               break;
        case PSI_T_FLOAT:
                i2.u64 = v2->fval;
                break;
        case PSI_T_FLOAT:
                i2.u64 = v2->fval;
                break;
@@ -168,6 +182,14 @@ static inline token_t psi_calc_bin_rshift(token_t t1, impl_val *v1, token_t t2,
                i1.u64 = v1->u64;
                break;
 
                i1.u64 = v1->u64;
                break;
 
+       case PSI_T_INT128:
+               i1.u64 = v1->i128;
+               break;
+
+       case PSI_T_UINT128:
+               i1.u64 = v1->u128;
+               break;
+
        case PSI_T_FLOAT:
                i1.u64 = v1->fval;
                break;
        case PSI_T_FLOAT:
                i1.u64 = v1->fval;
                break;
@@ -213,6 +235,12 @@ static inline token_t psi_calc_bin_rshift(token_t t1, impl_val *v1, token_t t2,
        case PSI_T_UINT64:
                i2.u64 = v2->u64;
                break;
        case PSI_T_UINT64:
                i2.u64 = v2->u64;
                break;
+       case PSI_T_INT128:
+               i2.u64 = v2->i128;
+               break;
+       case PSI_T_UINT128:
+               i2.u64 = v2->u128;
+               break;
        case PSI_T_FLOAT:
                i2.u64 = v2->fval;
                break;
        case PSI_T_FLOAT:
                i2.u64 = v2->fval;
                break;
@@ -271,6 +299,14 @@ static inline token_t psi_calc_bin_and(token_t t1, impl_val *v1, token_t t2, imp
                i1.u64 = v1->u64;
                break;
 
                i1.u64 = v1->u64;
                break;
 
+       case PSI_T_INT128:
+               i1.u64 = v1->i128;
+               break;
+
+       case PSI_T_UINT128:
+               i1.u64 = v1->u128;
+               break;
+
        case PSI_T_FLOAT:
                i1.u64 = v1->fval;
                break;
        case PSI_T_FLOAT:
                i1.u64 = v1->fval;
                break;
@@ -316,6 +352,12 @@ static inline token_t psi_calc_bin_and(token_t t1, impl_val *v1, token_t t2, imp
        case PSI_T_UINT64:
                i2.u64 = v2->u64;
                break;
        case PSI_T_UINT64:
                i2.u64 = v2->u64;
                break;
+       case PSI_T_INT128:
+               i2.u64 = v2->i128;
+               break;
+       case PSI_T_UINT128:
+               i2.u64 = v2->u128;
+               break;
        case PSI_T_FLOAT:
                i2.u64 = v2->fval;
                break;
        case PSI_T_FLOAT:
                i2.u64 = v2->fval;
                break;
@@ -374,6 +416,14 @@ static inline token_t psi_calc_bin_xor(token_t t1, impl_val *v1, token_t t2, imp
                i1.u64 = v1->u64;
                break;
 
                i1.u64 = v1->u64;
                break;
 
+       case PSI_T_INT128:
+               i1.u64 = v1->i128;
+               break;
+
+       case PSI_T_UINT128:
+               i1.u64 = v1->u128;
+               break;
+
        case PSI_T_FLOAT:
                i1.u64 = v1->fval;
                break;
        case PSI_T_FLOAT:
                i1.u64 = v1->fval;
                break;
@@ -419,6 +469,12 @@ static inline token_t psi_calc_bin_xor(token_t t1, impl_val *v1, token_t t2, imp
        case PSI_T_UINT64:
                i2.u64 = v2->u64;
                break;
        case PSI_T_UINT64:
                i2.u64 = v2->u64;
                break;
+       case PSI_T_INT128:
+               i2.u64 = v2->i128;
+               break;
+       case PSI_T_UINT128:
+               i2.u64 = v2->u128;
+               break;
        case PSI_T_FLOAT:
                i2.u64 = v2->fval;
                break;
        case PSI_T_FLOAT:
                i2.u64 = v2->fval;
                break;
@@ -477,6 +533,14 @@ static inline token_t psi_calc_bin_or(token_t t1, impl_val *v1, token_t t2, impl
                i1.u64 = v1->u64;
                break;
 
                i1.u64 = v1->u64;
                break;
 
+       case PSI_T_INT128:
+               i1.u64 = v1->i128;
+               break;
+
+       case PSI_T_UINT128:
+               i1.u64 = v1->u128;
+               break;
+
        case PSI_T_FLOAT:
                i1.u64 = v1->fval;
                break;
        case PSI_T_FLOAT:
                i1.u64 = v1->fval;
                break;
@@ -522,6 +586,12 @@ static inline token_t psi_calc_bin_or(token_t t1, impl_val *v1, token_t t2, impl
        case PSI_T_UINT64:
                i2.u64 = v2->u64;
                break;
        case PSI_T_UINT64:
                i2.u64 = v2->u64;
                break;
+       case PSI_T_INT128:
+               i2.u64 = v2->i128;
+               break;
+       case PSI_T_UINT128:
+               i2.u64 = v2->u128;
+               break;
        case PSI_T_FLOAT:
                i2.u64 = v2->fval;
                break;
        case PSI_T_FLOAT:
                i2.u64 = v2->fval;
                break;
@@ -542,67 +612,3 @@ static inline token_t psi_calc_bin_or(token_t t1, impl_val *v1, token_t t2, impl
        res->u64 = i1.u64 | i2.u64;
        return PSI_T_UINT64;
 }
        res->u64 = i1.u64 | i2.u64;
        return PSI_T_UINT64;
 }
-
-static inline token_t psi_calc_bin_not(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
-{
-       impl_val i1;
-
-       (void) t2;
-       (void) v2;
-
-       switch (t1) {
-       case PSI_T_INT8:
-               i1.u64 = v1->i8;
-               break;
-
-       case PSI_T_UINT8:
-               i1.u64 = v1->u8;
-               break;
-
-       case PSI_T_INT16:
-               i1.u64 = v1->i16;
-               break;
-
-       case PSI_T_UINT16:
-               i1.u64 = v1->u16;
-               break;
-
-       case PSI_T_INT32:
-               i1.u64 = v1->i32;
-               break;
-
-       case PSI_T_UINT32:
-               i1.u64 = v1->u32;
-               break;
-
-       case PSI_T_INT64:
-               i1.u64 = v1->i64;
-               break;
-
-       case PSI_T_UINT64:
-               i1.u64 = v1->u64;
-               break;
-
-       case PSI_T_FLOAT:
-               i1.u64 = v1->fval;
-               break;
-
-       case PSI_T_DOUBLE:
-               i1.u64 = v1->dval;
-               break;
-
-#if HAVE_LONG_DOUBLE
-       case PSI_T_LONG_DOUBLE:
-               i1.u64 = v1->ldval;
-               break;
-
-#endif
-
-       default:
-               assert(0);
-               break;
-       }
-
-       res->u64 = ~i1.u64;
-       return PSI_T_UINT64;
-}
\ No newline at end of file
index 99f5f0a..5fe0ce7 100644 (file)
 #include <assert.h>
 
 #include "token.h"
 #include <assert.h>
 
 #include "token.h"
-
-static inline token_t psi_calc_bool_not(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
-{
-       (void) t2;
-       (void) v2;
-
-       switch (t1) {
-       case PSI_T_INT8:
-               res->u8 = !v1->i8;
-               break;
-       case PSI_T_UINT8:
-               res->u8 = !v1->u8;
-               break;
-       case PSI_T_INT16:
-               res->u8 = !v1->i16;
-               break;
-       case PSI_T_UINT16:
-               res->u8 = !v1->u16;
-               break;
-       case PSI_T_INT32:
-               res->u8 = !v1->i32;
-               break;
-       case PSI_T_UINT32:
-               res->u8 = !v1->u32;
-               break;
-       case PSI_T_INT64:
-               res->u8 = !v1->i64;
-               break;
-       case PSI_T_UINT64:
-               res->u8 = !v1->u64;
-               break;
-       case PSI_T_FLOAT:
-               res->u8 = !v1->fval;
-               break;
-       case PSI_T_DOUBLE:
-               res->u8 = !v1->dval;
-               break;
-#if HAVE_LONG_DOUBLE
-       case PSI_T_LONG_DOUBLE:
-               res->u8 = !v1->ldval;
-               break;
-#endif
-
-       default:
-               assert(0);
-               break;
-       }
-       return PSI_T_UINT8;
-}
-
 static inline token_t psi_calc_bool_or(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
 {
        switch (t1) {
 static inline token_t psi_calc_bool_or(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
 {
        switch (t1) {
@@ -112,6 +62,14 @@ static inline token_t psi_calc_bool_or(token_t t1, impl_val *v1, token_t t2, imp
                if (v1->u64)
                        goto return_true;
                break;
                if (v1->u64)
                        goto return_true;
                break;
+       case PSI_T_INT128:
+               if (v1->i128)
+                       goto return_true;
+               break;
+       case PSI_T_UINT128:
+               if (v1->u128)
+                       goto return_true;
+               break;
        case PSI_T_FLOAT:
                if (v1->fval)
                        goto return_true;
        case PSI_T_FLOAT:
                if (v1->fval)
                        goto return_true;
@@ -165,6 +123,14 @@ static inline token_t psi_calc_bool_or(token_t t1, impl_val *v1, token_t t2, imp
                if (v2->u64)
                        goto return_true;
                break;
                if (v2->u64)
                        goto return_true;
                break;
+       case PSI_T_INT128:
+               if (v2->i128)
+                       goto return_true;
+               break;
+       case PSI_T_UINT128:
+               if (v2->u128)
+                       goto return_true;
+               break;
        case PSI_T_FLOAT:
                if (v2->fval)
                        goto return_true;
        case PSI_T_FLOAT:
                if (v2->fval)
                        goto return_true;
@@ -228,6 +194,14 @@ static inline token_t psi_calc_bool_and(token_t t1, impl_val *v1, token_t t2, im
                if (!v1->u64)
                        goto return_false;
                break;
                if (!v1->u64)
                        goto return_false;
                break;
+       case PSI_T_INT128:
+               if (!v1->i128)
+                       goto return_false;
+               break;
+       case PSI_T_UINT128:
+               if (!v1->u128)
+                       goto return_false;
+               break;
        case PSI_T_FLOAT:
                if (!v1->fval)
                        goto return_false;
        case PSI_T_FLOAT:
                if (!v1->fval)
                        goto return_false;
@@ -281,6 +255,14 @@ static inline token_t psi_calc_bool_and(token_t t1, impl_val *v1, token_t t2, im
                if (!v2->u64)
                        goto return_false;
                break;
                if (!v2->u64)
                        goto return_false;
                break;
+       case PSI_T_INT128:
+               if (!v2->i128)
+                       goto return_false;
+               break;
+       case PSI_T_UINT128:
+               if (!v2->u128)
+                       goto return_false;
+               break;
        case PSI_T_FLOAT:
                if (!v2->fval)
                        goto return_false;
        case PSI_T_FLOAT:
                if (!v2->fval)
                        goto return_false;
index c6f14aa..eb93b3b 100644 (file)
@@ -57,6 +57,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->i8 = in_val->u64;
                        break;
                case PSI_T_UINT64:
                        out_val->i8 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->i8 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->i8 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->i8 = in_val->fval;
                        break;
                case PSI_T_FLOAT:
                        out_val->i8 = in_val->fval;
                        break;
@@ -100,6 +106,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->u8 = in_val->u64;
                        break;
                case PSI_T_UINT64:
                        out_val->u8 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->u8 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->u8 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->u8 = in_val->fval;
                        break;
                case PSI_T_FLOAT:
                        out_val->u8 = in_val->fval;
                        break;
@@ -143,6 +155,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->i16 = in_val->u64;
                        break;
                case PSI_T_UINT64:
                        out_val->i16 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->i16 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->i16 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->i16 = in_val->fval;
                        break;
                case PSI_T_FLOAT:
                        out_val->i16 = in_val->fval;
                        break;
@@ -186,6 +204,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->u16 = in_val->u64;
                        break;
                case PSI_T_UINT64:
                        out_val->u16 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->u16 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->u16 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->u16 = in_val->fval;
                        break;
                case PSI_T_FLOAT:
                        out_val->u16 = in_val->fval;
                        break;
@@ -229,6 +253,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->i32 = in_val->u64;
                        break;
                case PSI_T_UINT64:
                        out_val->i32 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->i32 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->i32 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->i32 = in_val->fval;
                        break;
                case PSI_T_FLOAT:
                        out_val->i32 = in_val->fval;
                        break;
@@ -272,6 +302,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->u32 = in_val->u64;
                        break;
                case PSI_T_UINT64:
                        out_val->u32 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->u32 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->u32 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->u32 = in_val->fval;
                        break;
                case PSI_T_FLOAT:
                        out_val->u32 = in_val->fval;
                        break;
@@ -315,6 +351,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->i64 = in_val->u64;
                        break;
                case PSI_T_UINT64:
                        out_val->i64 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->i64 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->i64 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->i64 = in_val->fval;
                        break;
                case PSI_T_FLOAT:
                        out_val->i64 = in_val->fval;
                        break;
@@ -358,6 +400,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->u64 = in_val->u64;
                        break;
                case PSI_T_UINT64:
                        out_val->u64 = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->u64 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->u64 = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->u64 = in_val->fval;
                        break;
                case PSI_T_FLOAT:
                        out_val->u64 = in_val->fval;
                        break;
@@ -370,6 +418,104 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                        break;
 #      endif
 
                        break;
 #      endif
 
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_INT128:
+               switch (in_type) {
+               case PSI_T_INT8:
+                       out_val->i128 = in_val->i8;
+                       break;
+               case PSI_T_UINT8:
+                       out_val->i128 = in_val->u8;
+                       break;
+               case PSI_T_INT16:
+                       out_val->i128 = in_val->i16;
+                       break;
+               case PSI_T_UINT16:
+                       out_val->i128 = in_val->u16;
+                       break;
+               case PSI_T_INT32:
+                       out_val->i128 = in_val->i32;
+                       break;
+               case PSI_T_UINT32:
+                       out_val->i128 = in_val->u32;
+                       break;
+               case PSI_T_INT64:
+                       out_val->i128 = in_val->i64;
+                       break;
+               case PSI_T_UINT64:
+                       out_val->i128 = in_val->u64;
+                       break;
+               case PSI_T_INT128:
+                       out_val->i128 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->i128 = in_val->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       out_val->i128 = in_val->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       out_val->i128 = in_val->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       out_val->i128 = in_val->ldval;
+                       break;
+#      endif
+
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_UINT128:
+               switch (in_type) {
+               case PSI_T_INT8:
+                       out_val->u128 = in_val->i8;
+                       break;
+               case PSI_T_UINT8:
+                       out_val->u128 = in_val->u8;
+                       break;
+               case PSI_T_INT16:
+                       out_val->u128 = in_val->i16;
+                       break;
+               case PSI_T_UINT16:
+                       out_val->u128 = in_val->u16;
+                       break;
+               case PSI_T_INT32:
+                       out_val->u128 = in_val->i32;
+                       break;
+               case PSI_T_UINT32:
+                       out_val->u128 = in_val->u32;
+                       break;
+               case PSI_T_INT64:
+                       out_val->u128 = in_val->i64;
+                       break;
+               case PSI_T_UINT64:
+                       out_val->u128 = in_val->u64;
+                       break;
+               case PSI_T_INT128:
+                       out_val->u128 = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->u128 = in_val->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       out_val->u128 = in_val->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       out_val->u128 = in_val->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       out_val->u128 = in_val->ldval;
+                       break;
+#      endif
+
                default:
                        assert(0);
                        break;
                default:
                        assert(0);
                        break;
@@ -401,6 +547,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->fval = in_val->u64;
                        break;
                case PSI_T_UINT64:
                        out_val->fval = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->fval = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->fval = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->fval = in_val->fval;
                        break;
                case PSI_T_FLOAT:
                        out_val->fval = in_val->fval;
                        break;
@@ -444,6 +596,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->dval = in_val->u64;
                        break;
                case PSI_T_UINT64:
                        out_val->dval = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->dval = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->dval = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->dval = in_val->fval;
                        break;
                case PSI_T_FLOAT:
                        out_val->dval = in_val->fval;
                        break;
@@ -488,6 +646,12 @@ static inline void psi_calc_cast(token_t in_type, impl_val *in_val, token_t out_
                case PSI_T_UINT64:
                        out_val->ldval = in_val->u64;
                        break;
                case PSI_T_UINT64:
                        out_val->ldval = in_val->u64;
                        break;
+               case PSI_T_INT128:
+                       out_val->ldval = in_val->i128;
+                       break;
+               case PSI_T_UINT128:
+                       out_val->ldval = in_val->u128;
+                       break;
                case PSI_T_FLOAT:
                        out_val->ldval = in_val->fval;
                        break;
                case PSI_T_FLOAT:
                        out_val->ldval = in_val->fval;
                        break;
index 8fac2f3..30bc0c9 100644 (file)
@@ -57,6 +57,12 @@ static inline token_t psi_calc_cmp_eq(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i8 == v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i8 == v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i8 == v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i8 == v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i8 == v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i8 == v2->fval;
                        break;
@@ -100,6 +106,12 @@ static inline token_t psi_calc_cmp_eq(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u8 == v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u8 == v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u8 == v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u8 == v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u8 == v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u8 == v2->fval;
                        break;
@@ -143,6 +155,12 @@ static inline token_t psi_calc_cmp_eq(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i16 == v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i16 == v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i16 == v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i16 == v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i16 == v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i16 == v2->fval;
                        break;
@@ -186,6 +204,12 @@ static inline token_t psi_calc_cmp_eq(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u16 == v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u16 == v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u16 == v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u16 == v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u16 == v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u16 == v2->fval;
                        break;
@@ -229,6 +253,12 @@ static inline token_t psi_calc_cmp_eq(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i32 == v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i32 == v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i32 == v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i32 == v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i32 == v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i32 == v2->fval;
                        break;
@@ -272,6 +302,12 @@ static inline token_t psi_calc_cmp_eq(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u32 == v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u32 == v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u32 == v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u32 == v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u32 == v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u32 == v2->fval;
                        break;
@@ -315,6 +351,12 @@ static inline token_t psi_calc_cmp_eq(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i64 == v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i64 == v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i64 == v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i64 == v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i64 == v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i64 == v2->fval;
                        break;
@@ -358,6 +400,12 @@ static inline token_t psi_calc_cmp_eq(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u64 == v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u64 == v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u64 == v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u64 == v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u64 == v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u64 == v2->fval;
                        break;
@@ -370,6 +418,104 @@ static inline token_t psi_calc_cmp_eq(token_t t1, impl_val *v1, token_t t2, impl
                        break;
 #      endif
 
                        break;
 #      endif
 
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_INT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u8 = v1->i128 == v2->i8;
+                       break;
+               case PSI_T_UINT8:
+                       res->u8 = v1->i128 == v2->u8;
+                       break;
+               case PSI_T_INT16:
+                       res->u8 = v1->i128 == v2->i16;
+                       break;
+               case PSI_T_UINT16:
+                       res->u8 = v1->i128 == v2->u16;
+                       break;
+               case PSI_T_INT32:
+                       res->u8 = v1->i128 == v2->i32;
+                       break;
+               case PSI_T_UINT32:
+                       res->u8 = v1->i128 == v2->u32;
+                       break;
+               case PSI_T_INT64:
+                       res->u8 = v1->i128 == v2->i64;
+                       break;
+               case PSI_T_UINT64:
+                       res->u8 = v1->i128 == v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i128 == v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i128 == v2->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       res->u8 = v1->i128 == v2->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       res->u8 = v1->i128 == v2->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->u8 = v1->i128 == v2->ldval;
+                       break;
+#      endif
+
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_UINT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u8 = v1->u128 == v2->i8;
+                       break;
+               case PSI_T_UINT8:
+                       res->u8 = v1->u128 == v2->u8;
+                       break;
+               case PSI_T_INT16:
+                       res->u8 = v1->u128 == v2->i16;
+                       break;
+               case PSI_T_UINT16:
+                       res->u8 = v1->u128 == v2->u16;
+                       break;
+               case PSI_T_INT32:
+                       res->u8 = v1->u128 == v2->i32;
+                       break;
+               case PSI_T_UINT32:
+                       res->u8 = v1->u128 == v2->u32;
+                       break;
+               case PSI_T_INT64:
+                       res->u8 = v1->u128 == v2->i64;
+                       break;
+               case PSI_T_UINT64:
+                       res->u8 = v1->u128 == v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u128 == v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u128 == v2->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       res->u8 = v1->u128 == v2->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       res->u8 = v1->u128 == v2->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->u8 = v1->u128 == v2->ldval;
+                       break;
+#      endif
+
                default:
                        assert(0);
                        break;
                default:
                        assert(0);
                        break;
@@ -401,6 +547,12 @@ static inline token_t psi_calc_cmp_eq(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->fval == v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->fval == v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->fval == v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->fval == v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->fval == v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->fval == v2->fval;
                        break;
@@ -444,6 +596,12 @@ static inline token_t psi_calc_cmp_eq(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->dval == v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->dval == v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->dval == v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->dval == v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->dval == v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->dval == v2->fval;
                        break;
@@ -488,6 +646,12 @@ static inline token_t psi_calc_cmp_eq(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->ldval == v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->ldval == v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->ldval == v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->ldval == v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->ldval == v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->ldval == v2->fval;
                        break;
@@ -543,6 +707,12 @@ static inline token_t psi_calc_cmp_ne(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i8 != v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i8 != v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i8 != v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i8 != v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i8 != v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i8 != v2->fval;
                        break;
@@ -586,6 +756,12 @@ static inline token_t psi_calc_cmp_ne(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u8 != v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u8 != v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u8 != v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u8 != v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u8 != v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u8 != v2->fval;
                        break;
@@ -629,6 +805,12 @@ static inline token_t psi_calc_cmp_ne(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i16 != v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i16 != v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i16 != v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i16 != v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i16 != v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i16 != v2->fval;
                        break;
@@ -672,6 +854,12 @@ static inline token_t psi_calc_cmp_ne(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u16 != v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u16 != v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u16 != v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u16 != v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u16 != v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u16 != v2->fval;
                        break;
@@ -715,6 +903,12 @@ static inline token_t psi_calc_cmp_ne(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i32 != v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i32 != v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i32 != v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i32 != v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i32 != v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i32 != v2->fval;
                        break;
@@ -758,6 +952,12 @@ static inline token_t psi_calc_cmp_ne(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u32 != v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u32 != v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u32 != v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u32 != v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u32 != v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u32 != v2->fval;
                        break;
@@ -801,6 +1001,12 @@ static inline token_t psi_calc_cmp_ne(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i64 != v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i64 != v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i64 != v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i64 != v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i64 != v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i64 != v2->fval;
                        break;
@@ -844,6 +1050,12 @@ static inline token_t psi_calc_cmp_ne(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u64 != v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u64 != v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u64 != v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u64 != v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u64 != v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u64 != v2->fval;
                        break;
@@ -856,6 +1068,104 @@ static inline token_t psi_calc_cmp_ne(token_t t1, impl_val *v1, token_t t2, impl
                        break;
 #      endif
 
                        break;
 #      endif
 
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_INT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u8 = v1->i128 != v2->i8;
+                       break;
+               case PSI_T_UINT8:
+                       res->u8 = v1->i128 != v2->u8;
+                       break;
+               case PSI_T_INT16:
+                       res->u8 = v1->i128 != v2->i16;
+                       break;
+               case PSI_T_UINT16:
+                       res->u8 = v1->i128 != v2->u16;
+                       break;
+               case PSI_T_INT32:
+                       res->u8 = v1->i128 != v2->i32;
+                       break;
+               case PSI_T_UINT32:
+                       res->u8 = v1->i128 != v2->u32;
+                       break;
+               case PSI_T_INT64:
+                       res->u8 = v1->i128 != v2->i64;
+                       break;
+               case PSI_T_UINT64:
+                       res->u8 = v1->i128 != v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i128 != v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i128 != v2->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       res->u8 = v1->i128 != v2->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       res->u8 = v1->i128 != v2->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->u8 = v1->i128 != v2->ldval;
+                       break;
+#      endif
+
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_UINT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u8 = v1->u128 != v2->i8;
+                       break;
+               case PSI_T_UINT8:
+                       res->u8 = v1->u128 != v2->u8;
+                       break;
+               case PSI_T_INT16:
+                       res->u8 = v1->u128 != v2->i16;
+                       break;
+               case PSI_T_UINT16:
+                       res->u8 = v1->u128 != v2->u16;
+                       break;
+               case PSI_T_INT32:
+                       res->u8 = v1->u128 != v2->i32;
+                       break;
+               case PSI_T_UINT32:
+                       res->u8 = v1->u128 != v2->u32;
+                       break;
+               case PSI_T_INT64:
+                       res->u8 = v1->u128 != v2->i64;
+                       break;
+               case PSI_T_UINT64:
+                       res->u8 = v1->u128 != v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u128 != v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u128 != v2->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       res->u8 = v1->u128 != v2->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       res->u8 = v1->u128 != v2->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->u8 = v1->u128 != v2->ldval;
+                       break;
+#      endif
+
                default:
                        assert(0);
                        break;
                default:
                        assert(0);
                        break;
@@ -887,6 +1197,12 @@ static inline token_t psi_calc_cmp_ne(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->fval != v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->fval != v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->fval != v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->fval != v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->fval != v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->fval != v2->fval;
                        break;
@@ -930,6 +1246,12 @@ static inline token_t psi_calc_cmp_ne(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->dval != v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->dval != v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->dval != v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->dval != v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->dval != v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->dval != v2->fval;
                        break;
@@ -974,6 +1296,12 @@ static inline token_t psi_calc_cmp_ne(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->ldval != v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->ldval != v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->ldval != v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->ldval != v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->ldval != v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->ldval != v2->fval;
                        break;
@@ -1029,6 +1357,12 @@ static inline token_t psi_calc_cmp_lt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i8 < v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i8 < v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i8 < v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i8 < v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i8 < v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i8 < v2->fval;
                        break;
@@ -1072,6 +1406,12 @@ static inline token_t psi_calc_cmp_lt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u8 < v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u8 < v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u8 < v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u8 < v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u8 < v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u8 < v2->fval;
                        break;
@@ -1115,6 +1455,12 @@ static inline token_t psi_calc_cmp_lt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i16 < v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i16 < v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i16 < v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i16 < v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i16 < v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i16 < v2->fval;
                        break;
@@ -1158,6 +1504,12 @@ static inline token_t psi_calc_cmp_lt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u16 < v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u16 < v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u16 < v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u16 < v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u16 < v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u16 < v2->fval;
                        break;
@@ -1201,6 +1553,12 @@ static inline token_t psi_calc_cmp_lt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i32 < v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i32 < v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i32 < v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i32 < v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i32 < v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i32 < v2->fval;
                        break;
@@ -1244,6 +1602,12 @@ static inline token_t psi_calc_cmp_lt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u32 < v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u32 < v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u32 < v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u32 < v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u32 < v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u32 < v2->fval;
                        break;
@@ -1287,6 +1651,12 @@ static inline token_t psi_calc_cmp_lt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i64 < v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i64 < v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i64 < v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i64 < v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i64 < v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i64 < v2->fval;
                        break;
@@ -1330,6 +1700,12 @@ static inline token_t psi_calc_cmp_lt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u64 < v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u64 < v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u64 < v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u64 < v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u64 < v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u64 < v2->fval;
                        break;
@@ -1347,41 +1723,47 @@ static inline token_t psi_calc_cmp_lt(token_t t1, impl_val *v1, token_t t2, impl
                        break;
                }
                break;
                        break;
                }
                break;
-       case PSI_T_FLOAT:
+       case PSI_T_INT128:
                switch (t2) {
                case PSI_T_INT8:
                switch (t2) {
                case PSI_T_INT8:
-                       res->u8 = v1->fval < v2->i8;
+                       res->u8 = v1->i128 < v2->i8;
                        break;
                case PSI_T_UINT8:
                        break;
                case PSI_T_UINT8:
-                       res->u8 = v1->fval < v2->u8;
+                       res->u8 = v1->i128 < v2->u8;
                        break;
                case PSI_T_INT16:
                        break;
                case PSI_T_INT16:
-                       res->u8 = v1->fval < v2->i16;
+                       res->u8 = v1->i128 < v2->i16;
                        break;
                case PSI_T_UINT16:
                        break;
                case PSI_T_UINT16:
-                       res->u8 = v1->fval < v2->u16;
+                       res->u8 = v1->i128 < v2->u16;
                        break;
                case PSI_T_INT32:
                        break;
                case PSI_T_INT32:
-                       res->u8 = v1->fval < v2->i32;
+                       res->u8 = v1->i128 < v2->i32;
                        break;
                case PSI_T_UINT32:
                        break;
                case PSI_T_UINT32:
-                       res->u8 = v1->fval < v2->u32;
+                       res->u8 = v1->i128 < v2->u32;
                        break;
                case PSI_T_INT64:
                        break;
                case PSI_T_INT64:
-                       res->u8 = v1->fval < v2->i64;
+                       res->u8 = v1->i128 < v2->i64;
                        break;
                case PSI_T_UINT64:
                        break;
                case PSI_T_UINT64:
-                       res->u8 = v1->fval < v2->u64;
+                       res->u8 = v1->i128 < v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i128 < v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i128 < v2->u128;
                        break;
                case PSI_T_FLOAT:
                        break;
                case PSI_T_FLOAT:
-                       res->u8 = v1->fval < v2->fval;
+                       res->u8 = v1->i128 < v2->fval;
                        break;
                case PSI_T_DOUBLE:
                        break;
                case PSI_T_DOUBLE:
-                       res->u8 = v1->fval < v2->dval;
+                       res->u8 = v1->i128 < v2->dval;
                        break;
 #      if HAVE_LONG_DOUBLE
                case PSI_T_LONG_DOUBLE:
                        break;
 #      if HAVE_LONG_DOUBLE
                case PSI_T_LONG_DOUBLE:
-                       res->u8 = v1->fval < v2->ldval;
+                       res->u8 = v1->i128 < v2->ldval;
                        break;
 #      endif
 
                        break;
 #      endif
 
@@ -1390,41 +1772,47 @@ static inline token_t psi_calc_cmp_lt(token_t t1, impl_val *v1, token_t t2, impl
                        break;
                }
                break;
                        break;
                }
                break;
-       case PSI_T_DOUBLE:
+       case PSI_T_UINT128:
                switch (t2) {
                case PSI_T_INT8:
                switch (t2) {
                case PSI_T_INT8:
-                       res->u8 = v1->dval < v2->i8;
+                       res->u8 = v1->u128 < v2->i8;
                        break;
                case PSI_T_UINT8:
                        break;
                case PSI_T_UINT8:
-                       res->u8 = v1->dval < v2->u8;
+                       res->u8 = v1->u128 < v2->u8;
                        break;
                case PSI_T_INT16:
                        break;
                case PSI_T_INT16:
-                       res->u8 = v1->dval < v2->i16;
+                       res->u8 = v1->u128 < v2->i16;
                        break;
                case PSI_T_UINT16:
                        break;
                case PSI_T_UINT16:
-                       res->u8 = v1->dval < v2->u16;
+                       res->u8 = v1->u128 < v2->u16;
                        break;
                case PSI_T_INT32:
                        break;
                case PSI_T_INT32:
-                       res->u8 = v1->dval < v2->i32;
+                       res->u8 = v1->u128 < v2->i32;
                        break;
                case PSI_T_UINT32:
                        break;
                case PSI_T_UINT32:
-                       res->u8 = v1->dval < v2->u32;
+                       res->u8 = v1->u128 < v2->u32;
                        break;
                case PSI_T_INT64:
                        break;
                case PSI_T_INT64:
-                       res->u8 = v1->dval < v2->i64;
+                       res->u8 = v1->u128 < v2->i64;
                        break;
                case PSI_T_UINT64:
                        break;
                case PSI_T_UINT64:
-                       res->u8 = v1->dval < v2->u64;
+                       res->u8 = v1->u128 < v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u128 < v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u128 < v2->u128;
                        break;
                case PSI_T_FLOAT:
                        break;
                case PSI_T_FLOAT:
-                       res->u8 = v1->dval < v2->fval;
+                       res->u8 = v1->u128 < v2->fval;
                        break;
                case PSI_T_DOUBLE:
                        break;
                case PSI_T_DOUBLE:
-                       res->u8 = v1->dval < v2->dval;
+                       res->u8 = v1->u128 < v2->dval;
                        break;
 #      if HAVE_LONG_DOUBLE
                case PSI_T_LONG_DOUBLE:
                        break;
 #      if HAVE_LONG_DOUBLE
                case PSI_T_LONG_DOUBLE:
-                       res->u8 = v1->dval < v2->ldval;
+                       res->u8 = v1->u128 < v2->ldval;
                        break;
 #      endif
 
                        break;
 #      endif
 
@@ -1433,42 +1821,47 @@ static inline token_t psi_calc_cmp_lt(token_t t1, impl_val *v1, token_t t2, impl
                        break;
                }
                break;
                        break;
                }
                break;
-#if HAVE_LONG_DOUBLE
-       case PSI_T_LONG_DOUBLE:
+       case PSI_T_FLOAT:
                switch (t2) {
                case PSI_T_INT8:
                switch (t2) {
                case PSI_T_INT8:
-                       res->u8 = v1->ldval < v2->i8;
+                       res->u8 = v1->fval < v2->i8;
                        break;
                case PSI_T_UINT8:
                        break;
                case PSI_T_UINT8:
-                       res->u8 = v1->ldval < v2->u8;
+                       res->u8 = v1->fval < v2->u8;
                        break;
                case PSI_T_INT16:
                        break;
                case PSI_T_INT16:
-                       res->u8 = v1->ldval < v2->i16;
+                       res->u8 = v1->fval < v2->i16;
                        break;
                case PSI_T_UINT16:
                        break;
                case PSI_T_UINT16:
-                       res->u8 = v1->ldval < v2->u16;
+                       res->u8 = v1->fval < v2->u16;
                        break;
                case PSI_T_INT32:
                        break;
                case PSI_T_INT32:
-                       res->u8 = v1->ldval < v2->i32;
+                       res->u8 = v1->fval < v2->i32;
                        break;
                case PSI_T_UINT32:
                        break;
                case PSI_T_UINT32:
-                       res->u8 = v1->ldval < v2->u32;
+                       res->u8 = v1->fval < v2->u32;
                        break;
                case PSI_T_INT64:
                        break;
                case PSI_T_INT64:
-                       res->u8 = v1->ldval < v2->i64;
+                       res->u8 = v1->fval < v2->i64;
                        break;
                case PSI_T_UINT64:
                        break;
                case PSI_T_UINT64:
-                       res->u8 = v1->ldval < v2->u64;
+                       res->u8 = v1->fval < v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->fval < v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->fval < v2->u128;
                        break;
                case PSI_T_FLOAT:
                        break;
                case PSI_T_FLOAT:
-                       res->u8 = v1->ldval < v2->fval;
+                       res->u8 = v1->fval < v2->fval;
                        break;
                case PSI_T_DOUBLE:
                        break;
                case PSI_T_DOUBLE:
-                       res->u8 = v1->ldval < v2->dval;
+                       res->u8 = v1->fval < v2->dval;
                        break;
 #      if HAVE_LONG_DOUBLE
                case PSI_T_LONG_DOUBLE:
                        break;
 #      if HAVE_LONG_DOUBLE
                case PSI_T_LONG_DOUBLE:
-                       res->u8 = v1->ldval < v2->ldval;
+                       res->u8 = v1->fval < v2->ldval;
                        break;
 #      endif
 
                        break;
 #      endif
 
@@ -1477,15 +1870,114 @@ static inline token_t psi_calc_cmp_lt(token_t t1, impl_val *v1, token_t t2, impl
                        break;
                }
                break;
                        break;
                }
                break;
-#endif
-
-       default:
-               assert(0);
-               break;
-       }
-       return PSI_T_UINT8;
-}
-
+       case PSI_T_DOUBLE:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u8 = v1->dval < v2->i8;
+                       break;
+               case PSI_T_UINT8:
+                       res->u8 = v1->dval < v2->u8;
+                       break;
+               case PSI_T_INT16:
+                       res->u8 = v1->dval < v2->i16;
+                       break;
+               case PSI_T_UINT16:
+                       res->u8 = v1->dval < v2->u16;
+                       break;
+               case PSI_T_INT32:
+                       res->u8 = v1->dval < v2->i32;
+                       break;
+               case PSI_T_UINT32:
+                       res->u8 = v1->dval < v2->u32;
+                       break;
+               case PSI_T_INT64:
+                       res->u8 = v1->dval < v2->i64;
+                       break;
+               case PSI_T_UINT64:
+                       res->u8 = v1->dval < v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->dval < v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->dval < v2->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       res->u8 = v1->dval < v2->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       res->u8 = v1->dval < v2->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->u8 = v1->dval < v2->ldval;
+                       break;
+#      endif
+
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+#if HAVE_LONG_DOUBLE
+       case PSI_T_LONG_DOUBLE:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u8 = v1->ldval < v2->i8;
+                       break;
+               case PSI_T_UINT8:
+                       res->u8 = v1->ldval < v2->u8;
+                       break;
+               case PSI_T_INT16:
+                       res->u8 = v1->ldval < v2->i16;
+                       break;
+               case PSI_T_UINT16:
+                       res->u8 = v1->ldval < v2->u16;
+                       break;
+               case PSI_T_INT32:
+                       res->u8 = v1->ldval < v2->i32;
+                       break;
+               case PSI_T_UINT32:
+                       res->u8 = v1->ldval < v2->u32;
+                       break;
+               case PSI_T_INT64:
+                       res->u8 = v1->ldval < v2->i64;
+                       break;
+               case PSI_T_UINT64:
+                       res->u8 = v1->ldval < v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->ldval < v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->ldval < v2->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       res->u8 = v1->ldval < v2->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       res->u8 = v1->ldval < v2->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->u8 = v1->ldval < v2->ldval;
+                       break;
+#      endif
+
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+#endif
+
+       default:
+               assert(0);
+               break;
+       }
+       return PSI_T_UINT8;
+}
+
 static inline token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
 {
        switch (t1) {
 static inline token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
 {
        switch (t1) {
@@ -1515,6 +2007,12 @@ static inline token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i8 > v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i8 > v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i8 > v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i8 > v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i8 > v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i8 > v2->fval;
                        break;
@@ -1558,6 +2056,12 @@ static inline token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u8 > v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u8 > v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u8 > v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u8 > v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u8 > v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u8 > v2->fval;
                        break;
@@ -1601,6 +2105,12 @@ static inline token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i16 > v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i16 > v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i16 > v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i16 > v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i16 > v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i16 > v2->fval;
                        break;
@@ -1644,6 +2154,12 @@ static inline token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u16 > v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u16 > v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u16 > v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u16 > v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u16 > v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u16 > v2->fval;
                        break;
@@ -1687,6 +2203,12 @@ static inline token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i32 > v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i32 > v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i32 > v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i32 > v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i32 > v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i32 > v2->fval;
                        break;
@@ -1730,6 +2252,12 @@ static inline token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u32 > v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u32 > v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u32 > v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u32 > v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u32 > v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u32 > v2->fval;
                        break;
@@ -1773,6 +2301,12 @@ static inline token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i64 > v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i64 > v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i64 > v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i64 > v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i64 > v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i64 > v2->fval;
                        break;
@@ -1816,6 +2350,12 @@ static inline token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u64 > v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u64 > v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u64 > v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u64 > v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u64 > v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u64 > v2->fval;
                        break;
@@ -1828,6 +2368,104 @@ static inline token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl
                        break;
 #      endif
 
                        break;
 #      endif
 
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_INT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u8 = v1->i128 > v2->i8;
+                       break;
+               case PSI_T_UINT8:
+                       res->u8 = v1->i128 > v2->u8;
+                       break;
+               case PSI_T_INT16:
+                       res->u8 = v1->i128 > v2->i16;
+                       break;
+               case PSI_T_UINT16:
+                       res->u8 = v1->i128 > v2->u16;
+                       break;
+               case PSI_T_INT32:
+                       res->u8 = v1->i128 > v2->i32;
+                       break;
+               case PSI_T_UINT32:
+                       res->u8 = v1->i128 > v2->u32;
+                       break;
+               case PSI_T_INT64:
+                       res->u8 = v1->i128 > v2->i64;
+                       break;
+               case PSI_T_UINT64:
+                       res->u8 = v1->i128 > v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i128 > v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i128 > v2->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       res->u8 = v1->i128 > v2->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       res->u8 = v1->i128 > v2->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->u8 = v1->i128 > v2->ldval;
+                       break;
+#      endif
+
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_UINT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u8 = v1->u128 > v2->i8;
+                       break;
+               case PSI_T_UINT8:
+                       res->u8 = v1->u128 > v2->u8;
+                       break;
+               case PSI_T_INT16:
+                       res->u8 = v1->u128 > v2->i16;
+                       break;
+               case PSI_T_UINT16:
+                       res->u8 = v1->u128 > v2->u16;
+                       break;
+               case PSI_T_INT32:
+                       res->u8 = v1->u128 > v2->i32;
+                       break;
+               case PSI_T_UINT32:
+                       res->u8 = v1->u128 > v2->u32;
+                       break;
+               case PSI_T_INT64:
+                       res->u8 = v1->u128 > v2->i64;
+                       break;
+               case PSI_T_UINT64:
+                       res->u8 = v1->u128 > v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u128 > v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u128 > v2->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       res->u8 = v1->u128 > v2->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       res->u8 = v1->u128 > v2->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->u8 = v1->u128 > v2->ldval;
+                       break;
+#      endif
+
                default:
                        assert(0);
                        break;
                default:
                        assert(0);
                        break;
@@ -1859,6 +2497,12 @@ static inline token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->fval > v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->fval > v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->fval > v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->fval > v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->fval > v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->fval > v2->fval;
                        break;
@@ -1902,6 +2546,12 @@ static inline token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->dval > v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->dval > v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->dval > v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->dval > v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->dval > v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->dval > v2->fval;
                        break;
@@ -1946,6 +2596,12 @@ static inline token_t psi_calc_cmp_gt(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->ldval > v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->ldval > v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->ldval > v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->ldval > v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->ldval > v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->ldval > v2->fval;
                        break;
@@ -2001,6 +2657,12 @@ static inline token_t psi_calc_cmp_le(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i8 <= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i8 <= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i8 <= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i8 <= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i8 <= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i8 <= v2->fval;
                        break;
@@ -2044,6 +2706,12 @@ static inline token_t psi_calc_cmp_le(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u8 <= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u8 <= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u8 <= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u8 <= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u8 <= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u8 <= v2->fval;
                        break;
@@ -2087,6 +2755,12 @@ static inline token_t psi_calc_cmp_le(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i16 <= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i16 <= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i16 <= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i16 <= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i16 <= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i16 <= v2->fval;
                        break;
@@ -2130,6 +2804,12 @@ static inline token_t psi_calc_cmp_le(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u16 <= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u16 <= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u16 <= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u16 <= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u16 <= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u16 <= v2->fval;
                        break;
@@ -2173,6 +2853,12 @@ static inline token_t psi_calc_cmp_le(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i32 <= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i32 <= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i32 <= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i32 <= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i32 <= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i32 <= v2->fval;
                        break;
@@ -2216,6 +2902,12 @@ static inline token_t psi_calc_cmp_le(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u32 <= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u32 <= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u32 <= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u32 <= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u32 <= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u32 <= v2->fval;
                        break;
@@ -2259,6 +2951,12 @@ static inline token_t psi_calc_cmp_le(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i64 <= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i64 <= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i64 <= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i64 <= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i64 <= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i64 <= v2->fval;
                        break;
@@ -2302,6 +3000,12 @@ static inline token_t psi_calc_cmp_le(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u64 <= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u64 <= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u64 <= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u64 <= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u64 <= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u64 <= v2->fval;
                        break;
@@ -2314,6 +3018,104 @@ static inline token_t psi_calc_cmp_le(token_t t1, impl_val *v1, token_t t2, impl
                        break;
 #      endif
 
                        break;
 #      endif
 
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_INT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u8 = v1->i128 <= v2->i8;
+                       break;
+               case PSI_T_UINT8:
+                       res->u8 = v1->i128 <= v2->u8;
+                       break;
+               case PSI_T_INT16:
+                       res->u8 = v1->i128 <= v2->i16;
+                       break;
+               case PSI_T_UINT16:
+                       res->u8 = v1->i128 <= v2->u16;
+                       break;
+               case PSI_T_INT32:
+                       res->u8 = v1->i128 <= v2->i32;
+                       break;
+               case PSI_T_UINT32:
+                       res->u8 = v1->i128 <= v2->u32;
+                       break;
+               case PSI_T_INT64:
+                       res->u8 = v1->i128 <= v2->i64;
+                       break;
+               case PSI_T_UINT64:
+                       res->u8 = v1->i128 <= v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i128 <= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i128 <= v2->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       res->u8 = v1->i128 <= v2->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       res->u8 = v1->i128 <= v2->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->u8 = v1->i128 <= v2->ldval;
+                       break;
+#      endif
+
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_UINT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u8 = v1->u128 <= v2->i8;
+                       break;
+               case PSI_T_UINT8:
+                       res->u8 = v1->u128 <= v2->u8;
+                       break;
+               case PSI_T_INT16:
+                       res->u8 = v1->u128 <= v2->i16;
+                       break;
+               case PSI_T_UINT16:
+                       res->u8 = v1->u128 <= v2->u16;
+                       break;
+               case PSI_T_INT32:
+                       res->u8 = v1->u128 <= v2->i32;
+                       break;
+               case PSI_T_UINT32:
+                       res->u8 = v1->u128 <= v2->u32;
+                       break;
+               case PSI_T_INT64:
+                       res->u8 = v1->u128 <= v2->i64;
+                       break;
+               case PSI_T_UINT64:
+                       res->u8 = v1->u128 <= v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u128 <= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u128 <= v2->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       res->u8 = v1->u128 <= v2->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       res->u8 = v1->u128 <= v2->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->u8 = v1->u128 <= v2->ldval;
+                       break;
+#      endif
+
                default:
                        assert(0);
                        break;
                default:
                        assert(0);
                        break;
@@ -2345,6 +3147,12 @@ static inline token_t psi_calc_cmp_le(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->fval <= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->fval <= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->fval <= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->fval <= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->fval <= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->fval <= v2->fval;
                        break;
@@ -2388,6 +3196,12 @@ static inline token_t psi_calc_cmp_le(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->dval <= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->dval <= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->dval <= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->dval <= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->dval <= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->dval <= v2->fval;
                        break;
@@ -2432,6 +3246,12 @@ static inline token_t psi_calc_cmp_le(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->ldval <= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->ldval <= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->ldval <= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->ldval <= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->ldval <= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->ldval <= v2->fval;
                        break;
@@ -2487,6 +3307,12 @@ static inline token_t psi_calc_cmp_ge(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i8 >= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i8 >= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i8 >= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i8 >= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i8 >= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i8 >= v2->fval;
                        break;
@@ -2530,6 +3356,12 @@ static inline token_t psi_calc_cmp_ge(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u8 >= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u8 >= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u8 >= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u8 >= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u8 >= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u8 >= v2->fval;
                        break;
@@ -2573,6 +3405,12 @@ static inline token_t psi_calc_cmp_ge(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i16 >= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i16 >= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i16 >= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i16 >= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i16 >= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i16 >= v2->fval;
                        break;
@@ -2616,6 +3454,12 @@ static inline token_t psi_calc_cmp_ge(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u16 >= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u16 >= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u16 >= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u16 >= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u16 >= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u16 >= v2->fval;
                        break;
@@ -2659,6 +3503,12 @@ static inline token_t psi_calc_cmp_ge(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i32 >= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i32 >= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i32 >= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i32 >= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i32 >= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i32 >= v2->fval;
                        break;
@@ -2702,6 +3552,12 @@ static inline token_t psi_calc_cmp_ge(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u32 >= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u32 >= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u32 >= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u32 >= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u32 >= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u32 >= v2->fval;
                        break;
@@ -2745,6 +3601,12 @@ static inline token_t psi_calc_cmp_ge(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->i64 >= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->i64 >= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i64 >= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i64 >= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i64 >= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->i64 >= v2->fval;
                        break;
@@ -2788,6 +3650,12 @@ static inline token_t psi_calc_cmp_ge(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->u64 >= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->u64 >= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u64 >= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u64 >= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u64 >= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->u64 >= v2->fval;
                        break;
@@ -2800,6 +3668,104 @@ static inline token_t psi_calc_cmp_ge(token_t t1, impl_val *v1, token_t t2, impl
                        break;
 #      endif
 
                        break;
 #      endif
 
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_INT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u8 = v1->i128 >= v2->i8;
+                       break;
+               case PSI_T_UINT8:
+                       res->u8 = v1->i128 >= v2->u8;
+                       break;
+               case PSI_T_INT16:
+                       res->u8 = v1->i128 >= v2->i16;
+                       break;
+               case PSI_T_UINT16:
+                       res->u8 = v1->i128 >= v2->u16;
+                       break;
+               case PSI_T_INT32:
+                       res->u8 = v1->i128 >= v2->i32;
+                       break;
+               case PSI_T_UINT32:
+                       res->u8 = v1->i128 >= v2->u32;
+                       break;
+               case PSI_T_INT64:
+                       res->u8 = v1->i128 >= v2->i64;
+                       break;
+               case PSI_T_UINT64:
+                       res->u8 = v1->i128 >= v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->i128 >= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->i128 >= v2->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       res->u8 = v1->i128 >= v2->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       res->u8 = v1->i128 >= v2->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->u8 = v1->i128 >= v2->ldval;
+                       break;
+#      endif
+
+               default:
+                       assert(0);
+                       break;
+               }
+               break;
+       case PSI_T_UINT128:
+               switch (t2) {
+               case PSI_T_INT8:
+                       res->u8 = v1->u128 >= v2->i8;
+                       break;
+               case PSI_T_UINT8:
+                       res->u8 = v1->u128 >= v2->u8;
+                       break;
+               case PSI_T_INT16:
+                       res->u8 = v1->u128 >= v2->i16;
+                       break;
+               case PSI_T_UINT16:
+                       res->u8 = v1->u128 >= v2->u16;
+                       break;
+               case PSI_T_INT32:
+                       res->u8 = v1->u128 >= v2->i32;
+                       break;
+               case PSI_T_UINT32:
+                       res->u8 = v1->u128 >= v2->u32;
+                       break;
+               case PSI_T_INT64:
+                       res->u8 = v1->u128 >= v2->i64;
+                       break;
+               case PSI_T_UINT64:
+                       res->u8 = v1->u128 >= v2->u64;
+                       break;
+               case PSI_T_INT128:
+                       res->u8 = v1->u128 >= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->u128 >= v2->u128;
+                       break;
+               case PSI_T_FLOAT:
+                       res->u8 = v1->u128 >= v2->fval;
+                       break;
+               case PSI_T_DOUBLE:
+                       res->u8 = v1->u128 >= v2->dval;
+                       break;
+#      if HAVE_LONG_DOUBLE
+               case PSI_T_LONG_DOUBLE:
+                       res->u8 = v1->u128 >= v2->ldval;
+                       break;
+#      endif
+
                default:
                        assert(0);
                        break;
                default:
                        assert(0);
                        break;
@@ -2831,6 +3797,12 @@ static inline token_t psi_calc_cmp_ge(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->fval >= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->fval >= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->fval >= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->fval >= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->fval >= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->fval >= v2->fval;
                        break;
@@ -2874,6 +3846,12 @@ static inline token_t psi_calc_cmp_ge(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->dval >= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->dval >= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->dval >= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->dval >= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->dval >= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->dval >= v2->fval;
                        break;
@@ -2918,6 +3896,12 @@ static inline token_t psi_calc_cmp_ge(token_t t1, impl_val *v1, token_t t2, impl
                case PSI_T_UINT64:
                        res->u8 = v1->ldval >= v2->u64;
                        break;
                case PSI_T_UINT64:
                        res->u8 = v1->ldval >= v2->u64;
                        break;
+               case PSI_T_INT128:
+                       res->u8 = v1->ldval >= v2->i128;
+                       break;
+               case PSI_T_UINT128:
+                       res->u8 = v1->ldval >= v2->u128;
+                       break;
                case PSI_T_FLOAT:
                        res->u8 = v1->ldval >= v2->fval;
                        break;
                case PSI_T_FLOAT:
                        res->u8 = v1->ldval >= v2->fval;
                        break;
diff --git a/src/calc/unary.h b/src/calc/unary.h
new file mode 100644 (file)
index 0000000..72a82e1
--- /dev/null
@@ -0,0 +1,212 @@
+/*******************************************************************************
+ Copyright (c) 2016, Michael Wallner <mike@php.net>.
+ All rights reserved.
+
+ Redistribution and use in source and binary forms, with or without
+ modification, are permitted provided that the following conditions are met:
+
+     * Redistributions of source code must retain the above copyright notice,
+       this list of conditions and the following disclaimer.
+     * Redistributions in binary form must reproduce the above copyright
+       notice, this list of conditions and the following disclaimer in the
+       documentation and/or other materials provided with the distribution.
+
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
+ IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
+ FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
+ DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
+ SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
+ CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
+ OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+ OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+*******************************************************************************/
+
+#include "php_psi_stdinc.h"
+#include <assert.h>
+
+#include "token.h"
+static inline token_t psi_calc_minus(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
+{
+       (void) t2;
+       (void) v2;
+
+       switch (t1) {
+       case PSI_T_INT8:
+               res->i8 = -v1->i8;
+               break;
+       case PSI_T_UINT8:
+               res->u8 = -v1->u8;
+               break;
+       case PSI_T_INT16:
+               res->i16 = -v1->i16;
+               break;
+       case PSI_T_UINT16:
+               res->u16 = -v1->u16;
+               break;
+       case PSI_T_INT32:
+               res->i32 = -v1->i32;
+               break;
+       case PSI_T_UINT32:
+               res->u32 = -v1->u32;
+               break;
+       case PSI_T_INT64:
+               res->i64 = -v1->i64;
+               break;
+       case PSI_T_UINT64:
+               res->u64 = -v1->u64;
+               break;
+       case PSI_T_INT128:
+               res->i128 = -v1->i128;
+               break;
+       case PSI_T_UINT128:
+               res->u128 = -v1->u128;
+               break;
+       case PSI_T_FLOAT:
+               res->fval = -v1->fval;
+               break;
+       case PSI_T_DOUBLE:
+               res->dval = -v1->dval;
+               break;
+#if HAVE_LONG_DOUBLE
+       case PSI_T_LONG_DOUBLE:
+               res->ldval = -v1->ldval;
+               break;
+#endif
+
+       default:
+               assert(0);
+               break;
+       }
+       return t1;
+}
+
+
+static inline token_t psi_calc_bool_not(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
+{
+       (void) t2;
+       (void) v2;
+
+       switch (t1) {
+       case PSI_T_INT8:
+               res->u8 = !v1->i8;
+               break;
+       case PSI_T_UINT8:
+               res->u8 = !v1->u8;
+               break;
+       case PSI_T_INT16:
+               res->u8 = !v1->i16;
+               break;
+       case PSI_T_UINT16:
+               res->u8 = !v1->u16;
+               break;
+       case PSI_T_INT32:
+               res->u8 = !v1->i32;
+               break;
+       case PSI_T_UINT32:
+               res->u8 = !v1->u32;
+               break;
+       case PSI_T_INT64:
+               res->u8 = !v1->i64;
+               break;
+       case PSI_T_UINT64:
+               res->u8 = !v1->u64;
+               break;
+       case PSI_T_INT128:
+               res->u8 = !v1->i128;
+               break;
+       case PSI_T_UINT128:
+               res->u8 = !v1->u128;
+               break;
+       case PSI_T_FLOAT:
+               res->u8 = !v1->fval;
+               break;
+       case PSI_T_DOUBLE:
+               res->u8 = !v1->dval;
+               break;
+#if HAVE_LONG_DOUBLE
+       case PSI_T_LONG_DOUBLE:
+               res->u8 = !v1->ldval;
+               break;
+#endif
+
+       default:
+               assert(0);
+               break;
+       }
+       return PSI_T_UINT8;
+}
+
+
+static inline token_t psi_calc_bin_not(token_t t1, impl_val *v1, token_t t2, impl_val *v2, impl_val *res)
+{
+       impl_val i1;
+
+       (void) t2;
+       (void) v2;
+
+       switch (t1) {
+       case PSI_T_INT8:
+               i1.u64 = v1->i8;
+               break;
+
+       case PSI_T_UINT8:
+               i1.u64 = v1->u8;
+               break;
+
+       case PSI_T_INT16:
+               i1.u64 = v1->i16;
+               break;
+
+       case PSI_T_UINT16:
+               i1.u64 = v1->u16;
+               break;
+
+       case PSI_T_INT32:
+               i1.u64 = v1->i32;
+               break;
+
+       case PSI_T_UINT32:
+               i1.u64 = v1->u32;
+               break;
+
+       case PSI_T_INT64:
+               i1.u64 = v1->i64;
+               break;
+
+       case PSI_T_UINT64:
+               i1.u64 = v1->u64;
+               break;
+
+       case PSI_T_INT128:
+               i1.u64 = v1->i128;
+               break;
+
+       case PSI_T_UINT128:
+               i1.u64 = v1->u128;
+               break;
+
+       case PSI_T_FLOAT:
+               i1.u64 = v1->fval;
+               break;
+
+       case PSI_T_DOUBLE:
+               i1.u64 = v1->dval;
+               break;
+
+#if HAVE_LONG_DOUBLE
+       case PSI_T_LONG_DOUBLE:
+               i1.u64 = v1->ldval;
+               break;
+
+#endif
+
+       default:
+               assert(0);
+               break;
+       }
+
+       res->u64 = ~i1.u64;
+       return PSI_T_UINT64;
+}
\ No newline at end of file
index 5749a73..d1f808c 100644 (file)
 #include "token.h"
 #include "parser.h"
 
 #include "token.h"
 #include "parser.h"
 
-#define PSI_PREDEF_TYPES
-#define PSI_PREDEF_CONSTS
-#define PSI_PREDEF_COMPOSITES
-#define PSI_PREDEF_DECLS
 #include "php_psi_posix.h"
 
 struct psi_context *psi_context_init(struct psi_context *C, struct psi_context_ops *ops, psi_error_cb error, unsigned flags)
 {
 #include "php_psi_posix.h"
 
 struct psi_context *psi_context_init(struct psi_context *C, struct psi_context_ops *ops, psi_error_cb error, unsigned flags)
 {
-       struct psi_data T;
-       struct psi_predef_type *predef_type;
-       struct psi_predef_const *predef_const;
-       struct psi_predef_composite *predef_composite;
-       struct psi_predef_decl *predef_decl;
-
        if (!C) {
                C = malloc(sizeof(*C));
        }
        if (!C) {
                C = malloc(sizeof(*C));
        }
@@ -85,139 +75,6 @@ struct psi_context *psi_context_init(struct psi_context *C, struct psi_context_o
        assert(ops->call != NULL);
        assert(ops->compile != NULL);
 
        assert(ops->call != NULL);
        assert(ops->compile != NULL);
 
-       /* build up predefs in a temporary psi_data for validation */
-       memset(&T, 0, sizeof(T));
-       psi_data_ctor_with_dtors(&T, error, flags);
-
-#if PHP_DEBUG
-       if (psi_check_env("PSI_SKIP"))
-               goto skip_predefs;
-#endif
-
-       for (predef_type = &psi_predef_types[0]; predef_type->type_tag; ++predef_type) {
-               struct psi_decl_type *type = psi_decl_type_init(predef_type->type_tag, predef_type->type_name);
-               struct psi_decl_var *var = psi_decl_var_init(predef_type->alias, 0, 0); /* FIXME: indirection */
-               struct psi_decl_arg *def = psi_decl_arg_init(type, var);
-
-               T.types = psi_plist_add(T.types, &def);
-       }
-       for (predef_const = &psi_predef_consts[0]; predef_const->type_tag; ++predef_const) {
-               struct psi_const_type *type = psi_const_type_init(predef_const->type_tag, predef_const->type_name);
-               struct psi_impl_def_val *val;
-               struct psi_const *constant;
-
-               switch (type->type) {
-               case PSI_T_INT:
-                       val = psi_impl_def_val_init(PSI_T_INT, NULL);
-                       val->ival.zend.lval = predef_const->value.zend.lval;
-                       break;
-               case PSI_T_STRING:
-                       val = psi_impl_def_val_init(PSI_T_STRING, NULL);
-                       val->ival.zend.str = zend_string_init(predef_const->value.ptr, strlen(predef_const->value.ptr), 1);
-                       break;
-               default:
-                       assert(0);
-                       break;
-               }
-
-               constant = psi_const_init(type, predef_const->var_name, val);
-               T.consts = psi_plist_add(T.consts, &constant);
-       }
-       for (predef_composite = &psi_predef_composites[0]; predef_composite->type_tag; ++predef_composite) {
-               struct psi_predef_composite *member;
-               struct psi_decl_struct *dstruct;
-               struct psi_decl_union *dunion;
-               struct psi_plist *dargs = psi_plist_init((psi_plist_dtor) psi_decl_arg_free);
-
-               switch (predef_composite->type_tag) {
-               case PSI_T_STRUCT:
-                       dstruct = psi_decl_struct_init(predef_composite->var_name, dargs);
-                       dstruct->size = predef_composite->size;
-                       dstruct->align = predef_composite->offset;
-                       break;
-               case PSI_T_UNION:
-                       dunion = psi_decl_union_init(predef_composite->var_name, dargs);
-                       dunion->size = predef_composite->size;
-                       dunion->align = predef_composite->offset;
-                       break;
-               default:
-                       assert(0);
-               }
-               for (member = &predef_composite[1]; member->type_tag; ++member) {
-                       struct psi_decl_type *type;
-                       struct psi_decl_var *dvar;
-                       struct psi_decl_arg *darg;
-
-                       type = psi_decl_type_init(member->type_tag, member->type_name);
-                       dvar = psi_decl_var_init(member->var_name, member->pointer_level, member->array_size);
-                       darg = psi_decl_arg_init(type, dvar);
-                       darg->layout = psi_layout_init(member->offset, member->size, NULL);
-
-                       switch (predef_composite->type_tag) {
-                       case PSI_T_STRUCT:
-                               dstruct->args = psi_plist_add(dstruct->args, &darg);
-                               break;
-                       case PSI_T_UNION:
-                               dunion->args = psi_plist_add(dunion->args, &darg);
-                               break;
-                       default:
-                               assert(0);
-                       }
-               }
-               switch (predef_composite->type_tag) {
-               case PSI_T_STRUCT:
-                       T.structs = psi_plist_add(T.structs, &dstruct);
-                       break;
-               case PSI_T_UNION:
-                       T.unions = psi_plist_add(T.unions, &dunion);
-                       break;
-               default:
-                       assert(0);
-               }
-
-               predef_composite = member;
-       }
-       for (predef_decl = &psi_predef_decls[0]; predef_decl->type_tag; ++predef_decl) {
-               struct psi_predef_decl *farg;
-               struct psi_decl_type *dtype, *ftype = psi_decl_type_init(predef_decl->type_tag, predef_decl->type_name);
-               struct psi_decl_var *fname = psi_decl_var_init(predef_decl->var_name, predef_decl->pointer_level, predef_decl->array_size);
-               struct psi_decl_arg *tdef, *func = psi_decl_arg_init(ftype, fname);
-               struct psi_plist *args = psi_plist_init((psi_plist_dtor) psi_decl_arg_free);
-               struct psi_decl *decl = psi_decl_init(func, args);
-
-               for (farg = &predef_decl[1]; farg->type_tag; ++farg) {
-                       struct psi_decl_type *arg_type = psi_decl_type_init(farg->type_tag, farg->type_name);
-                       struct psi_decl_var *arg_var = psi_decl_var_init(farg->var_name, farg->pointer_level, farg->array_size);
-                       struct psi_decl_arg *darg = psi_decl_arg_init(arg_type, arg_var);
-                       decl->args = psi_plist_add(decl->args, &darg);
-               }
-
-               switch (predef_decl->kind) {
-               case DECL_KIND_VARARG:
-                       decl->varargs = 1;
-                       /* no break */
-               case DECL_KIND_STD:
-                       T.decls = psi_plist_add(T.decls, &decl);
-                       break;
-               case DECL_KIND_FUNCTOR:
-                       dtype = psi_decl_type_init(PSI_T_FUNCTION, fname->name);
-                       dtype->real.func = decl;
-                       tdef = psi_decl_arg_init(dtype, psi_decl_var_copy(fname));
-                       T.types = psi_plist_add(T.types, &tdef);
-                       break;
-               default:
-                       assert(0);
-               }
-
-               predef_decl = farg;
-       }
-
-#if PHP_DEBUG
-       skip_predefs:
-#endif
-
-       psi_context_add_data(C, &T);
-
        return C;
 }
 
        return C;
 }
 
@@ -229,6 +86,23 @@ static int psi_select_dirent(const struct dirent *entry)
        return 0 == fnmatch("*.psi", entry->d_name, FNM_CASEFOLD);
 }
 
        return 0 == fnmatch("*.psi", entry->d_name, FNM_CASEFOLD);
 }
 
+static bool psi_context_add(struct psi_context *C, struct psi_parser *P)
+{
+       bool valid;
+       struct psi_data *D;
+       struct psi_validate_scope scope = {0};
+
+       C->data = realloc(C->data, (C->count + 1) * sizeof(*C->data));
+       D = psi_data_exchange(&C->data[C->count++], PSI_DATA(P));
+
+       psi_validate_scope_ctor(&scope);
+       scope.defs = &P->preproc->defs;
+       valid = psi_validate(&scope, PSI_DATA(C), D);
+       psi_validate_scope_dtor(&scope);
+
+       return valid;
+}
+
 void psi_context_build(struct psi_context *C, const char *paths)
 {
        int i, n;
 void psi_context_build(struct psi_context *C, const char *paths)
 {
        int i, n;
@@ -266,7 +140,7 @@ void psi_context_build(struct psi_context *C, const char *paths)
                                        continue;
                                }
                                psi_parser_parse(&P, I);
                                        continue;
                                }
                                psi_parser_parse(&P, I);
-                               psi_context_add_data(C, PSI_DATA(&P));
+                               psi_context_add(C, &P);
                                psi_parser_dtor(&P);
                                free(I);
                        }
                                psi_parser_dtor(&P);
                                free(I);
                        }
@@ -317,6 +191,7 @@ zend_function_entry *psi_context_compile(struct psi_context *C)
                                ZVAL_LONG(&zc.value, c->val->ival.zend.lval);
                                break;
                        case PSI_T_FLOAT:
                                ZVAL_LONG(&zc.value, c->val->ival.zend.lval);
                                break;
                        case PSI_T_FLOAT:
+                       case PSI_T_DOUBLE:
                                ZVAL_DOUBLE(&zc.value, c->val->ival.dval);
                                break;
                        case PSI_T_STRING:
                                ZVAL_DOUBLE(&zc.value, c->val->ival.dval);
                                break;
                        case PSI_T_STRING:
@@ -355,7 +230,7 @@ zend_function_entry *psi_context_compile(struct psi_context *C)
                                }
 
                                zc.name = zend_string_dup(name, 1);
                                }
 
                                zc.name = zend_string_dup(name, 1);
-                               ZVAL_LONG(&zc.value, psi_long_num_exp(item->num, NULL, NULL));
+                               ZVAL_LONG(&zc.value, psi_num_exp_get_long(item->num, NULL, NULL));
                                zend_register_constant(&zc);
                                zend_string_release(name);
                        }
                                zend_register_constant(&zc);
                                zend_string_release(name);
                        }
@@ -447,29 +322,10 @@ void psi_context_free(struct psi_context **C)
        }
 }
 
        }
 }
 
-bool psi_context_add_data(struct psi_context *C, struct psi_data *P)
-{
-       struct psi_data *D;
-
-       C->data = realloc(C->data, (C->count + 1) * sizeof(*C->data));
-       D = psi_data_exchange(&C->data[C->count++], P);
-
-       return psi_data_validate(PSI_DATA(C), D);
-}
-
 void psi_context_dump(struct psi_context *C, int fd)
 {
 void psi_context_dump(struct psi_context *C, int fd)
 {
-
        dprintf(fd, "// psi.engine=%s\n",
                        (char *) C->ops->query(C, PSI_CONTEXT_QUERY_SELF, NULL));
 
        psi_data_dump(fd, PSI_DATA(C));
        dprintf(fd, "// psi.engine=%s\n",
                        (char *) C->ops->query(C, PSI_CONTEXT_QUERY_SELF, NULL));
 
        psi_data_dump(fd, PSI_DATA(C));
-
-//     size_t i;
-//     dprintf(fd, "/* parsed\n");
-//     for (i = 0; i < C->count; ++i) {
-//             psi_data_dump(fd, &C->data[i]);
-//     }
-//     dprintf(fd, "*/\n");
-
 }
 }
index 2cbe6d2..73d13cd 100644 (file)
@@ -73,7 +73,6 @@ struct psi_context_call_data {
 
 struct psi_context *psi_context_init(struct psi_context *C, struct psi_context_ops *ops, psi_error_cb error, unsigned flags);
 void psi_context_build(struct psi_context *C, const char *path);
 
 struct psi_context *psi_context_init(struct psi_context *C, struct psi_context_ops *ops, psi_error_cb error, unsigned flags);
 void psi_context_build(struct psi_context *C, const char *path);
-bool psi_context_add_data(struct psi_context *C, struct psi_data *P);
 zend_function_entry *psi_context_compile(struct psi_context *C);
 ZEND_RESULT_CODE psi_context_call(struct psi_context *C, zend_execute_data *execute_data, zval *return_value, struct psi_impl *impl);
 void psi_context_dump(struct psi_context *C, int fd);
 zend_function_entry *psi_context_compile(struct psi_context *C);
 ZEND_RESULT_CODE psi_context_call(struct psi_context *C, zend_execute_data *execute_data, zval *return_value, struct psi_impl *impl);
 void psi_context_dump(struct psi_context *C, int fd);
index b181e27..5ab6492 100644 (file)
--- a/src/cpp.c
+++ b/src/cpp.c
@@ -67,6 +67,7 @@ bool psi_cpp_load_defaults(struct psi_cpp *cpp)
        return false;
 }
 
        return false;
 }
 
+#if PSI_CPP_DEBUG
 static int dump_def(zval *p)
 {
        struct psi_cpp_macro_decl *decl = Z_PTR_P(p);
 static int dump_def(zval *p)
 {
        struct psi_cpp_macro_decl *decl = Z_PTR_P(p);
@@ -78,17 +79,18 @@ static int dump_def(zval *p)
        }
        return ZEND_HASH_APPLY_KEEP;
 }
        }
        return ZEND_HASH_APPLY_KEEP;
 }
+#endif
 
 void psi_cpp_free(struct psi_cpp **cpp_ptr)
 {
        if (*cpp_ptr) {
                struct psi_cpp *cpp = *cpp_ptr;
 
 
 void psi_cpp_free(struct psi_cpp **cpp_ptr)
 {
        if (*cpp_ptr) {
                struct psi_cpp *cpp = *cpp_ptr;
 
+#if PSI_CPP_DEBUG
+               fprintf(stderr, "PSI: CPP decls:\n");
+               zend_hash_apply(&cpp->defs, dump_def);
+#endif
                *cpp_ptr = NULL;
                *cpp_ptr = NULL;
-               if (cpp->parser->flags & PSI_DEBUG) {
-                       fprintf(stderr, "PSI: CPP decls:\n");
-                       zend_hash_apply(&cpp->defs, dump_def);
-               }
                zend_hash_destroy(&cpp->defs);
                zend_hash_destroy(&cpp->once);
                free(cpp);
                zend_hash_destroy(&cpp->defs);
                zend_hash_destroy(&cpp->once);
                free(cpp);
@@ -373,6 +375,15 @@ void psi_cpp_define(struct psi_cpp *cpp, struct psi_cpp_macro_decl *decl)
                cpp->parser->error(PSI_DATA(cpp->parser), old->token, PSI_WARNING,
                                "'%s' previously defined", old->token->text);
        }
               &n