RSS

(root)/ildjit/iljit : 1 : src/internal_calls_gc.c

« back to all changes in this revision

Viewing changes to src/internal_calls_gc.c

Speziale Ettore
2009-11-18 13:08:01
Revision ID: ettore@mars-20091118130801-ntc9elzzzz0c62xz
Initial import into Bazaar.

Show diffs side-by-side

added added

removed removed

 
1
/*
 
2
 * Copyright (C) 2009  Campanoni Simone
 
3
 *
 
4
 * 
 
5
 * This program is free software; you can redistribute it and/or modify
 
6
 * it under the terms of the GNU General Public License as published by
 
7
 * the Free Software Foundation; either version 2 of the License, or
 
8
 * (at your option) any later version.
 
9
 *
 
10
 * This program is distributed in the hope that it will be useful,
 
11
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 
12
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
13
 * GNU General Public License for more details.
 
14
 *
 
15
 * You should have received a copy of the GNU General Public License
 
16
 * along with this program; if not, write to the Free Software
 
17
 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307  USA
 
18
 */
 
19
#include <stdio.h>
 
20
 
 
21
// My headers
 
22
#include <internal_calls_gc.h>
 
23
#include <internal_calls_utilities.h>
 
24
#include <system_manager.h>
 
25
#include <general_tools.h>
 
26
#include <iljit.h>
 
27
// End
 
28
 
 
29
void System_GC_KeepAlive (void *object) {
 
30
        t_system        *system;
 
31
        
 
32
        /* Fetch the system             */
 
33
        system          = getSystem(NULL);
 
34
        assert(system != NULL);
 
35
        
 
36
        METHOD_BEGIN(system, "System.GC.KeepAlive");
 
37
        //TODO
 
38
        abort();
 
39
        /* Return                       */
 
40
        METHOD_END(system, "System.GC.KeepAlive");
 
41
}
 
42
 
 
43
void System_GC_WaitForPendingFinalizers (void){
 
44
        t_system        *system;
 
45
 
 
46
        /* Fetch the system             */
 
47
        system          = getSystem(NULL);
 
48
        assert(system != NULL);
 
49
        METHOD_BEGIN(system, "System.GC.WaitForPendingFinalizers");
 
50
        
 
51
        /* Return                       */
 
52
        METHOD_END(system, "System.GC.WaitForPendingFinalizers");
 
53
        return ;
 
54
}
 
55
 
 
56
void System_GC_SuppressFinalize (void *object){
 
57
        t_system        *system;
 
58
 
 
59
        /* Fetch the system             */
 
60
        system          = getSystem(NULL);
 
61
        assert(system != NULL);
 
62
        METHOD_BEGIN(system, "System.GC.SuppressFinalize");
 
63
        
 
64
        (system->garbage_collectors).gc.setFinalizedFlag(object);
 
65
 
 
66
        /* Return               */
 
67
        METHOD_END(system, "System.GC.SuppressFinalize");
 
68
        return;
 
69
}
 
70
 
 
71
void System_GC_Collect (void){
 
72
        t_system        *system;
 
73
 
 
74
        /* Fetch the system             */
 
75
        system          = getSystem(NULL);
 
76
        assert(system != NULL);
 
77
 
 
78
        /* Assertions           */
 
79
        METHOD_BEGIN(system, "System.GC.Collect");
 
80
        
 
81
        /* Call the GC          */
 
82
        if (!(system->IRVM).behavior.noExplicitGarbageCollection){
 
83
                (system->garbage_collectors).gc.collect();
 
84
        }
 
85
        
 
86
        /* Return               */
 
87
        METHOD_END(system, "System.GC.Collect");
 
88
        return;
 
89
}
 
90
 
 
91
/* Get maximum generation number */
 
92
JITINT32 System_GC_get_MaxGeneration(void) {
 
93
  t_system* system;
 
94
  JITINT32 maximumGeneration;
 
95
 
 
96
  system = getSystem(NULL);
 
97
 
 
98
  METHOD_BEGIN(system, "System.GC.get_MaxGeneration");
 
99
 
 
100
  maximumGeneration = 0;
 
101
 
 
102
  METHOD_END(system, "System.GC.get_MaxGeneration");
 
103
 
 
104
  return maximumGeneration;
 
105
}
 
106
 
 
107
/* Collect given generation */
 
108
void System_GC_InternalCollect(JITINT32 generation) {
 
109
  t_system* system;
 
110
 
 
111
  system = getSystem(NULL);
 
112
 
 
113
  METHOD_BEGIN(system, "System.GC.InternalCollect");
 
114
 
 
115
  System_GC_Collect();
 
116
 
 
117
  METHOD_END(system, "System.GC.InternalCollect");
 
118
 
 
119
}

Loggerhead 1.17 is a web-based interface for Bazaar branches