@@ -17,84 +17,62 @@ extern "C" {
17
17
18
18
typedef void * MMTk_Mutator ;
19
19
typedef void * MMTk_Builder ;
20
- typedef void * MMTk ;
21
20
22
21
// Initialize an MMTk instance
23
- extern MMTk mmtk_init (MMTk_Builder builder );
22
+ extern void mmtk_init (MMTk_Builder builder );
24
23
25
24
// Request MMTk to create a new mutator for the given `tls` thread
26
25
extern MMTk_Mutator mmtk_bind_mutator (void * tls );
27
26
28
27
// Reclaim mutator that is no longer needed
29
28
extern void mmtk_destroy_mutator (MMTk_Mutator mutator );
30
29
31
- // Flush mutator local state
32
- extern void mmtk_flush_mutator (MMTk_Mutator mutator );
33
-
34
- // Initialize MMTk scheduler and GC workers
35
- extern void mmtk_initialize_collection (void * tls );
36
-
37
30
// Allocate memory for an object
38
31
extern void * mmtk_alloc (MMTk_Mutator mutator ,
39
32
size_t size ,
40
33
size_t align ,
41
34
size_t offset ,
42
35
int allocator );
43
36
44
- // Slowpath allocation for an object
45
- extern void * mmtk_alloc_slow (MMTk_Mutator mutator ,
46
- size_t size ,
47
- size_t align ,
48
- size_t offset ,
49
- int allocator );
50
-
51
37
// Perform post-allocation hooks or actions such as initializing object metadata
52
38
extern void mmtk_post_alloc (MMTk_Mutator mutator ,
53
39
void * refer ,
54
40
int bytes ,
55
41
int allocator );
56
42
57
- // Return if the object pointed to by `ref` is live
58
- extern bool mmtk_is_live_object (void * ref );
59
-
60
- // Return if the object pointed to by `ref` is in mapped memory
61
- extern bool mmtk_is_mapped_object (void * ref );
62
-
63
- // Return if the address pointed to by `addr` is in mapped memory
64
- extern bool mmtk_is_mapped_address (void * addr );
65
-
66
- // Return if object pointed to by `object` will never move
67
- extern bool mmtk_will_never_move (void * object );
68
-
69
- // Process an MMTk option. Return true if option was processed successfully
70
- extern bool mmtk_process (MMTk_Builder builder , char * name , char * value );
71
-
72
- // Process MMTk options. Return true if all options were processed successfully
73
- extern bool mmtk_process_bulk (MMTk_Builder builder , char * options );
74
-
75
- // Sanity only. Scan heap for discrepancies and errors
76
- extern void mmtk_scan_region ();
77
-
78
- // Request MMTk to trigger a GC. Note that this may not actually trigger a GC
79
- extern void mmtk_handle_user_collection_request (void * tls );
80
-
81
43
// Run the main loop for a GC worker. Does not return
82
44
extern void mmtk_start_worker (void * tls , void * worker );
83
45
84
- // Return the current amount of free memory in bytes
85
- extern size_t mmtk_free_bytes ( );
46
+ // Initialize MMTk scheduler and GC workers
47
+ extern void mmtk_initialize_collection ( void * tls );
86
48
87
49
// Return the current amount of used memory in bytes
88
50
extern size_t mmtk_used_bytes ();
89
51
52
+ // Return the current amount of free memory in bytes
53
+ extern size_t mmtk_free_bytes ();
54
+
90
55
// Return the current amount of total memory in bytes
91
56
extern size_t mmtk_total_bytes ();
92
57
93
- // Return the starting address of MMTk's heap
94
- extern void * mmtk_starting_heap_address ( );
58
+ // Return if the object pointed to by `object` is live
59
+ extern bool mmtk_is_live_object ( void * object );
95
60
96
- // Return the ending address of MMTk's heap
97
- extern void * mmtk_last_heap_address ();
61
+ // Return if object pointed to by `object` will never move
62
+ extern bool mmtk_will_never_move (void * object );
63
+
64
+ // Return if the address is an object in MMTk heap.
65
+ // Only available when the feature is_mmtk_object is enabled.
66
+ extern bool mmtk_is_mmtk_object (void * addr );
67
+
68
+ // Return if the object is in any MMTk space.
69
+ extern bool mmtk_is_in_mmtk_spaces (void * object );
70
+
71
+ // Return if the address pointed to by `addr` is in memory that is mapped by MMTk
72
+ extern bool mmtk_is_mapped_address (void * addr );
73
+
74
+ // Request MMTk to trigger a GC. Note that this may not actually trigger a GC
75
+ extern void mmtk_handle_user_collection_request (void * tls );
98
76
99
77
// Add a reference to the list of weak references
100
78
extern void mmtk_add_weak_candidate (void * ref );
@@ -111,6 +89,33 @@ extern void mmtk_harness_begin(void* tls);
111
89
// Generic hook to allow benchmarks to be harnessed
112
90
extern void mmtk_harness_end ();
113
91
92
+ // Create an MMTKBuilder
93
+ extern MMTk_Builder mmtk_create_builder ();
94
+
95
+ // Process an MMTk option. Return true if option was processed successfully
96
+ extern bool mmtk_process (MMTk_Builder builder , char * name , char * value );
97
+
98
+ // Return the starting address of MMTk's heap
99
+ extern void * mmtk_starting_heap_address ();
100
+
101
+ // Return the ending address of MMTk's heap
102
+ extern void * mmtk_last_heap_address ();
103
+
104
+ // Standard malloc functions
105
+ extern void * mmtk_malloc (size_t size );
106
+ extern void * mmtk_calloc (size_t num , size_t size );
107
+ extern void * mmtk_realloc (void * addr , size_t size );
108
+ extern void * mmtk_free (void * addr );
109
+
110
+ // Counted versions of the malloc functions. The allocation size will be ounted into the MMTk heap.
111
+ // Only available when the feature malloc_counted_size is enabled.
112
+ extern void * mmtk_counted_malloc (size_t size );
113
+ extern void * mmtk_counted_calloc (size_t num , size_t size );
114
+ extern void * mmtk_realloc_with_old_size (void * addr , size_t size , size_t old_size );
115
+ extern void * mmtk_free_with_size (void * addr , size_t old_size );
116
+ // Get the number of active bytes in malloc.
117
+ extern size_t mmtk_get_malloc_bytes ();
118
+
114
119
#ifdef __cplusplus
115
120
}
116
121
#endif
0 commit comments