checkpoint on eval2 parse

This commit is contained in:
Ryan Fleury
2026-06-16 12:29:03 -06:00
parent eb87cb053e
commit bcdc6acd0e
9 changed files with 688 additions and 88 deletions
+397
View File
@@ -113,13 +113,410 @@ e2_expr_from_name(E2_ExprMap *map, String8 name)
return expr;
}
////////////////////////////////
//~ rjf: Messages
internal E2_Msg *
e2_msg(Arena *arena, E2_MsgList *msgs, U64 src_off, String8 string)
{
E2_Msg *msg = push_array(arena, E2_Msg, 1);
SLLQueuePush(msgs->first, msgs->last, msg);
msgs->count += 1;
msg->src_off = src_off;
msg->string = str8_copy(arena, string);
return msg;
}
internal E2_Msg *
e2_msgf(Arena *arena, E2_MsgList *msgs, U64 src_off, char *fmt, ...)
{
Temp scratch = scratch_begin(&arena, 1);
va_list args;
va_start(args, fmt);
String8 string = str8fv(scratch.arena, fmt, args);
E2_Msg *msg = e2_msg(arena, msgs, src_off, string);
va_end(args);
scratch_end(scratch);
return msg;
}
////////////////////////////////
//~ rjf: Types
internal E2_TypeKey
e2_type_key_basic(E2_TypeKind kind)
{
E2_TypeKey key = {E2_TypeKeyKind_Basic};
key.u32[0] = (U32)kind;
return key;
}
////////////////////////////////
//~ rjf: String -> Expression
internal E2_Token
e2_token_from_string(String8 string)
{
E2_Token token = {E2_TokenKind_Null};
B32 identifier_tick_mode = 0;
B32 comment_is_explicit_ender = 0;
B32 numeric_exponent = 0;
B32 escaped = 0;
B32 done = 0;
for(U64 off = 0; !done && off <= string.size; off += 1)
{
U8 next_byte = (off < string.size ? string.str[off] : 0);
U8 next2_byte = (off+1 < string.size ? string.str[off+1] : 0);
U8 next3_byte = (off+2 < string.size ? string.str[off+2] : 0);
switch(token.kind)
{
//- rjf: no set token kind => look for starters
default:
{
if(next_byte <= 32)
{
token.kind = E2_TokenKind_Whitespace;
token.range.min = token.range.max = off;
}
else if(next_byte == '$' || next_byte == '_' || next_byte == '`' ||
('A' <= next_byte && next_byte <= 'Z') ||
('a' <= next_byte && next_byte <= 'z'))
{
token.kind = E2_TokenKind_Identifier;
token.range.min = token.range.max = off;
identifier_tick_mode = (next_byte == '`');
}
else if(('0' <= next_byte && next_byte <= '9') ||
(next_byte == '.' && '0' <= next2_byte && next2_byte <= '9'))
{
token.kind = E2_TokenKind_Numeric;
token.range.min = token.range.max = off;
}
else if(next_byte == '\'')
{
token.kind = E2_TokenKind_CharLiteral;
token.range.min = token.range.max = off;
}
else if(next_byte == '"')
{
token.kind = E2_TokenKind_StringLiteral;
token.range.min = token.range.max = off;
}
else if(next_byte == '/' && next2_byte == '/')
{
token.kind = E2_TokenKind_Comment;
token.range.min = token.range.max = off;
}
else if(next_byte == '/' && next2_byte == '*')
{
token.kind = E2_TokenKind_Comment;
token.range.min = token.range.max = off;
comment_is_explicit_ender = 1;
}
else if(next_byte == '~' || next_byte == '!' || next_byte == '%' ||
next_byte == '^' || next_byte == '&' || next_byte == '*' ||
next_byte == '(' || next_byte == ')' || next_byte == '[' ||
next_byte == ']' || next_byte == '{' || next_byte == '}' ||
next_byte == '-' || next_byte == '=' || next_byte == '+' ||
next_byte == ':' || next_byte == ';' || next_byte == ',' ||
next_byte == '.' || next_byte == '<' || next_byte == '>' ||
next_byte == '/' || next_byte == '?' || next_byte == '#' ||
next_byte == '@' || next_byte == '|')
{
token.kind = E2_TokenKind_Symbol;
token.range.min = token.range.max = off;
}
}break;
//- rjf: active tokens -> seek enders
case E2_TokenKind_Whitespace:
if(next_byte > 32)
{
done = 1;
}break;
case E2_TokenKind_Comment:
if(comment_is_explicit_ender && next_byte == '*' && next2_byte == '/')
{
done = 1;
token.range.max = off+2;
}break;
case E2_TokenKind_Identifier:
{
if(identifier_tick_mode && (next_byte == '`' || next_byte == '\''))
{
identifier_tick_mode = 0;
}
else if(!identifier_tick_mode &&
(next_byte < 'a' || 'z' < next_byte) &&
(next_byte < 'A' || 'Z' < next_byte) &&
(next_byte < '0' || '9' < next_byte) &&
next_byte != '$' &&
next_byte != '_' &&
next_byte != '@')
{
done = 1;
token.range.max = off;
}
}break;
case E2_TokenKind_Numeric:
{
if(numeric_exponent && (next_byte == '+' || next_byte == '-')){}
else if((next_byte < 'a' || 'z' < next_byte) &&
(next_byte < 'A' || 'Z' < next_byte) &&
next_byte != '.' &&
next_byte != ':')
{
done = 1;
token.range.max = off;
}
else
{
numeric_exponent = (next_byte == 'e');
}
}break;
case E2_TokenKind_Symbol:
if(next_byte != '~' && next_byte != '!' && next_byte != '%' &&
next_byte != '^' && next_byte != '&' && next_byte != '*' &&
next_byte != '(' && next_byte != ')' && next_byte != '[' &&
next_byte != ']' && next_byte != '{' && next_byte != '}' &&
next_byte != '-' && next_byte != '=' && next_byte != '+' &&
next_byte != ':' && next_byte != ';' && next_byte != ',' &&
next_byte != '.' && next_byte != '<' && next_byte != '>' &&
next_byte != '/' && next_byte != '?' && next_byte != '#' &&
next_byte != '@' && next_byte != '|')
{
done = 1;
token.range.max = off;
}break;
case E2_TokenKind_CharLiteral:
case E2_TokenKind_StringLiteral:
{
if(!escaped && next_byte == '\\')
{
escaped = 1;
}
else if(escaped)
{
escaped = 0;
}
else if(!escaped && ((next_byte == '"' && token.kind == E2_TokenKind_StringLiteral) ||
(next_byte == '\'' && token.kind == E2_TokenKind_CharLiteral)))
{
done = 1;
token.range.max = off+1;
}
}break;
}
if(token.range.max > off+1)
{
off += (token.range.max - (off+1));
}
if(!done && off == string.size)
{
done = 1;
token.range.max = off;
}
}
return token;
}
internal U64
e2_read_token(String8 string, U64 off, E2_Token *token_out)
{
E2_Token token = e2_token_from_string(str8_skip(string, off));
if(token_out != 0)
{
token_out[0] = token;
}
U64 result = dim_1u64(token.range);
return result;
}
internal B32
e2_try_token(String8 string, E2_TokenKind kind, String8 expected_string, U64 *off_out, E2_Token *token_out)
{
B32 result = 0;
U64 off = off_out[0];
for(;;)
{
E2_Token next_token = {E2_TokenKind_Null};
off += e2_read_token(string, off, &next_token);
if(next_token.kind == kind && (expected_string.size == 0 || str8_match(str8_substr(string, next_token.range), expected_string, 0)))
{
result = 1;
break;
}
else if(next_token.kind != E2_TokenKind_Comment && next_token.kind != E2_TokenKind_Whitespace)
{
break;
}
}
if(result)
{
off_out[0] = off;
}
return result;
}
internal E2_Parse
e2_parse_from_string(Arena *arena, E2_ParseState *state, E2_SpaceMap *space_map, E2_ExprMap *expr_map, String8 string)
{
U64 off = state->string_off;
E2_Parse parse = {E2_Status_Error, .expr = &e2_expr_nil, .access_expr = &e2_expr_nil};
//- rjf: parse & attach to top parsing task - if we don't have a top task
// then it is just the result
for(B32 done = 0; !done;)
{
E2_Expr *expr = &e2_expr_nil;
E2_Token token = {0};
//- rjf: nested sub-expressions
if(e2_try_token(string, E2_TokenKind_Symbol, s("("), &off, 0))
{
E2_ParseTask *task = state->free_task;
if(task != 0)
{
SLLStackPop(state->free_task);
}
else
{
task = push_array(arena, E2_ParseTask, 1);
}
task->parent = push_array(arena, E2_Expr, 1);
MemoryCopyStruct(task->parent, &e2_expr_nil);
task->expected_closer = s(")");
task->child_count_target = 1;
SLLStackPush(state->top_task, task);
}
//- rjf: prefix unaries
else if(e2_try_token(string, E2_TokenKind_Symbol, s(""), &off, &token))
{
E2_ParseTask *task = state->free_task;
if(task != 0)
{
SLLStackPop(state->free_task);
}
else
{
task = push_array(arena, E2_ParseTask, 1);
}
task->parent = push_array(arena, E2_Expr, 1);
MemoryCopyStruct(task->parent, &e2_expr_nil);
task->child_count_target = 1;
SLLStackPush(state->top_task, task);
}
//- rjf: leaf identifiers
else if(e2_try_token(string, E2_TokenKind_Identifier, s(""), &off, &token))
{
String8 identifier = str8_substr(string, token.range);
expr = e2_expr_from_name(expr_map, identifier);
if(expr == &e2_expr_nil)
{
done = 1;
parse.status = E2_Status_MissedIdentifierResolution;
parse.missed_identifier = identifier;
}
}
//- rjf: leaf numerics
else if(e2_try_token(string, E2_TokenKind_Numeric, s(""), &off, &token))
{
String8 numeric_string = str8_substr(string, token.range);
expr = push_array(arena, E2_Expr, 1);
MemoryCopyStruct(expr, &e2_expr_nil);
U64 dot_pos = str8_find_needle(numeric_string, 0, s("."), 0);
B32 f_suffix = str8_match(str8_postfix(numeric_string, 1), s("f"), 0);
U64 colon_pos = str8_find_needle(numeric_string, 0, s(":"), 0);
if(dot_pos < numeric_string.size && f_suffix)
{
expr->val.f32 = (F32)f64_from_str8(numeric_string);
expr->type_key = e2_type_key_basic(E2_TypeKind_F32);
}
else if(dot_pos < numeric_string.size && !f_suffix)
{
expr->val.f64 = f64_from_str8(numeric_string);
expr->type_key = e2_type_key_basic(E2_TypeKind_F64);
}
else if(colon_pos < numeric_string.size)
{
Temp scratch = scratch_begin(&arena, 1);
String8List parts = str8_split(scratch.arena, numeric_string, (U8 *)":", 1, 0);
U64 u64_idx = 0;
for EachNode(n, String8Node, parts.first)
{
if(u64_idx >= ArrayCount(expr->val.u512.u64))
{
break;
}
try_u64_from_str8_c_rules(n->string, &expr->val.u512.u64[u64_idx]);
u64_idx += 1;
}
switch(u64_idx)
{
case 1:{expr->op = RDI_EvalOp_ConstU64; expr->type_key = e2_type_key_basic(E2_TypeKind_U64);}break;
case 2:{expr->op = RDI_EvalOp_ConstU128; expr->type_key = e2_type_key_basic(E2_TypeKind_U128);}break;
case 4:{expr->op = RDI_EvalOp_ConstU256; expr->type_key = e2_type_key_basic(E2_TypeKind_U256);}break;
case 8:{expr->op = RDI_EvalOp_ConstU512; expr->type_key = e2_type_key_basic(E2_TypeKind_U512);}break;
default:
{
e2_msgf(arena, &parse.msgs, token.range.min, "Invalid number of numeric portions specified (%I64u; must be 2, 4, or 8).", u64_idx);
}break;
}
scratch_end(scratch);
}
else if(try_u64_from_str8_c_rules(numeric_string, &expr->val.u64))
{
if(expr->val.u64 <= 0xff)
{
expr->op = RDI_EvalOp_ConstU8;
expr->type_key = e2_type_key_basic(E2_TypeKind_U8);
}
else if(expr->val.u64 <= 0xffff)
{
expr->op = RDI_EvalOp_ConstU16;
expr->type_key = e2_type_key_basic(E2_TypeKind_U16);
}
else if(expr->val.u64 <= 0xffffffff)
{
expr->op = RDI_EvalOp_ConstU32;
expr->type_key = e2_type_key_basic(E2_TypeKind_U32);
}
else
{
expr->op = RDI_EvalOp_ConstU64;
expr->type_key = e2_type_key_basic(E2_TypeKind_U64);
}
}
}
//- rjf: attach formed expressions to task
if(expr != &e2_expr_nil && state->top_task != 0)
{
SLLQueuePush(state->top_task->parent->first, state->top_task->parent->last, expr);
state->top_task->child_count += 1;
if(state->top_task->child_count == state->top_task->child_count_target)
{
// TODO(rjf): pop task, insert to parent, or decay to result - should naturally express below block too
}
}
//- rjf: no task -> formed expr is result
if(expr != &e2_expr_nil && state->top_task == 0)
{
parse.expr = expr;
break;
}
}
//- rjf: advance offset if successful
if(parse.status == E2_Status_Good)
{
state->string_off += off;
}
return parse;
}
////////////////////////////////
+91
View File
@@ -4,6 +4,28 @@
#ifndef EVAL2_H
#define EVAL2_H
////////////////////////////////
//~ rjf: Operator Info Tables
typedef enum E2_OpParseKind
{
E2_OpParseKind_Null,
E2_OpParseKind_UnaryPrefix,
E2_OpParseKind_Binary,
}
E2_OpParseKind;
typedef struct E2_OpInfo E2_OpInfo;
struct E2_OpInfo
{
E2_OpParseKind parse_kind;
S64 precedence;
String8 pre;
String8 sep;
String8 post;
String8 chain;
};
////////////////////////////////
//~ rjf: Generated Code
@@ -242,6 +264,31 @@ struct E2_Ctx
U64 tls_base_addr;
};
////////////////////////////////
//~ rjf: Tokens
typedef enum E2_TokenKind
{
E2_TokenKind_Null,
E2_TokenKind_Whitespace,
E2_TokenKind_Comment,
E2_TokenKind_Identifier,
E2_TokenKind_Numeric,
E2_TokenKind_Symbol,
E2_TokenKind_CharLiteral,
E2_TokenKind_StringLiteral,
E2_TokenKind_COUNT
}
E2_TokenKind;
typedef struct E2_Token E2_Token;
struct E2_Token
{
E2_TokenKind kind;
U32 unused;
Rng1U64 range;
};
////////////////////////////////
//~ rjf: Expression Tree Building
@@ -273,10 +320,38 @@ struct E2_ExprMap
U64 slots_count;
};
typedef struct E2_ParseTask E2_ParseTask;
struct E2_ParseTask
{
E2_ParseTask *next;
E2_Expr *parent;
U64 child_count;
U64 child_count_target;
String8 expected_closer;
};
typedef struct E2_ParseState E2_ParseState;
struct E2_ParseState
{
U64 string_off;
E2_ParseTask *top_task;
E2_ParseTask *free_task;
};
typedef struct E2_Msg E2_Msg;
struct E2_Msg
{
E2_Msg *next;
U64 src_off;
String8 string;
};
typedef struct E2_MsgList E2_MsgList;
struct E2_MsgList
{
E2_Msg *first;
E2_Msg *last;
U64 count;
};
typedef struct E2_Parse E2_Parse;
@@ -287,8 +362,10 @@ struct E2_Parse
Rng1U64 missed_read_space_addr_range;
E2_CtxID ctx_id;
E2_CtxFlags missing_ctx_flags;
String8 missed_identifier;
E2_Expr *expr;
E2_Expr *access_expr;
E2_MsgList msgs;
};
////////////////////////////////
@@ -353,9 +430,23 @@ internal U64 e2_space_map_read(E2_SpaceMap *map, E2_SpaceID space_id, Rng1U64 ad
internal void e2_expr_map_push(Arena *arena, E2_ExprMap *map, String8 name, E2_Expr *expr);
internal E2_Expr *e2_expr_from_name(E2_ExprMap *map, String8 name);
////////////////////////////////
//~ rjf: Messages
internal E2_Msg *e2_msg(Arena *arena, E2_MsgList *msgs, U64 src_off, String8 string);
internal E2_Msg *e2_msgf(Arena *arena, E2_MsgList *msgs, U64 src_off, char *fmt, ...);
////////////////////////////////
//~ rjf: Types
internal E2_TypeKey e2_type_key_basic(E2_TypeKind kind);
////////////////////////////////
//~ rjf: String -> Expression
internal E2_Token e2_token_from_string(String8 string);
internal U64 e2_read_token(String8 string, U64 off, E2_Token *token_out);
internal B32 e2_try_token(String8 string, E2_TokenKind kind, String8 expected_string, U64 *off_out, E2_Token *token_out);
internal E2_Parse e2_parse_from_string(Arena *arena, E2_ParseState *state, E2_SpaceMap *space_map, E2_ExprMap *expr_map, String8 string);
////////////////////////////////
+43
View File
@@ -1,6 +1,49 @@
// Copyright (c) Epic Games Tools
// Licensed under the MIT license (https://opensource.org/license/mit/)
@table(name parse_kind precedence pre sep pos chain)
E2_OpTable:
{
{Deref UnaryPrefix 2 "*" "" "" ""}
{Address UnaryPrefix 2 "&" "" "" ""}
{Pos UnaryPrefix 2 "+" "" "" ""}
{Neg UnaryPrefix 2 "-" "" "" ""}
{LogNot UnaryPrefix 2 "!" "" "" ""}
{BitNot UnaryPrefix 2 "~" "" "" ""}
{Mul Binary 3 "" "*" "" ""}
{Div Binary 3 "" "/" "" ""}
{Mod Binary 3 "" "%" "" ""}
{Add Binary 4 "" "+" "" ""}
{Sub Binary 4 "" "-" "" ""}
{LShift Binary 5 "" "<<" "" ""}
{RShift Binary 5 "" ">>" "" ""}
{Less Binary 6 "" "<" "" ""}
{LtEq Binary 6 "" "<=" "" ""}
{Grtr Binary 6 "" ">" "" ""}
{GrEq Binary 6 "" ">=" "" ""}
{EqEq Binary 7 "" "==" "" ""}
{NtEq Binary 7 "" "!=" "" ""}
{BitAnd Binary 8 "" "&" "" ""}
{BitXor Binary 9 "" "^" "" ""}
{BitOr Binary 10 "" "|" "" ""}
{LogAnd Binary 11 "" "&&" "" ""}
{LogOr Binary 12 "" "||" "" ""}
{Define Binary 13 "" "=" "" ""}
}
@enum E2_OpKind:
{
Null,
@expand(E2_OpTable a) `$(a.name)`,
COUNT,
}
@data(E2_OpInfo) e2_op_kind_info_table:
{
`{0}`,
@expand(E2_OpTable a) `{E2_OpParseKind_$(a.parse_kind), $(a.precedence), str8_lit_comp("$(a.pre)"), str8_lit_comp("$(a.sep)"), str8_lit_comp("$(a.pos)"), str8_lit_comp("$(a.chain)")}`
}
@table(name basic_string basic_byte_size)
// NOTE(rjf): basic_byte_size == 0xFF? => address sized
E2_TypeKindTable:
+33
View File
@@ -3,3 +3,36 @@
//- GENERATED CODE
C_LINKAGE_BEGIN
E2_OpInfo e2_op_kind_info_table[26] =
{
{0},
{E2_OpParseKind_UnaryPrefix, 2, str8_lit_comp("*"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_UnaryPrefix, 2, str8_lit_comp("&"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_UnaryPrefix, 2, str8_lit_comp("+"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_UnaryPrefix, 2, str8_lit_comp("-"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_UnaryPrefix, 2, str8_lit_comp("!"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_UnaryPrefix, 2, str8_lit_comp("~"), str8_lit_comp(""), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 3, str8_lit_comp(""), str8_lit_comp("*"), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 3, str8_lit_comp(""), str8_lit_comp("/"), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 3, str8_lit_comp(""), str8_lit_comp("%"), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 4, str8_lit_comp(""), str8_lit_comp("+"), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 4, str8_lit_comp(""), str8_lit_comp("-"), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 5, str8_lit_comp(""), str8_lit_comp("<<"), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 5, str8_lit_comp(""), str8_lit_comp(">>"), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 6, str8_lit_comp(""), str8_lit_comp("<"), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 6, str8_lit_comp(""), str8_lit_comp("<="), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 6, str8_lit_comp(""), str8_lit_comp(">"), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 6, str8_lit_comp(""), str8_lit_comp(">="), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 7, str8_lit_comp(""), str8_lit_comp("=="), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 7, str8_lit_comp(""), str8_lit_comp("!="), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 8, str8_lit_comp(""), str8_lit_comp("&"), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 9, str8_lit_comp(""), str8_lit_comp("^"), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 10, str8_lit_comp(""), str8_lit_comp("|"), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 11, str8_lit_comp(""), str8_lit_comp("&&"), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 12, str8_lit_comp(""), str8_lit_comp("||"), str8_lit_comp(""), str8_lit_comp("")},
{E2_OpParseKind_Binary, 13, str8_lit_comp(""), str8_lit_comp("="), str8_lit_comp(""), str8_lit_comp("")},
};
C_LINKAGE_END
+36
View File
@@ -6,6 +6,37 @@
#ifndef EVAL2_META_H
#define EVAL2_META_H
typedef enum E2_OpKind
{
E2_OpKind_Null,
E2_OpKind_Deref,
E2_OpKind_Address,
E2_OpKind_Pos,
E2_OpKind_Neg,
E2_OpKind_LogNot,
E2_OpKind_BitNot,
E2_OpKind_Mul,
E2_OpKind_Div,
E2_OpKind_Mod,
E2_OpKind_Add,
E2_OpKind_Sub,
E2_OpKind_LShift,
E2_OpKind_RShift,
E2_OpKind_Less,
E2_OpKind_LtEq,
E2_OpKind_Grtr,
E2_OpKind_GrEq,
E2_OpKind_EqEq,
E2_OpKind_NtEq,
E2_OpKind_BitAnd,
E2_OpKind_BitXor,
E2_OpKind_BitOr,
E2_OpKind_LogAnd,
E2_OpKind_LogOr,
E2_OpKind_Define,
E2_OpKind_COUNT,
} E2_OpKind;
typedef enum E2_TypeKind
{
E2_TypeKind_Null,
@@ -84,4 +115,9 @@ E2_TypeKind_FirstMeta = E2_TypeKind_MetaExpr,
E2_TypeKind_LastMeta = E2_TypeKind_MetaDescription,
} E2_TypeKind;
C_LINKAGE_BEGIN
extern E2_OpInfo e2_op_kind_info_table[26];
C_LINKAGE_END
#endif // EVAL2_META_H
+2 -2
View File
@@ -66,7 +66,6 @@ RDI_EVAL_CTRLBITS(2, 1, 0),
RDI_EVAL_CTRLBITS(2, 0, 0),
RDI_EVAL_CTRLBITS(1, 1, 1),
RDI_EVAL_CTRLBITS(4, 0, 1),
RDI_EVAL_CTRLBITS(0, 0, 1),
RDI_EVAL_CTRLBITS(8, 0, 1),
RDI_EVAL_CTRLBITS(4, 0, 1),
RDI_EVAL_CTRLBITS(4, 0, 1),
@@ -77,6 +76,8 @@ RDI_EVAL_CTRLBITS(2, 0, 1),
RDI_EVAL_CTRLBITS(4, 0, 1),
RDI_EVAL_CTRLBITS(8, 0, 1),
RDI_EVAL_CTRLBITS(16, 0, 1),
RDI_EVAL_CTRLBITS(32, 0, 1),
RDI_EVAL_CTRLBITS(64, 0, 1),
RDI_EVAL_CTRLBITS(1, 0, 1),
RDI_EVAL_CTRLBITS(1, 1, 1),
RDI_EVAL_CTRLBITS(1, 1, 1),
@@ -105,7 +106,6 @@ RDI_EVAL_CTRLBITS(1, 1, 1),
RDI_EVAL_CTRLBITS(2, 1, 1),
RDI_EVAL_CTRLBITS(1, 0, 1),
RDI_EVAL_CTRLBITS(0, 1, 0),
RDI_EVAL_CTRLBITS(0, 0, 1),
RDI_EVAL_CTRLBITS(1, 2, 1),
RDI_EVAL_CTRLBITS(1, 1, 1),
RDI_EVAL_CTRLBITS(4, 0, 0),
+43 -43
View File
@@ -67,7 +67,7 @@ union RDI_GUID {RDI_U8 u8[16]; RDI_U64 u64[2];};
// "raddbg\0\0"
#define RDI_MAGIC_CONSTANT 0x0000676264646172
#define RDI_ENCODING_VERSION 22
#define RDI_ENCODING_VERSION 23
////////////////////////////////////////////////////////////////
//~ Format Types & Functions
@@ -423,46 +423,46 @@ RDI_EvalOp_Cond = 2,
RDI_EvalOp_Skip = 3,
RDI_EvalOp_MemRead = 4,
RDI_EvalOp_RegRead = 5,
RDI_EvalOp_Unused0 = 6,
RDI_EvalOp_FrameOff = 7,
RDI_EvalOp_ModuleOff = 8,
RDI_EvalOp_TLSOff = 9,
RDI_EvalOp_ObjectOff = 10,
RDI_EvalOp_CFA = 11,
RDI_EvalOp_ConstU8 = 12,
RDI_EvalOp_ConstU16 = 13,
RDI_EvalOp_ConstU32 = 14,
RDI_EvalOp_ConstU64 = 15,
RDI_EvalOp_ConstU128 = 16,
RDI_EvalOp_ConstString = 17,
RDI_EvalOp_Abs = 18,
RDI_EvalOp_Neg = 19,
RDI_EvalOp_Add = 20,
RDI_EvalOp_Sub = 21,
RDI_EvalOp_Mul = 22,
RDI_EvalOp_Div = 23,
RDI_EvalOp_Mod = 24,
RDI_EvalOp_LShift = 25,
RDI_EvalOp_RShift = 26,
RDI_EvalOp_BitAnd = 27,
RDI_EvalOp_BitOr = 28,
RDI_EvalOp_BitXor = 29,
RDI_EvalOp_BitNot = 30,
RDI_EvalOp_LogAnd = 31,
RDI_EvalOp_LogOr = 32,
RDI_EvalOp_LogNot = 33,
RDI_EvalOp_EqEq = 34,
RDI_EvalOp_NtEq = 35,
RDI_EvalOp_LsEq = 36,
RDI_EvalOp_GrEq = 37,
RDI_EvalOp_Less = 38,
RDI_EvalOp_Grtr = 39,
RDI_EvalOp_Trunc = 40,
RDI_EvalOp_TruncSigned = 41,
RDI_EvalOp_Convert = 42,
RDI_EvalOp_Pick = 43,
RDI_EvalOp_Pop = 44,
RDI_EvalOp_Unused1 = 45,
RDI_EvalOp_FrameOff = 6,
RDI_EvalOp_ModuleOff = 7,
RDI_EvalOp_TLSOff = 8,
RDI_EvalOp_ObjectOff = 9,
RDI_EvalOp_CFA = 10,
RDI_EvalOp_ConstU8 = 11,
RDI_EvalOp_ConstU16 = 12,
RDI_EvalOp_ConstU32 = 13,
RDI_EvalOp_ConstU64 = 14,
RDI_EvalOp_ConstU128 = 15,
RDI_EvalOp_ConstU256 = 16,
RDI_EvalOp_ConstU512 = 17,
RDI_EvalOp_ConstString = 18,
RDI_EvalOp_Abs = 19,
RDI_EvalOp_Neg = 20,
RDI_EvalOp_Add = 21,
RDI_EvalOp_Sub = 22,
RDI_EvalOp_Mul = 23,
RDI_EvalOp_Div = 24,
RDI_EvalOp_Mod = 25,
RDI_EvalOp_LShift = 26,
RDI_EvalOp_RShift = 27,
RDI_EvalOp_BitAnd = 28,
RDI_EvalOp_BitOr = 29,
RDI_EvalOp_BitXor = 30,
RDI_EvalOp_BitNot = 31,
RDI_EvalOp_LogAnd = 32,
RDI_EvalOp_LogOr = 33,
RDI_EvalOp_LogNot = 34,
RDI_EvalOp_EqEq = 35,
RDI_EvalOp_NtEq = 36,
RDI_EvalOp_LsEq = 37,
RDI_EvalOp_GrEq = 38,
RDI_EvalOp_Less = 39,
RDI_EvalOp_Grtr = 40,
RDI_EvalOp_Trunc = 41,
RDI_EvalOp_TruncSigned = 42,
RDI_EvalOp_Convert = 43,
RDI_EvalOp_Pick = 44,
RDI_EvalOp_Pop = 45,
RDI_EvalOp_ValueRead = 46,
RDI_EvalOp_ByteSwap = 47,
RDI_EvalOp_CallSiteValue = 48,
@@ -939,7 +939,6 @@ X(Cond)\
X(Skip)\
X(MemRead)\
X(RegRead)\
X(Unused0)\
X(FrameOff)\
X(ModuleOff)\
X(TLSOff)\
@@ -950,6 +949,8 @@ X(ConstU16)\
X(ConstU32)\
X(ConstU64)\
X(ConstU128)\
X(ConstU256)\
X(ConstU512)\
X(ConstString)\
X(Abs)\
X(Neg)\
@@ -978,7 +979,6 @@ X(TruncSigned)\
X(Convert)\
X(Pick)\
X(Pop)\
X(Unused1)\
X(ValueRead)\
X(ByteSwap)\
X(CallSiteValue)\
+2 -2
View File
@@ -415,7 +415,7 @@
#include "stap/stap_parse.h"
#include "demon/demon_inc.h"
#include "eval/eval_inc.h"
// #include "eval2/eval2.h"
#include "eval2/eval2.h"
#include "dbg_engine/dbg_engine_inc.h"
#include "eval_visualization/eval_visualization_inc.h"
#include "font_provider/font_provider_inc.h"
@@ -475,7 +475,7 @@
#include "stap/stap_parse.c"
#include "demon/demon_inc.c"
#include "eval/eval_inc.c"
// #include "eval2/eval2.c"
#include "eval2/eval2.c"
#include "dbg_engine/dbg_engine_inc.c"
#include "eval_visualization/eval_visualization_inc.c"
#include "font_provider/font_provider_inc.c"
+41 -41
View File
@@ -77,7 +77,7 @@
"";
"// \"raddbg\\0\\0\"";
"#define RDI_MAGIC_CONSTANT 0x0000676264646172";
"#define RDI_ENCODING_VERSION 22";
"#define RDI_ENCODING_VERSION 23";
"";
"////////////////////////////////////////////////////////////////";
"//~ Format Types & Functions";
@@ -1202,46 +1202,46 @@ RDI_EvalOpTable:
{Skip 3 2 0 0}
{MemRead 4 1 1 1}
{RegRead 5 4 0 1}
{Unused0 6 0 0 1}
{FrameOff 7 8 0 1}
{ModuleOff 8 4 0 1}
{TLSOff 9 4 0 1}
{ObjectOff 10 0 0 0}
{CFA 11 0 0 0}
{ConstU8 12 1 0 1}
{ConstU16 13 2 0 1}
{ConstU32 14 4 0 1}
{ConstU64 15 8 0 1}
{ConstU128 16 16 0 1}
{ConstString 17 1 0 1}
{Abs 18 1 1 1}
{Neg 19 1 1 1}
{Add 20 1 2 1}
{Sub 21 1 2 1}
{Mul 22 1 2 1}
{Div 23 1 2 1}
{Mod 24 1 2 1}
{LShift 25 2 2 1}
{RShift 26 2 2 1}
{BitAnd 27 1 2 1}
{BitOr 28 1 2 1}
{BitXor 29 1 2 1}
{BitNot 30 1 1 1}
{LogAnd 31 1 2 1}
{LogOr 32 1 2 1}
{LogNot 33 1 1 1}
{EqEq 34 1 2 1}
{NtEq 35 1 2 1}
{LsEq 36 1 2 1}
{GrEq 37 1 2 1}
{Less 38 1 2 1}
{Grtr 39 1 2 1}
{Trunc 40 1 1 1}
{TruncSigned 41 1 1 1}
{Convert 42 2 1 1}
{Pick 43 1 0 1}
{Pop 44 0 1 0}
{Unused1 45 0 0 1}
{FrameOff 6 8 0 1}
{ModuleOff 7 4 0 1}
{TLSOff 8 4 0 1}
{ObjectOff 9 0 0 0}
{CFA 10 0 0 0}
{ConstU8 11 1 0 1}
{ConstU16 12 2 0 1}
{ConstU32 13 4 0 1}
{ConstU64 14 8 0 1}
{ConstU128 15 16 0 1}
{ConstU256 16 32 0 1}
{ConstU512 17 64 0 1}
{ConstString 18 1 0 1}
{Abs 19 1 1 1}
{Neg 20 1 1 1}
{Add 21 1 2 1}
{Sub 22 1 2 1}
{Mul 23 1 2 1}
{Div 24 1 2 1}
{Mod 25 1 2 1}
{LShift 26 2 2 1}
{RShift 27 2 2 1}
{BitAnd 28 1 2 1}
{BitOr 29 1 2 1}
{BitXor 30 1 2 1}
{BitNot 31 1 1 1}
{LogAnd 32 1 2 1}
{LogOr 33 1 2 1}
{LogNot 34 1 1 1}
{EqEq 35 1 2 1}
{NtEq 36 1 2 1}
{LsEq 37 1 2 1}
{GrEq 38 1 2 1}
{Less 39 1 2 1}
{Grtr 40 1 2 1}
{Trunc 41 1 1 1}
{TruncSigned 42 1 1 1}
{Convert 43 2 1 1}
{Pick 44 1 0 1}
{Pop 45 0 1 0}
{ValueRead 46 1 2 1}
{ByteSwap 47 1 1 1}
{CallSiteValue 48 4 0 0}