*** empty log message ***
This commit is contained in:
parent
81d93832f1
commit
d8b4f8b710
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: bytecode.h,v 1.5 2005-07-08 11:32:50 bacon Exp $
|
||||
* $Id: bytecode.h,v 1.6 2005-07-10 03:16:40 bacon Exp $
|
||||
*/
|
||||
|
||||
#ifndef _XP_STX_BYTECODE_H_
|
||||
@ -8,7 +8,33 @@
|
||||
#include <xp/stx/stx.h>
|
||||
|
||||
#define PUSH_RECEIVER_VARIABLE 0x00
|
||||
#define PUSH_RECEIVER_VARIABLE_BIG 0x10
|
||||
#define PUSH_TEMPORARY_LOCATION 0x10
|
||||
#define PUSH_LITERAL_CONSTANT 0x20
|
||||
#define PUSH_LITERAL_VARIABLE 0x30
|
||||
#define STORE_RECEIVER_VARIABLE 0x40
|
||||
#define STORE_TEMPORARY_LOCATION 0x50
|
||||
|
||||
#define PUSH_RECEIVER_VARIABLE_EXTENDED 0x60
|
||||
#define PUSH_TEMPORARY_LOCATION_EXTENDED 0x61
|
||||
#define PUSH_LITERAL_CONSTANT_EXTENDED 0x62
|
||||
#define PUSH_LITERAL_VARIABLE_EXTENDED 0x63
|
||||
#define STORE_RECEIVER_VARIABLE_EXTENDED 0x64
|
||||
#define STORE_TEMPORARY_LOCATION_EXTENDED 0x65
|
||||
#define STORE_POP_STACK_TOP 0x68
|
||||
#define DUPLICATE_POP_STACK_TOP 0x69
|
||||
#define PUSH_ACTIVE_CONTEXT 0x6A
|
||||
|
||||
#define SEND_SELECTOR_TO_SELF 0x70
|
||||
#define SEND_SELECTOR_TO_SUPER 0x71
|
||||
#define SEND_SELECTOR_TO_SELF_EXTENDED 0x72
|
||||
#define SEND_SELECTOR_TO_SUPER_EXTENDED 0x73
|
||||
|
||||
#define RETURN_RECEIVER 0x78
|
||||
#define RETURN_TRUE 0x79
|
||||
#define RETURN_FALSE 0x7A
|
||||
#define RETURN_NIL 0x7B
|
||||
#define RETURN_FROM_MESSAGE 0x7C
|
||||
#define RETURN_FROM_BLOCK 0x7D
|
||||
|
||||
#define PUSH_VARIABLE 0x0
|
||||
#define PUSH_TEMPORARY 0x1
|
||||
@ -34,9 +60,6 @@
|
||||
#define RETURN_FROM_MESSAGE 5
|
||||
#define RETURN_FROM_BLOCK 6
|
||||
|
||||
#define PUSH_VARIABLE(i) ((i <= 0x0F)? (i):
|
||||
#define PUSH_VARIABLE(i) i
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
@ -1,5 +1,5 @@
|
||||
/*
|
||||
* $Id: parser.c,v 1.59 2005-07-08 11:32:50 bacon Exp $
|
||||
* $Id: parser.c,v 1.60 2005-07-10 03:16:40 bacon Exp $
|
||||
*/
|
||||
|
||||
#include <xp/stx/parser.h>
|
||||
@ -258,12 +258,42 @@ static INLINE int __emit_code (xp_stx_parser_t* parser, xp_byte_t code)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INLINE int __emit_stack_code_positional (
|
||||
xp_stx_parser_t* parser, int opcode, int pos)
|
||||
{
|
||||
static int mapping[] = {
|
||||
PUSH_RECEIVER_VARIABLE_EXTENDED,
|
||||
PUSH_TEMPORARY_LOCATION_EXTENDED,
|
||||
PUSH_LITERAL_CONSTANT_EXTENDED,
|
||||
PUSH_LITERAL_VARIABLE_EXTENDED,
|
||||
STORE_RECEIVER_VARIABLE,
|
||||
STORE_TEMPORARY_VARIABLE
|
||||
};
|
||||
}
|
||||
|
||||
static INLINE int __emit_push_receiver_variable (xp_stx_parser_t* parser, int pos)
|
||||
{
|
||||
if (pos > 0xFF)
|
||||
if (pos > 0x0F) {
|
||||
EMIT_CODE (parser, PUSH_RECEIVER_VARIABLE | (pos & 0x0F));
|
||||
}
|
||||
else {
|
||||
EMIT_CODE (parser, PUSH_RECEIVER_VARIABLE_EXTENDED);
|
||||
EMIT_CODE (parser, pos & 0xFF)
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static INLINE int __emit_push_temporary_location (xp_stx_parser_t* parser, int pos)
|
||||
{
|
||||
if (pos > 0x0F) {
|
||||
EMIT_CODE (parser, PUSH_TEMPORARY_LOCATION | (pos & 0x0F));
|
||||
}
|
||||
else {
|
||||
EMIT_CODE (parser, PUSH_RECEIVER_VARIABLE_EXTENDED);
|
||||
EMIT_CODE (parser, pos & 0xFF)
|
||||
}
|
||||
|
||||
if (pos > 0x0F) EMIT_CODE (parser, PUSH_RECEIVER_VARIABLE | (pos & 0x0F));
|
||||
else EMIT_CODE (parser, PUSH_RECEIVER_VARIABLE_BIG, pos);
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -79,6 +79,8 @@ AssignInstance
|
||||
AssignTemporary
|
||||
*/
|
||||
|
||||
Pocket Smalltalk
|
||||
|
||||
0x push instance variable x
|
||||
1x store instance variable x
|
||||
2x push local x
|
||||
@ -169,3 +171,53 @@ FD
|
||||
FE xx primitive xx
|
||||
FF extended op
|
||||
|
||||
-- stack bytecodes --
|
||||
0 0000 XXXX push_receiver_variable
|
||||
1 0001 XXXX push_temporary_location
|
||||
2 0010 XXXX push_literal_constant
|
||||
3 0011 XXXX push_literal_variable
|
||||
4 0100 XXXX store_receiver_variable
|
||||
5 0101 XXXX store_temporary_location
|
||||
6 0110 0000 XXXXXXXX push_receiver_variable_extended
|
||||
0110 0001 XXXXXXXX push_temporary_location_extended
|
||||
0110 0010 XXXXXXXX push_literal_constant_extended
|
||||
0110 0011 XXXXXXXX push_literal_variable_extended
|
||||
0110 0100 XXXXXXXX store_receiver_variable_extended
|
||||
0110 0101 XXXXXXXX store_temporary_location_extended
|
||||
0110 0110 XXXXXXXX unused
|
||||
0110 0111 XXXXXXXX unused
|
||||
0110 1000 pop_stack_top
|
||||
0110 1001 duplicate_stack_top
|
||||
0110 1010 push_active_context
|
||||
0110 1011 XXXXXXXX unused
|
||||
0110 1100 XXXXXXXX unused
|
||||
0110 1101 XXXXXXXX unused
|
||||
0110 1110 XXXXXXXX unused
|
||||
0110 1111 XXXXXXXX unused
|
||||
|
||||
-- send bytecodes --
|
||||
7 0111 0000 JJJKKKKK send_selector_to_self
|
||||
0111 0001 JJJKKKKK send_selector_to_super
|
||||
0111 0010 JJJJJJJJ KKKKKKKK send_selector_to_self_extended
|
||||
0111 0011 JJJJJJJJ KKKKKKKK send_selector_to_super_extended
|
||||
|
||||
0111 0100 XXXXXXXX
|
||||
0111 0101 XXXXXXXX
|
||||
0111 0110 XXXXXXXX
|
||||
0111 0111 XXXXXXXX
|
||||
|
||||
-- return bytecodes --
|
||||
0111 1000 return receiver
|
||||
0111 1001 return_true
|
||||
0111 1010 return_false
|
||||
0111 1011 return_nil
|
||||
|
||||
0111 1100 return_from_message
|
||||
0111 1101 return_from_block
|
||||
0111 1110
|
||||
0111 1111
|
||||
|
||||
-- jump bytecodes --
|
||||
8 1000 0XXX jump_forward
|
||||
1000 1XXX XXXXXXXX jump_forward
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user