76 #define WS_OPNAME(op) (operands[(op)].name) 77 #define WS_OPSIZE(op) (operands[(op)].size) 110 if (ins->
type > 0xff) {
115 ins->ws_label_idx, ins->ws_label_refcount);
120 ins->ws_label->ws_label_idx);
125 ins->ws_label->ws_label_idx);
143 func ? func :
"???");
149 ins->ws_lindex, ins->ws_findex, ins->ws_args);
179 ws_fatal(
"ws_asm_print(): unknown operand 0x%x", op);
279 snprintf(lnamebuf,
sizeof(lnamebuf),
"%d", lindex);
280 snprintf(fnamebuf,
sizeof(lnamebuf),
"%d", findex);
349 while (process_again) {
359 ins->ws_offset = (ins->ws_label->
offset 364 ins->ws_offset = (ins->ws_label->
offset 367 if (ins->ws_offset <= 31) {
374 ins->ws_offset = (ins->ws_label->
offset 377 if (ins->ws_offset <= 31) {
380 }
else if (ins->ws_offset <= 255) {
387 ins->ws_offset = offset - ins->ws_label->
offset;
391 ins->ws_offset = offset - ins->ws_label->
offset;
393 if (ins->ws_offset <= 31) {
400 ins->ws_offset = offset - ins->ws_label->
offset;
402 if (ins->ws_offset <= 31) {
405 }
else if (ins->ws_offset <= 255) {
412 ins->ws_offset = (ins->ws_label->
offset 417 ins->ws_offset = (ins->ws_label->
offset 420 if (ins->ws_offset <= 31) {
427 ins->ws_offset = (ins->ws_label->
offset 430 if (ins->ws_offset <= 31) {
433 }
else if (ins->ws_offset <= 255) {
440 ins->ws_offset = offset - ins->ws_label->
offset;
444 ins->ws_offset = offset - ins->ws_label->
offset;
446 if (ins->ws_offset <= 255) {
461 if (ins->ws_label->
offset == 0) {
465 ins->ws_offset = offset - ins->ws_label->
offset;
468 if (ins->ws_offset <= 31) {
470 }
else if (ins->ws_offset <= 255) {
479 if (ins->ws_label->
offset == 0) {
484 ins->ws_offset = offset - ins->ws_label->
offset;
487 if (ins->ws_offset <= 255) {
496 if (ins->ws_findex <= 7) {
506 if (ins->ws_findex <= 7 && ins->ws_lindex <= 255) {
509 }
else if (ins->ws_findex <= 255 && ins->ws_lindex <= 255) {
519 if (ins->ws_findex <= 255 && ins->ws_lindex <= 255)
527 if (ins->ws_vindex <= 31)
535 if (ins->ws_vindex <= 15)
542 if (ins->ws_vindex <= 7)
549 if (ins->ws_cindex <= 15)
551 else if (ins->ws_cindex <= 255)
784 ws_fatal(
"ws_asm_linearize(): unknown instruction 0x%02x",
848 ins->ws_label = label;
849 label->ws_label_refcount++;
861 ins->ws_findex = findex;
873 ins->ws_findex = findex;
874 ins->ws_lindex = lindex;
887 ins->ws_findex = findex;
888 ins->ws_lindex = urlindex;
902 ins->ws_vindex = vindex;
914 ins->ws_cindex = cindex;
void ws_asm_link(WsCompiler *compiler, WsAsmIns *ins)
void error(int err, const char *fmt,...)
void ws_fatal(char *fmt,...)
#define WS_ASM_CONST_TRUE
#define WS_ASM_P_CALL_LIB
#define WS_GET_UINT16(buf, var)
WsAsmIns * ws_asm_call_lib(WsCompiler *compiler, WsUInt32 line, WsUInt8 findex, WsUInt16 lindex)
WsAsmIns * ws_asm_branch(WsCompiler *compiler, WsUInt32 line, WsUInt16 inst, WsAsmIns *label)
gw_assert(wtls_machine->packet_to_send !=NULL)
#define WS_ASM_GLUE(op, arg)
#define WS_ASM_LOAD_CONST
WsAsmIns * ws_asm_label(WsCompiler *compiler, WsUInt32 line)
static WsAsmIns * asm_alloc(WsCompiler *compiler, WsUInt16 type, WsUInt32 line)
WsAsmIns * ws_asm_call_url(WsCompiler *compiler, WsUInt32 line, WsUInt16 findex, WsUInt16 urlindex, WsUInt8 args)
size_t ws_buffer_len(WsBuffer *buffer)
#define WS_GET_UINT8(buf, var)
static struct @112 operands[256]
#define WS_ASM_CONST_INVALID
#define WS_ASM_P_CALL_URL
#define WS_ASM_CONST_FALSE
WsAsmIns * ws_asm_load_const(WsCompiler *compiler, WsUInt32 line, WsUInt16 cindex)
#define WS_ASM_TJUMP_BW_W
WsAsmIns * ws_asm_call(WsCompiler *compiler, WsUInt32 line, WsUInt8 findex)
void ws_fprintf(WsIOProc io, void *context, const char *fmt,...)
struct WsAsmInsRec * next
#define WS_ASM_INCR_VAR_S
void ws_asm_dasm(WsCompilerPtr compiler, const unsigned char *code, size_t len)
#define WS_ASM_P_LOAD_VAR
#define WS_ASM_LOAD_CONST_W
WsAsmIns * ws_asm_variable(WsCompiler *compiler, WsUInt32 line, WsUInt16 inst, WsUInt8 vindex)
#define WS_ASM_CALL_LIB_S
WsBool ws_encode_buffer(WsBuffer *buffer,...)
WsAsmIns * ws_asm_ins(WsCompiler *compiler, WsUInt32 line, WsUInt8 opcode)
#define WS_ASM_LOAD_VAR_S
struct WsAsmInsRec * prev
#define WS_ASM_TJUMP_FW_S
void ws_asm_linearize(WsCompiler *compiler)
#define WS_ASM_P_STORE_VAR
#define WS_ASM_CALL_URL_W
#define WS_ASM_CALL_LIB_W
void * ws_f_calloc(WsFastMalloc *pool, size_t num, size_t size)
void ws_asm_print(WsCompiler *compiler)
#define WS_ASM_STORE_VAR_S
#define WS_ASM_B_RSZSHIFT
#define WS_ASM_P_LOAD_CONST
WsBool ws_stdlib_function_name(WsUInt16 lindex, WsUInt8 findex, const char **library_return, const char **function_return)
#define WS_ASM_TJUMP_FW_W
#define WS_ASM_LOAD_CONST_S
#define WS_ASM_P_INCR_VAR
void ws_error_memory(WsCompilerPtr compiler)