9 #include "opcode_enum.h"
20 array->
capacity = KRK_GROW_CAPACITY(old);
35 if (likely(type && type->
_eq)) {
40 if (IS_BOOLEAN(result))
return AS_BOOLEAN(result);
45 if (type && type->
_eq) {
50 if (IS_BOOLEAN(result))
return AS_BOOLEAN(result);
57 static inline int _krk_same_type_equivalence(uint16_t valtype,
KrkValue a,
KrkValue b) {
68 return _krk_method_equivalence(a,b);
72 static inline int _krk_same_type_equivalence_b(uint16_t valtype,
KrkValue a,
KrkValue b) {
83 return _krk_method_equivalence(a,b);
87 static inline int _krk_diff_type_equivalence(uint16_t val_a, uint16_t val_b,
KrkValue a,
KrkValue b) {
89 if (val_b == KRK_VAL_KWARGS || val_a == KRK_VAL_KWARGS)
return 0;
92 return _krk_method_equivalence(a,b);
98 uint16_t val_a = KRK_VAL_TYPE(a);
99 uint16_t val_b = KRK_VAL_TYPE(b);
100 return (val_a == val_b)
101 ? _krk_same_type_equivalence_b(val_a, a, b)
102 : _krk_diff_type_equivalence(val_a, val_b, a, b);
107 uint16_t val_a = KRK_VAL_TYPE(a);
108 uint16_t val_b = KRK_VAL_TYPE(b);
109 return (val_a == val_b)
110 ? _krk_same_type_equivalence(val_a,a,b)
111 : _krk_diff_type_equivalence(val_a,val_b,a,b);
Functions for dealing with garbage collection and memory allocation.
Struct definitions for core object types.
KrkObj * _eq
__eq__ Implementation for equality check (==)
Flexible vector of stack references.
void krk_initValueArray(KrkValueArray *array)
Initialize a value array.
void krk_freeValueArray(KrkValueArray *array)
Release relesources used by a value array.
void krk_writeValueArray(KrkValueArray *array, KrkValue value)
Add a value to a value array.
Stack reference or primative value.
int krk_valuesEqual(KrkValue a, KrkValue b)
Compare two values for equality.
KrkClass * krk_getType(KrkValue value)
Get the class representing a value.
static int krk_valuesSame(KrkValue a, KrkValue b)
Compare two values by identity.
int krk_valuesSameOrEqual(KrkValue a, KrkValue b)
Compare two values by identity, then by equality.
int krk_isFalsey(KrkValue value)
Determine the truth of a value.
Utilities for creating native bindings.
Definitions for primitive stack references.
Core API for the bytecode virtual machine.
krk_threadLocal KrkThreadState krk_currentThread
Thread-local VM state.
void krk_push(KrkValue value)
Push a stack value.
KrkValue krk_callDirect(KrkObj *callable, int argCount)
Call a closure or native function with argCount arguments.