comparison src/ChangeLog @ 4921:17362f371cc2

add more byte-code assertions and better failure output -------------------- ChangeLog entries follow: -------------------- src/ChangeLog addition: 2010-02-03 Ben Wing <ben@xemacs.org> * alloc.c (Fmake_byte_code): * bytecode.h: * lisp.h: * lread.c: * lread.c (readevalloop): * lread.c (Fread): * lread.c (Fread_from_string): * lread.c (read_list_conser): * lread.c (read_list): * lread.c (vars_of_lread): * symbols.c: * symbols.c (Fdefine_function): Turn on the "compiled-function annotation hack". Implement it properly by hooking into Fdefalias(). Note in the docstring to `defalias' that we do this. Remove some old broken code and change code that implemented the old kludgy way of hooking into the Lisp reader into bracketed by `#ifdef COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY', which is not enabled. Also enable byte-code metering when DEBUG_XEMACS -- this is a form of profiling for computing histograms of which sequences of two bytecodes are used most often. * bytecode-ops.h: * bytecode-ops.h (OPCODE): New file. Extract out all the opcodes and declare them using OPCODE(), a bit like frame slots and such. This way the file can be included multiple times if necessary to iterate multiple times over the byte opcodes. * bytecode.c: * bytecode.c (NUM_REMEMBERED_BYTE_OPS): * bytecode.c (OPCODE): * bytecode.c (assert_failed_with_remembered_ops): * bytecode.c (READ_UINT_2): * bytecode.c (READ_INT_1): * bytecode.c (READ_INT_2): * bytecode.c (PEEK_INT_1): * bytecode.c (PEEK_INT_2): * bytecode.c (JUMP_RELATIVE): * bytecode.c (JUMP_NEXT): * bytecode.c (PUSH): * bytecode.c (POP_WITH_MULTIPLE_VALUES): * bytecode.c (DISCARD): * bytecode.c (UNUSED): * bytecode.c (optimize_byte_code): * bytecode.c (optimize_compiled_function): * bytecode.c (Fbyte_code): * bytecode.c (vars_of_bytecode): * bytecode.c (init_opcode_table_multi_op): * bytecode.c (reinit_vars_of_bytecode): * emacs.c (main_1): * eval.c (funcall_compiled_function): * symsinit.h: Any time we change either the instruction pointer or the stack pointer, assert that we're going to move it to a valid location. This should catch failures right when they occur rather than sometime later. This requires that we pass in another couple of parameters into some functions (only with error-checking enabled, see below). Also keep track, using a circular queue, of the last 100 byte opcodes seen, and when we hit an assert failure during byte-code execution, output the contents of the queue in a nice readable fashion. This requires that bytecode-ops.h be included a second time so that a table mapping opcodes to the name of their operation can be constructed. This table is constructed in new function reinit_vars_of_bytecode(). Everything in the last two paras happens only when ERROR_CHECK_BYTE_CODE. Add some longish comments describing how the arrays that hold the stack and instructions, and the pointers used to access them, work. * gc.c: Import some code from my `latest-fix' workspace to mark the staticpro's in order from lowest to highest, rather than highest to lowest, so it's easier to debug when something goes wrong. * lisp.h (abort_with_message): Renamed from abort_with_msg(). * symbols.c (defsymbol_massage_name_1): * symbols.c (defsymbol_nodump): * symbols.c (defsymbol): * symbols.c (defkeyword): * symeval.h (DEFVAR_SYMVAL_FWD_OBJECT): Make the various calls to staticpro() instead call staticpro_1(), passing in the name of the C var being staticpro'ed, so that it shows up in staticpro_names. Otherwise staticpro_names just has 1000+ copies of the word `location'.
author Ben Wing <ben@xemacs.org>
date Wed, 03 Feb 2010 08:01:55 -0600
parents 1628e3b9601a
children 8934492a0e97
comparison
equal deleted inserted replaced
4914:1628e3b9601a 4921:17362f371cc2
1 2010-02-03 Ben Wing <ben@xemacs.org>
2
3 * alloc.c (Fmake_byte_code):
4 * bytecode.h:
5 * lisp.h:
6 * lread.c:
7 * lread.c (readevalloop):
8 * lread.c (Fread):
9 * lread.c (Fread_from_string):
10 * lread.c (read_list_conser):
11 * lread.c (read_list):
12 * lread.c (vars_of_lread):
13 * symbols.c:
14 * symbols.c (Fdefine_function):
15 Turn on the "compiled-function annotation hack". Implement it
16 properly by hooking into Fdefalias(). Note in the docstring to
17 `defalias' that we do this. Remove some old broken code and
18 change code that implemented the old kludgy way of hooking into
19 the Lisp reader into bracketed by `#ifdef
20 COMPILED_FUNCTION_ANNOTATION_HACK_OLD_WAY', which is not enabled.
21
22 Also enable byte-code metering when DEBUG_XEMACS -- this is a form
23 of profiling for computing histograms of which sequences of two
24 bytecodes are used most often.
25
26 * bytecode-ops.h:
27 * bytecode-ops.h (OPCODE):
28 New file. Extract out all the opcodes and declare them using
29 OPCODE(), a bit like frame slots and such. This way the file can
30 be included multiple times if necessary to iterate multiple times
31 over the byte opcodes.
32
33 * bytecode.c:
34 * bytecode.c (NUM_REMEMBERED_BYTE_OPS):
35 * bytecode.c (OPCODE):
36 * bytecode.c (assert_failed_with_remembered_ops):
37 * bytecode.c (READ_UINT_2):
38 * bytecode.c (READ_INT_1):
39 * bytecode.c (READ_INT_2):
40 * bytecode.c (PEEK_INT_1):
41 * bytecode.c (PEEK_INT_2):
42 * bytecode.c (JUMP_RELATIVE):
43 * bytecode.c (JUMP_NEXT):
44 * bytecode.c (PUSH):
45 * bytecode.c (POP_WITH_MULTIPLE_VALUES):
46 * bytecode.c (DISCARD):
47 * bytecode.c (UNUSED):
48 * bytecode.c (optimize_byte_code):
49 * bytecode.c (optimize_compiled_function):
50 * bytecode.c (Fbyte_code):
51 * bytecode.c (vars_of_bytecode):
52 * bytecode.c (init_opcode_table_multi_op):
53 * bytecode.c (reinit_vars_of_bytecode):
54 * emacs.c (main_1):
55 * eval.c (funcall_compiled_function):
56 * symsinit.h:
57 Any time we change either the instruction pointer or the stack
58 pointer, assert that we're going to move it to a valid location.
59 This should catch failures right when they occur rather than
60 sometime later. This requires that we pass in another couple of
61 parameters into some functions (only with error-checking enabled,
62 see below).
63
64 Also keep track, using a circular queue, of the last 100 byte
65 opcodes seen, and when we hit an assert failure during byte-code
66 execution, output the contents of the queue in a nice readable
67 fashion. This requires that bytecode-ops.h be included a second
68 time so that a table mapping opcodes to the name of their operation
69 can be constructed. This table is constructed in new function
70 reinit_vars_of_bytecode().
71
72 Everything in the last two paras happens only when
73 ERROR_CHECK_BYTE_CODE.
74
75 Add some longish comments describing how the arrays that hold the
76 stack and instructions, and the pointers used to access them, work.
77
78 * gc.c:
79 Import some code from my `latest-fix' workspace to mark the
80 staticpro's in order from lowest to highest, rather than highest to
81 lowest, so it's easier to debug when something goes wrong.
82
83 * lisp.h (abort_with_message): Renamed from abort_with_msg().
84
85 * symbols.c (defsymbol_massage_name_1):
86 * symbols.c (defsymbol_nodump):
87 * symbols.c (defsymbol):
88 * symbols.c (defkeyword):
89 * symeval.h (DEFVAR_SYMVAL_FWD_OBJECT):
90 Make the various calls to staticpro() instead call staticpro_1(),
91 passing in the name of the C var being staticpro'ed, so that it
92 shows up in staticpro_names. Otherwise staticpro_names just has
93 1000+ copies of the word `location'.
94
1 2010-02-02 Ben Wing <ben@xemacs.org> 95 2010-02-02 Ben Wing <ben@xemacs.org>
2 96
3 * bytecode.c (execute_rare_opcode): 97 * bytecode.c (execute_rare_opcode):
4 * lisp.h (abort_with_msg): New. 98 * lisp.h (abort_with_msg): New.
5 When aborting due to unknown opcode, output more descriptive msg. 99 When aborting due to unknown opcode, output more descriptive msg.