Raymond Toy pushed to branch issue-97-define-ud2-inst at cmucl / cmucl
Commits:
-
1b27941a
by Raymond Toy at 2021-03-22T20:00:49-07:00
-
5c92c14c
by Raymond Toy at 2021-03-23T03:34:19+00:00
-
20de3e8e
by Jon Boone at 2021-04-09T20:59:59+00:00
-
68e97641
by Raymond Toy at 2021-04-09T21:00:00+00:00
-
73d6de93
by Raymond Toy at 2021-04-10T11:03:40-07:00
-
8e4a873c
by Raymond Toy at 2021-04-10T21:24:37+00:00
-
7a6c5d35
by Raymond Toy at 2021-04-12T19:45:30-07:00
-
f3218ee0
by Raymond Toy at 2021-04-12T20:07:53-07:00
10 changed files:
- .gitlab-ci.yml
- .gitlab/issue_templates/Bug.md
- .gitlab/issue_templates/Feature.md
- src/code/room.lisp
- src/code/x86-vm.lisp
- src/compiler/x86/insts.lisp
- src/compiler/x86/macros.lisp
- src/i18n/locale/cmucl.pot
- src/lisp/x86-arch.c
- src/lisp/x86-assem.S
Changes:
... | ... | @@ -33,6 +33,9 @@ linux:build: |
33 | 33 |
artifacts:
|
34 | 34 |
paths:
|
35 | 35 |
- dist/
|
36 |
+ - linux-2/*.log
|
|
37 |
+ - linux-3/*.log
|
|
38 |
+ - linux-4/*.log
|
|
36 | 39 |
needs:
|
37 | 40 |
- job: linux:install
|
38 | 41 |
artifacts: true
|
... | ... | @@ -117,6 +120,9 @@ osx:build: |
117 | 120 |
artifacts:
|
118 | 121 |
paths:
|
119 | 122 |
- dist/
|
123 |
+ - darwin-2/*.log
|
|
124 |
+ - darwin-3/*.log
|
|
125 |
+ - darwin-4/*.log
|
|
120 | 126 |
needs:
|
121 | 127 |
- job: osx:install
|
122 | 128 |
artifacts: true
|
1 |
-**Describe the bug**
|
|
1 |
+## Describe the bug
|
|
2 | 2 |
A clear and concise description of what the bug is.
|
3 | 3 |
|
4 |
-**To Reproduce**
|
|
4 |
+## To Reproduce
|
|
5 | 5 |
Steps to reproduce the behavior:
|
6 | 6 |
1. Go to '...'
|
7 | 7 |
2. Click on '....'
|
8 | 8 |
3. Scroll down to '....'
|
9 | 9 |
4. See error
|
10 | 10 |
|
11 |
-**Expected behavior**
|
|
11 |
+## Expected behavior
|
|
12 | 12 |
A clear and concise description of what you expected to happen.
|
13 | 13 |
|
14 |
-**Screenshots**
|
|
14 |
+## Screenshots
|
|
15 | 15 |
If applicable, add screenshots to help explain your problem.
|
16 | 16 |
|
17 |
-**Desktop (please complete the following information):**
|
|
17 |
+## Desktop (please complete the following information):
|
|
18 | 18 |
- OS: [e.g. Linux]
|
19 | 19 |
- Version [e.g. 21c]
|
20 | 20 |
|
21 |
-**Additional context**
|
|
21 |
+## Additional context
|
|
22 | 22 |
Add any other context about the problem here.
|
23 | 23 |
|
24 | 24 |
/label ~bug
|
1 |
-**Describe the feature**
|
|
1 |
+## Describe the feature
|
|
2 | 2 |
Briefly describe the feature you would like see.
|
3 | 3 |
|
4 |
-**Is there a prototype?**
|
|
4 |
+## Is there a prototype?
|
|
5 | 5 |
If you have a prototype, provide links to illustrate this addition. This is the best way to propose a new feature.
|
6 | 6 |
|
7 |
-**Describe the feature in more detail**
|
|
7 |
+## Describe the feature in more detail
|
|
8 | 8 |
Provide more information to describe the feature.
|
9 | 9 |
|
10 | 10 |
/label ~feature
|
... | ... | @@ -707,11 +707,24 @@ |
707 | 707 |
|
708 | 708 |
;;; INSTANCE-USAGE -- Public
|
709 | 709 |
;;;
|
710 |
-(defun instance-usage (space &key (top-n 15))
|
|
711 |
- (declare (type spaces space) (type (or fixnum null) top-n))
|
|
712 |
- "Print a breakdown by instance type of all the instances allocated in
|
|
713 |
- Space. If TOP-N is true, print only information for the the TOP-N types with
|
|
714 |
- largest usage."
|
|
710 |
+(defun instance-usage (space &key
|
|
711 |
+ (top-n 15)
|
|
712 |
+ entries-var
|
|
713 |
+ (call-source "Unknown Caller"))
|
|
714 |
+ "Print a breakdown by instance type of all the allocation in Space.
|
|
715 |
+ |
|
716 |
+ :TOP-N
|
|
717 |
+ If true, print only the TOP-N types by largest usage.
|
|
718 |
+ |
|
719 |
+ :ENTRIES-VAR
|
|
720 |
+ If bound, contains the name of the symbol used to store the hash-table
|
|
721 |
+ of allocated entries for later processing.
|
|
722 |
+ |
|
723 |
+ :CALL-SOURCE
|
|
724 |
+ A string identifying the location from which instance-usage was called."
|
|
725 |
+ |
|
726 |
+ (declare (type spaces space) (type (or fixnum null) top-n)
|
|
727 |
+ (type (or symbol null) entries-var) (type string call-source))
|
|
715 | 728 |
(format t (intl:gettext "~2&~@[Top ~D ~]~(~A~) instance types:~%") top-n space)
|
716 | 729 |
(let ((totals (make-hash-table :test #'eq))
|
717 | 730 |
(total-objects 0)
|
... | ... | @@ -734,6 +747,10 @@ |
734 | 747 |
space)
|
735 | 748 |
|
736 | 749 |
(collect ((totals-list))
|
750 |
+ ;; set entries-var to the list of entries in totals
|
|
751 |
+ (when entries-var
|
|
752 |
+ (setf (symbol-value entries-var) (list call-source totals)))
|
|
753 |
+ |
|
737 | 754 |
(maphash #'(lambda (class what)
|
738 | 755 |
(totals-list (cons (prin1-to-string
|
739 | 756 |
(class-proper-name class))
|
... | ... | @@ -237,18 +237,15 @@ |
237 | 237 |
(with-alien ((scp (* unix:sigcontext) scp))
|
238 | 238 |
(let ((pc (sigcontext-program-counter scp)))
|
239 | 239 |
(declare (type system-area-pointer pc))
|
240 |
- ;; The pc should point to the start of the UD2 instruction. So we have something like:
|
|
240 |
+ ;; The pc should point to the start of the UD1 instruction. So we have something like:
|
|
241 | 241 |
;; offset contents
|
242 |
- ;; 0 UD2
|
|
243 |
- ;; 2 code
|
|
242 |
+ ;; 0 UD1 (contains the trap code)
|
|
244 | 243 |
;; 3 length
|
245 | 244 |
;; 4 bytes
|
246 | 245 |
(let* ((length (sap-ref-8 pc 3))
|
247 | 246 |
(vector (make-array length :element-type '(unsigned-byte 8))))
|
248 | 247 |
(declare (type (unsigned-byte 8) length)
|
249 | 248 |
(type (simple-array (unsigned-byte 8) (*)) vector))
|
250 |
- #+nil
|
|
251 |
- (format t "internal-error-args scp ~A: pc ~X len ~D~%" scp pc length)
|
|
252 | 249 |
;; Grab the length bytes after the length byte.
|
253 | 250 |
(copy-from-system-area pc (* vm:byte-bits 4)
|
254 | 251 |
vector (* vm:word-bits
|
... | ... | @@ -1778,7 +1778,7 @@ |
1778 | 1778 |
(disassem:define-instruction-format
|
1779 | 1779 |
(bit-test-reg/mem 24
|
1780 | 1780 |
:default-printer '(:name :tab reg/mem ", " reg))
|
1781 |
- (prefix :field (byte 8 0) :value #b0001111)
|
|
1781 |
+ (prefix :field (byte 8 0) :value #b0001111)
|
|
1782 | 1782 |
(op :field (byte 8 8))
|
1783 | 1783 |
;;(test :fields (list (byte 2 14) (byte 3 8)))
|
1784 | 1784 |
(reg/mem :fields (list (byte 2 22) (byte 3 16))
|
... | ... | @@ -2064,9 +2064,9 @@ |
2064 | 2064 |
|
2065 | 2065 |
;; The UD1 instruction. The mod bits of the mod r/m byte MUST be #b11
|
2066 | 2066 |
;; so that the reg/mem field is actually a register. This is a hack
|
2067 |
-;; to allow us to print out the reg/mem reg as a 32 reg. Using just
|
|
2068 |
-;; reg/mem, the register sometimes printed out as a byte reg and I
|
|
2069 |
-;; (toy.raymond) don't know why.
|
|
2067 |
+;; to allow us to print out the reg/mem reg as a 32-bit reg. Using
|
|
2068 |
+;; just reg/mem, the register sometimes printed out as a byte reg and
|
|
2069 |
+;; I (toy.raymond) don't know why.
|
|
2070 | 2070 |
(disassem:define-instruction-format
|
2071 | 2071 |
(ud1 24 :default-printer '(:name :tab reg ", " reg/mem))
|
2072 | 2072 |
(prefix :field (byte 8 0) :value #b00001111)
|
... | ... | @@ -2150,12 +2150,6 @@ |
2150 | 2150 |
(ldb (byte 3 3) code)
|
2151 | 2151 |
(ldb (byte 3 0) code))))
|
2152 | 2152 |
|
2153 |
-#+nil
|
|
2154 |
-(define-instruction ud2 (segment)
|
|
2155 |
- (:emitter
|
|
2156 |
- (emit-byte segment #b00001111)
|
|
2157 |
- (emit-byte segment #b00001011)))
|
|
2158 |
- |
|
2159 | 2153 |
(define-instruction int (segment number)
|
2160 | 2154 |
(:declare (type (unsigned-byte 8) number))
|
2161 | 2155 |
(:printer byte-imm ((op #b11001101)))
|
... | ... | @@ -254,8 +254,8 @@ |
254 | 254 |
`(let ((tn ,tn))
|
255 | 255 |
(write-var-integer
|
256 | 256 |
(make-sc-offset (sc-number (tn-sc tn))
|
257 |
- ;; tn-offset is zero for constant tns.
|
|
258 |
- (or (tn-offset tn) 0))
|
|
257 |
+ ;; tn-offset is zero for constant tns.
|
|
258 |
+ (or (tn-offset tn) 0))
|
|
259 | 259 |
,vector)))
|
260 | 260 |
values)
|
261 | 261 |
(let ((,length (length ,vector)))
|
... | ... | @@ -6333,10 +6333,19 @@ msgstr "" |
6333 | 6333 |
|
6334 | 6334 |
#: src/code/room.lisp
|
6335 | 6335 |
msgid ""
|
6336 |
-"Print a breakdown by instance type of all the instances allocated in\n"
|
|
6337 |
-" Space. If TOP-N is true, print only information for the the TOP-N types "
|
|
6338 |
-"with\n"
|
|
6339 |
-" largest usage."
|
|
6336 |
+"Print a breakdown by instance type of all the allocation in Space. \n"
|
|
6337 |
+"\n"
|
|
6338 |
+" :TOP-N \n"
|
|
6339 |
+" If true, print only the TOP-N types by largest usage.\n"
|
|
6340 |
+"\n"
|
|
6341 |
+" :ENTRIES-VAR\n"
|
|
6342 |
+" If bound, contains the name of the symbol used to store the hash-table"
|
|
6343 |
+"\n"
|
|
6344 |
+" of allocated entries for later processing.\n"
|
|
6345 |
+"\n"
|
|
6346 |
+" :CALL-SOURCE\n"
|
|
6347 |
+" A string identifying the location from which instance-usage was "
|
|
6348 |
+"called."
|
|
6340 | 6349 |
msgstr ""
|
6341 | 6350 |
|
6342 | 6351 |
#: src/code/room.lisp
|
... | ... | @@ -220,14 +220,13 @@ arch_set_pseudo_atomic_interrupted(os_context_t * context) |
220 | 220 |
unsigned long
|
221 | 221 |
arch_install_breakpoint(void *pc)
|
222 | 222 |
{
|
223 |
- unsigned char* ptr = (unsigned char *) pc;
|
|
224 |
- unsigned long result = *ptr;
|
|
223 |
+ unsigned long result = (unsigned char *) pc;
|
|
225 | 224 |
|
226 | 225 |
DPRINTF(debug_handlers,
|
227 | 226 |
(stderr, "arch_install_breakpoint at %p, old code = 0x%lx\n",
|
228 | 227 |
pc, result));
|
229 | 228 |
|
230 |
- *ptr = BREAKPOINT_INST; /* x86 INT3 */
|
|
229 |
+ *(unsigned char *) pc = BREAKPOINT_INST;
|
|
231 | 230 |
return result;
|
232 | 231 |
}
|
233 | 232 |
|
... | ... | @@ -237,11 +236,11 @@ arch_remove_breakpoint(void *pc, unsigned long orig_inst) |
237 | 236 |
DPRINTF(debug_handlers,
|
238 | 237 |
(stderr, "arch_remove_breakpoint: %p orig %lx\n",
|
239 | 238 |
pc, orig_inst));
|
240 |
- unsigned char *ptr = (unsigned char *) pc;
|
|
239 |
+ |
|
241 | 240 |
/*
|
242 | 241 |
* Just restore the byte from orig_inst.
|
243 | 242 |
*/
|
244 |
- ptr[0] = orig_inst & 0xff;
|
|
243 |
+ *(unsigned char *) pc = orig_inst & 0xff;
|
|
245 | 244 |
}
|
246 | 245 |
|
247 | 246 |
|
... | ... | @@ -300,13 +300,6 @@ multiple_value_return: |
300 | 300 |
|
301 | 301 |
.globl GNAME(function_end_breakpoint_trap)
|
302 | 302 |
GNAME(function_end_breakpoint_trap):
|
303 |
- /*
|
|
304 |
- ud1 0(%ecx), %ecx
|
|
305 |
- ud1 %ecx, %edx
|
|
306 |
- .byte 0x0f
|
|
307 |
- .byte 0xb9
|
|
308 |
- .byte 0xc0 + trap_PendingInterrupt
|
|
309 |
- */
|
|
310 | 303 |
TRAP_CODE(trap_FunctionEndBreakpoint)
|
311 | 304 |
hlt # Should never return here.
|
312 | 305 |
ENDFUNC(function_end_breakpoint_trap)
|