diff options
author | Waldemar Celes <celes@tecgraf.puc-rio.br> | 1994-04-13 18:37:20 -0300 |
---|---|---|
committer | Waldemar Celes <celes@tecgraf.puc-rio.br> | 1994-04-13 18:37:20 -0300 |
commit | 8ca980966ca383c120dadb2c6e6a0850d1bfff58 (patch) | |
tree | 60822d655ea3fa23f54ab27b01838aa35e9fb3fa /opcode.h | |
parent | 662e2fa5ccf1dfa0ebea571d6785009442ba3011 (diff) | |
download | lua-8ca980966ca383c120dadb2c6e6a0850d1bfff58.tar.gz lua-8ca980966ca383c120dadb2c6e6a0850d1bfff58.tar.bz2 lua-8ca980966ca383c120dadb2c6e6a0850d1bfff58.zip |
Alteracao para retirar codificacao de NOP's, substituindo
pela utilizacao de "union" com "chars" para codificar Word e float.
Observa-se que foram realizados testes antes da alteracao e constatou-se
que do bytecode anteriormente gerado, NOP representava de 10 a 13% do
total de bytes do codigo. Esta percentagem chegava ate' a 20% na caso
de descricao de metafile utilizando Lua.
Diffstat (limited to 'opcode.h')
-rw-r--r-- | opcode.h | 20 |
1 files changed, 18 insertions, 2 deletions
@@ -1,6 +1,6 @@ | |||
1 | /* | 1 | /* |
2 | ** TeCGraf - PUC-Rio | 2 | ** TeCGraf - PUC-Rio |
3 | ** $Id: opcode.h,v 1.2 1993/12/22 21:15:16 roberto Exp roberto $ | 3 | ** $Id: opcode.h,v 1.3 1994/02/13 20:35:53 roberto Exp celes $ |
4 | */ | 4 | */ |
5 | 5 | ||
6 | #ifndef opcode_h | 6 | #ifndef opcode_h |
@@ -20,9 +20,20 @@ typedef unsigned char Byte; | |||
20 | 20 | ||
21 | typedef unsigned short Word; | 21 | typedef unsigned short Word; |
22 | 22 | ||
23 | typedef union | ||
24 | { | ||
25 | struct {char c1; char c2;} m; | ||
26 | Word w; | ||
27 | } CodeWord; | ||
28 | |||
29 | typedef union | ||
30 | { | ||
31 | struct {char c1; char c2; char c3; char c4;} m; | ||
32 | float f; | ||
33 | } CodeFloat; | ||
34 | |||
23 | typedef enum | 35 | typedef enum |
24 | { | 36 | { |
25 | NOP, | ||
26 | PUSHNIL, | 37 | PUSHNIL, |
27 | PUSH0, PUSH1, PUSH2, | 38 | PUSH0, PUSH1, PUSH2, |
28 | PUSHBYTE, | 39 | PUSHBYTE, |
@@ -129,6 +140,11 @@ typedef struct | |||
129 | #define s_fvalue(i) (fvalue(&s_object(i))) | 140 | #define s_fvalue(i) (fvalue(&s_object(i))) |
130 | #define s_uvalue(i) (uvalue(&s_object(i))) | 141 | #define s_uvalue(i) (uvalue(&s_object(i))) |
131 | 142 | ||
143 | #define get_word(code,pc) {code.m.c1 = *pc++; code.m.c2 = *pc++;} | ||
144 | #define get_float(code,pc) {code.m.c1 = *pc++; code.m.c2 = *pc++;\ | ||
145 | code.m.c3 = *pc++; code.m.c4 = *pc++;} | ||
146 | |||
147 | |||
132 | 148 | ||
133 | /* Exported functions */ | 149 | /* Exported functions */ |
134 | int lua_execute (Byte *pc); | 150 | int lua_execute (Byte *pc); |