Move some primitives from memory and memory.private to tools.memory.private, add data-heap and code-heap words that wrap the struct for you
parent
83b8717bad
commit
ed9cf9e4fd
|
@ -1,4 +1,4 @@
|
|||
! Copyright (C) 2004, 2010 Slava Pestov, Daniel Ehrenberg.
|
||||
! Copyright (C) 2004, 2011 Slava Pestov, Daniel Ehrenberg.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: fry accessors alien alien.accessors alien.private arrays
|
||||
byte-arrays classes continuations.private effects generic
|
||||
|
@ -10,7 +10,7 @@ quotations.private sbufs sbufs.private sequences
|
|||
sequences.private slots.private strings strings.private system
|
||||
threads.private classes.tuple classes.tuple.private vectors
|
||||
vectors.private words words.private definitions assocs summary
|
||||
compiler.units system.private combinators
|
||||
compiler.units system.private combinators tools.memory.private
|
||||
combinators.short-circuit locals locals.backend locals.types
|
||||
combinators.private stack-checker.values generic.single
|
||||
generic.single.private alien.libraries tools.dispatch.private
|
||||
|
@ -348,13 +348,13 @@ M: object infer-call* \ call bad-macro-input ;
|
|||
\ callstack-for { c-ptr } { callstack } define-primitive \ callstack make-flushable
|
||||
\ callstack>array { callstack } { array } define-primitive \ callstack>array make-flushable
|
||||
\ check-datastack { array integer integer } { object } define-primitive \ check-datastack make-flushable
|
||||
\ code-room { } { byte-array } define-primitive \ code-room make-flushable
|
||||
\ (code-room) { } { byte-array } define-primitive \ (code-room) make-flushable
|
||||
\ compact-gc { } { } define-primitive
|
||||
\ compute-identity-hashcode { object } { } define-primitive
|
||||
\ context-object { fixnum } { object } define-primitive \ context-object make-flushable
|
||||
\ context-object-for { fixnum c-ptr } { object } define-primitive \ context-object-for make-flushable
|
||||
\ current-callback { } { fixnum } define-primitive \ current-callback make-flushable
|
||||
\ data-room { } { byte-array } define-primitive \ data-room make-flushable
|
||||
\ (data-room) { } { byte-array } define-primitive \ (data-room) make-flushable
|
||||
\ datastack { } { array } define-primitive \ datastack make-flushable
|
||||
\ datastack-for { c-ptr } { array } define-primitive \ datastack-for make-flushable
|
||||
\ die { } { } define-primitive
|
||||
|
|
|
@ -48,3 +48,11 @@ HELP: gc-summary.
|
|||
|
||||
HELP: gc-events
|
||||
{ $var-description "A sequence of " { $link gc-event } " instances, set by " { $link collect-gc-events } ". Can be inspected directly, or with the " { $link gc-events. } ", " { $link gc-stats. } " and " { $link gc-summary. } " words." } ;
|
||||
|
||||
HELP: data-room
|
||||
{ $values { "data-heap-room" data-heap-room } }
|
||||
{ $description "Queries the VM for memory usage information." } ;
|
||||
|
||||
HELP: code-room
|
||||
{ $values { "mark-sweep-sizes" mark-sweep-sizes } }
|
||||
{ $description "Queries the VM for memory usage information." } ;
|
||||
|
|
|
@ -1,12 +1,11 @@
|
|||
! Copyright (C) 2005, 2010 Slava Pestov.
|
||||
! Copyright (C) 2005, 2011 Slava Pestov.
|
||||
! See http://factorcode.org/license.txt for BSD license.
|
||||
USING: accessors arrays assocs binary-search classes
|
||||
classes.struct combinators combinators.smart continuations fry
|
||||
generalizations generic grouping io io.styles kernel make math
|
||||
math.order math.parser math.statistics memory memory.private
|
||||
layouts namespaces parser prettyprint sequences
|
||||
sequences.generalizations sorting splitting strings system vm
|
||||
words hints hashtables ;
|
||||
math.order math.parser math.statistics memory layouts namespaces
|
||||
parser prettyprint sequences sequences.generalizations sorting
|
||||
splitting strings system vm words hints hashtables ;
|
||||
IN: tools.memory
|
||||
|
||||
<PRIVATE
|
||||
|
@ -58,9 +57,12 @@ IN: tools.memory
|
|||
|
||||
PRIVATE>
|
||||
|
||||
: data-room ( -- data-heap-room )
|
||||
(data-room) data-heap-room memory>struct ;
|
||||
|
||||
: data-room. ( -- )
|
||||
"== Data heap ==" print nl
|
||||
data-room data-heap-room memory>struct {
|
||||
data-room {
|
||||
[ nursery-room. nl ]
|
||||
[ aging-room. nl ]
|
||||
[ tenured-room. nl ]
|
||||
|
@ -286,9 +288,12 @@ INSTANCE: code-blocks immutable-sequence
|
|||
|
||||
PRIVATE>
|
||||
|
||||
: code-room ( -- mark-sweep-sizes )
|
||||
(code-room) mark-sweep-sizes memory>struct ;
|
||||
|
||||
: code-room. ( -- )
|
||||
"== Code heap ==" print nl
|
||||
code-room mark-sweep-sizes memory>struct mark-sweep-table. nl
|
||||
code-room mark-sweep-table. nl
|
||||
code-blocks code-block-stats code-block-table. ;
|
||||
|
||||
: room. ( -- )
|
||||
|
|
|
@ -103,6 +103,7 @@ call( -- )
|
|||
"system.private"
|
||||
"threads.private"
|
||||
"tools.dispatch.private"
|
||||
"tools.memory.private"
|
||||
"tools.profiler.private"
|
||||
"words"
|
||||
"words.private"
|
||||
|
@ -515,12 +516,12 @@ tuple
|
|||
{ "float>bignum" "math.private" "primitive_float_to_bignum" (( x -- y )) }
|
||||
{ "float>fixnum" "math.private" "primitive_float_to_fixnum" (( x -- y )) }
|
||||
{ "all-instances" "memory" "primitive_all_instances" (( -- array )) }
|
||||
{ "(code-blocks)" "memory.private" "primitive_code_blocks" (( -- array )) }
|
||||
{ "code-room" "memory" "primitive_code_room" (( -- code-room )) }
|
||||
{ "(code-blocks)" "tools.memory.private" "primitive_code_blocks" (( -- array )) }
|
||||
{ "(code-room)" "tools.memory.private" "primitive_code_room" (( -- code-room )) }
|
||||
{ "compact-gc" "memory" "primitive_compact_gc" (( -- )) }
|
||||
{ "data-room" "memory" "primitive_data_room" (( -- data-room )) }
|
||||
{ "disable-gc-events" "memory" "primitive_disable_gc_events" (( -- events )) }
|
||||
{ "enable-gc-events" "memory" "primitive_enable_gc_events" (( -- )) }
|
||||
{ "(data-room)" "tools.memory.private" "primitive_data_room" (( -- data-room )) }
|
||||
{ "disable-gc-events" "tools.memory.private" "primitive_disable_gc_events" (( -- events )) }
|
||||
{ "enable-gc-events" "tools.memory.private" "primitive_enable_gc_events" (( -- )) }
|
||||
{ "gc" "memory" "primitive_full_gc" (( -- )) }
|
||||
{ "minor-gc" "memory" "primitive_minor_gc" (( -- )) }
|
||||
{ "size" "memory" "primitive_size" (( obj -- n )) }
|
||||
|
|
|
@ -9,14 +9,6 @@ HELP: instances
|
|||
HELP: gc ( -- )
|
||||
{ $description "Performs a full garbage collection." } ;
|
||||
|
||||
HELP: data-room ( -- data-room )
|
||||
{ $values { "data-room" data-room } }
|
||||
{ $description "Queries the VM for memory usage information." } ;
|
||||
|
||||
HELP: code-room ( -- code-room )
|
||||
{ $values { "code-room" code-room } }
|
||||
{ $description "Queries the VM for memory usage information." } ;
|
||||
|
||||
HELP: size ( obj -- n )
|
||||
{ $values { "obj" "an object" } { "n" "a size in bytes" } }
|
||||
{ $description "Outputs the size of the object in memory, in bytes. Tagged immediate objects such as fixnums and " { $link f } " will yield a size of 0." } ;
|
||||
|
|
Loading…
Reference in New Issue