Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Open sidebar
emacs
emacs
Commits
155ffe9c
Commit
155ffe9c
authored
Jan 11, 1995
by
Richard M. Stallman
Browse files
(DONT_COPY_FLAG): New bit flag.
(mark_object, gc_sweep, compact_strings): Use it.
parent
99e372cd
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
18 additions
and
8 deletions
+18
-8
src/alloc.c
src/alloc.c
+18
-8
No files found.
src/alloc.c
View file @
155ffe9c
...
@@ -107,6 +107,12 @@ Lisp_Object memory_signal_data;
...
@@ -107,6 +107,12 @@ Lisp_Object memory_signal_data;
#define MAX_SAVE_STACK 16000
#define MAX_SAVE_STACK 16000
#endif
#endif
/* Define DONT_COPY_FLAG to be the bit in a small string that was placed
in the low bit of the size field when marking small strings. */
#ifndef DONT_COPY_FLAG
#define DONT_COPY_FLAG PSEUDO_VECTOR_FLAG
#endif
/* no DONT_COPY_FLAG */
/* Buffer in which we save a copy of the C stack at each GC. */
/* Buffer in which we save a copy of the C stack at each GC. */
char
*
stack_copy
;
char
*
stack_copy
;
...
@@ -1514,10 +1520,12 @@ mark_object (objptr)
...
@@ -1514,10 +1520,12 @@ mark_object (objptr)
}
}
else
else
XSETFASTINT
(
*
objptr
,
ptr
->
size
);
XSETFASTINT
(
*
objptr
,
ptr
->
size
);
if
((
EMACS_INT
)
objptr
&
1
)
abort
();
if
((
EMACS_INT
)
objptr
&
DONT_COPY_FLAG
)
abort
();
ptr
->
size
=
(
EMACS_INT
)
objptr
&
~
MARKBIT
;
ptr
->
size
=
(
EMACS_INT
)
objptr
&
~
MARKBIT
;
if
((
EMACS_INT
)
objptr
&
MARKBIT
)
if
((
EMACS_INT
)
objptr
&
MARKBIT
)
ptr
->
size
++
;
ptr
->
size
|=
DONT_COPY_FLAG
;
}
}
}
}
break
;
break
;
...
@@ -2035,7 +2043,7 @@ gc_sweep ()
...
@@ -2035,7 +2043,7 @@ gc_sweep ()
if
(
s
->
size
&
ARRAY_MARK_FLAG
)
if
(
s
->
size
&
ARRAY_MARK_FLAG
)
{
{
((
struct
Lisp_String
*
)(
&
sb
->
chars
[
0
]))
->
size
((
struct
Lisp_String
*
)(
&
sb
->
chars
[
0
]))
->
size
&=
~
ARRAY_MARK_FLAG
&
~
MARKBIT
;
&=
~
ARRAY_MARK_FLAG
&
~
MARKBIT
&
~
DONT_COPY_FLAG
;
UNMARK_BALANCE_INTERVALS
(
s
->
intervals
);
UNMARK_BALANCE_INTERVALS
(
s
->
intervals
);
total_string_size
+=
((
struct
Lisp_String
*
)(
&
sb
->
chars
[
0
]))
->
size
;
total_string_size
+=
((
struct
Lisp_String
*
)(
&
sb
->
chars
[
0
]))
->
size
;
prev
=
sb
,
sb
=
sb
->
next
;
prev
=
sb
,
sb
=
sb
->
next
;
...
@@ -2085,13 +2093,14 @@ compact_strings ()
...
@@ -2085,13 +2093,14 @@ compact_strings ()
/* NEXTSTR is the old address of the next string.
/* NEXTSTR is the old address of the next string.
Just skip it if it isn't marked. */
Just skip it if it isn't marked. */
if
((
EMACS_UINT
)
size
>
STRING_BLOCK_SIZE
)
if
((
(
EMACS_UINT
)
size
&
~
DONT_COPY_FLAG
)
>
STRING_BLOCK_SIZE
)
{
{
/* It is marked, so its size field is really a chain of refs.
/* It is marked, so its size field is really a chain of refs.
Find the end of the chain, where the actual size lives. */
Find the end of the chain, where the actual size lives. */
while
((
EMACS_UINT
)
size
>
STRING_BLOCK_SIZE
)
while
((
(
EMACS_UINT
)
size
&
~
DONT_COPY_FLAG
)
>
STRING_BLOCK_SIZE
)
{
{
if
(
size
&
1
)
size
^=
MARKBIT
|
1
;
if
(
size
&
DONT_COPY_FLAG
)
size
^=
MARKBIT
|
DONT_COPY_FLAG
;
size
=
*
(
EMACS_INT
*
)
size
&
~
MARKBIT
;
size
=
*
(
EMACS_INT
*
)
size
&
~
MARKBIT
;
}
}
...
@@ -2125,10 +2134,11 @@ compact_strings ()
...
@@ -2125,10 +2134,11 @@ compact_strings ()
and make each slot in the chain point to
and make each slot in the chain point to
the new address of this string. */
the new address of this string. */
size
=
newaddr
->
size
;
size
=
newaddr
->
size
;
while
((
EMACS_UINT
)
size
>
STRING_BLOCK_SIZE
)
while
((
(
EMACS_UINT
)
size
&
~
DONT_COPY_FLAG
)
>
STRING_BLOCK_SIZE
)
{
{
register
Lisp_Object
*
objptr
;
register
Lisp_Object
*
objptr
;
if
(
size
&
1
)
size
^=
MARKBIT
|
1
;
if
(
size
&
DONT_COPY_FLAG
)
size
^=
MARKBIT
|
DONT_COPY_FLAG
;
objptr
=
(
Lisp_Object
*
)
size
;
objptr
=
(
Lisp_Object
*
)
size
;
size
=
XFASTINT
(
*
objptr
)
&
~
MARKBIT
;
size
=
XFASTINT
(
*
objptr
)
&
~
MARKBIT
;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment