Check-in [9cc578ba18]

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Implement garbage collection of objects.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:9cc578ba186bd10b104847a8ea712fbaf0f84346
User & Date: stephanie.gawroriski 2019-06-13 21:39:07
Context
2019-06-13
21:46
Do not count up replaced fields, instead count down. check-in: db1373b5d4 user: stephanie.gawroriski tags: trunk
21:39
Implement garbage collection of objects. check-in: 9cc578ba18 user: stephanie.gawroriski tags: trunk
19:03
In RatufaCoat, ignore writes to ROM. check-in: a39677c16d user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/klib/supervisor/cc/squirreljme/jvm/JVMFunction.java.

109
110
111
112
113
114
115

116
117
118
119
120
121
122
...
126
127
128
129
130
131
132
133
134









135
136
137
138
139
140
141
		if (pcl == 0 || pcl == Constants.BAD_MAGIC)
			throw new VirtualMachineError();
		
		// Get class info for this type
		ClassInfo pinfo = Assembly.pointerToClassInfo(pcl);
		
		// If this is an array, elements have to be uncounted

		if ((pinfo.flags & Constants.CIF_IS_ARRAY) != 0)
		{
			// This only needs to be done for objects
			if ((pinfo.flags & Constants.CIF_IS_ARRAY_OF_OBJECTS) != 0)
			{
				// Go through all elements and uncount them
				for (int i = 0, n = Assembly.memReadInt(__p,
................................................................................
					Assembly.refUncount(Assembly.memReadInt(bp, 0));
			}
		}
		
		// Otherwise uncount the instance field information
		else
		{
			Assembly.breakpoint();
			throw new todo.TODO();









		}
		
		// Free this memory
		Allocator.free(__p);
	}
	
	/**







>







 







|
|
>
>
>
>
>
>
>
>
>







109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
...
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
		if (pcl == 0 || pcl == Constants.BAD_MAGIC)
			throw new VirtualMachineError();
		
		// Get class info for this type
		ClassInfo pinfo = Assembly.pointerToClassInfo(pcl);
		
		// If this is an array, elements have to be uncounted
		// Instance fields can be skipped for non-object arrays
		if ((pinfo.flags & Constants.CIF_IS_ARRAY) != 0)
		{
			// This only needs to be done for objects
			if ((pinfo.flags & Constants.CIF_IS_ARRAY_OF_OBJECTS) != 0)
			{
				// Go through all elements and uncount them
				for (int i = 0, n = Assembly.memReadInt(__p,
................................................................................
					Assembly.refUncount(Assembly.memReadInt(bp, 0));
			}
		}
		
		// Otherwise uncount the instance field information
		else
		{
			// Go through all classes in the class chain
			for (ClassInfo ro = pinfo; ro != null; ro = ro.superclass)
			{
				// Actual base position for the objects in the instances
				int rbase = __p + ro.base;
				
				// Clear all offsets in the object
				int rnobj = ro.numobjects;
				for (int i = 0, px = 0; i < rnobj; i++, px += 4)
					Assembly.refUncount(Assembly.memReadInt(rbase, px));
			}
		}
		
		// Free this memory
		Allocator.free(__p);
	}
	
	/**