Check-in [83d6e7ccd2]

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

Overview
Comment:Remove deprecated code.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 83d6e7ccd2abb3d8c2b8f9c6d2ce1e61a3f2d17c
User & Date: stephanie.gawroriski 2019-10-27 16:28:50
Context
2019-10-27
17:30
Some moving around. check-in: 07268ce39f user: stephanie.gawroriski tags: trunk
16:28
Remove deprecated code. check-in: 83d6e7ccd2 user: stephanie.gawroriski tags: trunk
16:26
Refactor the class loading a bit; Store resource index of the class; Base for moving around code. check-in: cebb4a9b01 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Deleted runt/klib/supervisor/cc/squirreljme/jvm/loader/MiniClassAccessor.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

import cc.squirreljme.jvm.Assembly;
import cc.squirreljme.jvm.io.BinaryBlob;

/**
 * This class is used as a utility to access the data contained within the
 * mini-class format.
 *
 * @since 2019/07/11
 */
@Deprecated
public final class MiniClassAccessor
{
	/** Offset to the interface field byte size. */
	public static final byte IFBYTES_OFFSET =
		64;
	
	/** The blob for data access. */
	protected final BinaryBlob blob;
	
	/**
	 * Initializes the mini class accessor.
	 *
	 * @param __a The binary blob.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/07/11
	 */
	public MiniClassAccessor(BinaryBlob __a)
		throws NullPointerException
	{
		if (__a == null)
			throw new NullPointerException("NARG");
		
		this.blob = __a;
	}
	
	/**
	 * Returns the base size of the class instance.
	 *
	 * @return The base class instance size.
	 * @since 2019/07/11
	 */
	public final int baseInstanceSize()
	{
		return this.blob.readJavaInt(IFBYTES_OFFSET);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




















































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/loader/package-info.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

/**
 * This package contains the class loader logic for sub-tasks and their
 * virtual machines.
 *
 * @since 2019/09/21
 */

@Deprecated
package cc.squirreljme.jvm.loader;

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<






































Deleted runt/klib/supervisor/cc/squirreljme/jvm/task/ClientClassInfo.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

import cc.squirreljme.jvm.io.BinaryBlob;

/**
 * This contains the client class information.
 *
 * @since 2019/06/24
 */
@Deprecated
public final class ClientClassInfo
	implements AutoCloseable
{
	/** The pointer to the class information. */
	public final int classinfopointer;
	
	/** The pointer to the mini-class information. */
	public final BinaryBlob miniclassaddress;
	
	/** The mini accessor instance which exists. */
	private volatile MiniClassAccessor _miniaccessor;
	
	/** The number of times the accessor is open. */
	private volatile int _opencount;
	
	/**
	 * Initializes the client class information.
	 *
	 * @param __cip The class info pointer.
	 * @param __minip The mini class address.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/06/24
	 */
	public ClientClassInfo(int __cip, BinaryBlob __minip)
		throws NullPointerException
	{
		if (__minip == null)
			throw new NullPointerException("NARG");
		
		this.classinfopointer = __cip;
		this.miniclassaddress = __minip;
	}
	
	/**
	 * Returns the mini-class accessor, only accessible after open.
	 *
	 * @return The mini-class accessor.
	 * @since 2019/07/11
	 */
	public final MiniClassAccessor accessor()
	{
		return this._miniaccessor;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/07/11
	 */
	@Override
	public final void close()
	{
		// Get current count
		int opencount = this._opencount;
		
		// Reduce the count
		if (opencount > 0)
			opencount--;
		
		// Store new count
		this._opencount = 0;
		
		// If there are no counts then clear the object so it gets GCed
		if (opencount == 0)
			this._miniaccessor = null;
	}
	
	/**
	 * Opens the class for its accessor to be accessed.
	 *
	 * @return {@code this}.
	 * @since 2019/07/11
	 */
	public final ClientClassInfo open()
	{
		// Detail details
		int opencount = this._opencount;
		MiniClassAccessor rv = this._miniaccessor;
		
		// If this is just being opened, then create an accessor for it
		if (opencount == 0)
			this._miniaccessor = (rv =
				new MiniClassAccessor(this.miniclassaddress));
		
		// Count up
		this._opencount = opencount + 1;
		
		// Return self
		return this;
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




























































































































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/task/ClientLinkageError.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

/**
 * This is thrown when there has been a linkage error when the client is being
 * loaded, as such it cannot be loaded.
 *
 * @since 2019/07/11
 */
public class ClientLinkageError
	extends RuntimeException
{
	/**
	 * Initializes the exception with no message or cause.
	 *
	 * @since 2019/07/11
	 */
	public ClientLinkageError()
	{
	}
	
	/**
	 * Initializes the exception with the given message and no cause.
	 *
	 * @param __m The message.
	 * @since 2019/07/11
	 */
	public ClientLinkageError(String __m)
	{
		super(__m);
	}
	
	/**
	 * Initializes the exception with the given message and cause.
	 *
	 * @param __m The message.
	 * @param __t The cause.
	 * @since 2019/07/11
	 */
	public ClientLinkageError(String __m, Throwable __t)
	{
		super(__m, __t);
	}
	
	/**
	 * Initializes the exception with the given cause and no message.
	 *
	 * @param __t The cause.
	 * @since 2019/07/11
	 */
	public ClientLinkageError(Throwable __t)
	{
		super(__t);
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
































































































































Deleted runt/klib/supervisor/cc/squirreljme/jvm/task/ClientThread.java.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.jvm.task;

/**
 * This represents a single thread within a class.
 *
 * @since 2019/09/22
 */
public final class ClientThread
{
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<








































Changes to runt/klib/supervisor/cc/squirreljme/jvm/task/Task.java.

35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
..
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
...
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
	
	/** Allocator for this task. */
	public final TaskAllocator allocator;
	
	/** The classpath. */
	public final ClassPath classpath;
	
	/** Classes which have been loaded. */
	@Deprecated
	public final HashMap<String, ClientClassInfo> classinfos =
		new HashMap<>();
	
	/** Classes which have been read and initialized. */
	private final HashMap<String, TaskClass> _classes =
		new HashMap<>();
	
	/** The accessor for client class information. */
	private volatile MiniClassAccessor _classinfoaccessor;
	
	/**
	 * Initializes the client task.
	 *
	 * @param __pid The PID.
	 * @param __lid The LID.
	 * @param __cp The classpath used.
	 * @throws NullPointerException On null arguments.
................................................................................
		this.lid = __lid;
		this.classpath = __cp;
		
		// Initialize allocator for memory grabbing
		this.allocator = new TaskAllocator(__pid);
	}
	
	/**
	 * Returns the mini-class accessor for the {@link ClassInfo} class.
	 *
	 * @return The ClassInfo mini-class accessor.
	 * @since 2019/07/11
	 */
	@Deprecated
	public final MiniClassAccessor classInfoAccessor()
	{
		// If it has already been used, only get it once!
		MiniClassAccessor rv = this._classinfoaccessor;
		if (rv != null)
			return rv;
		
		// Debug
		todo.DEBUG.note("Searching for ClassInfo...");
		
		// Locate class resource
		int dx = this.classpath.resourceClassFind(
			"cc/squirreljme/jvm/ClassInfo");
		if (dx < 0)
			return null;
		
		// Cache it
		this._classinfoaccessor = (rv = new MiniClassAccessor(
			this.classpath.resourceData(dx)));
		
		// Use it
		return rv;
	}
	
	/**
	 * Creates a new thread
	 *
	 * @return The resulting thread.
	 * @since 2019/10/13
	 */
	public final TaskThread createThread()
................................................................................
			rv.initializeClassInfoSetup(this);
		}
		
		// Perform post initialization as needed
		return rv.initializeClassInfo(this);
	}
	
	/**
	 * Loads the in-memory class information for the given class.
	 *
	 * @param __cl The class to load.
	 * @return The loaded class information or {@code null} if it is not found.
	 * @throws ClientLinkageError If the client class could not be initialized.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/06/23
	 */
	@Deprecated
	public final ClientClassInfo loadClassInfo(String __cl)
		throws ClientLinkageError, NullPointerException
	{
		if (__cl == null)
			throw new NullPointerException("NARG");
		
		// See if it was loaded already
		HashMap<String, ClientClassInfo> classinfos = this.classinfos;
		ClientClassInfo rv = classinfos.get(__cl);
		if (classinfos.containsKey(__cl))
			return (rv != null ? rv : null);
		
		// Debug
		todo.DEBUG.note("Finding class %s...", __cl);
		
		// Attempt to locate the class, if not found remember this and stop
		int dx = this.classpath.resourceClassFind(__cl);
		if (dx < 0)
		{
			classinfos.put(__cl, null);
			return null;
		}
		
		// Debug
		todo.DEBUG.note("Initializing class info %s...", __cl);
		
		// Get the layout for the class information (where fields go)
		MiniClassAccessor ccia = this.classInfoAccessor();
		
		// {@squirreljme.error SV04 Could not allocate class information.}
		int cip = this.allocator.allocate(Allocator.CHUNK_BIT_IS_OBJECT,
			Constants.OBJECT_BASE_SIZE + ccia.baseInstanceSize());
		if (cip == 0)
			throw new ClientLinkageError("SV04");
		
		// Class initialization involves many recursive calls into the class
		// loading being called, so as such store the class info pointer and
		// such before any processing is done so it is done first
		classinfos.put(__cl,
			(rv = new ClientClassInfo(cip, this.classpath.resourceData(dx))));
		
		// Write the class type for the class information
		Assembly.memWriteInt(cip, Constants.OBJECT_CLASS_OFFSET,
			this.loadClassInfo("cc/squirreljme/jvm/ClassInfo").
			classinfopointer);
		
		// "Open" the class so that its accessor can be used
		try (ClientClassInfo xp = rv.open())
		{
			// Load the mini-class accessor
			MiniClassAccessor clma = xp.accessor();
			
			Assembly.breakpoint();
			throw new todo.TODO();
		}
	}
	
	/**
	 * Loads an object array with the given values and class type.
	 *
	 * @param __cl The class type.
	 * @param __vs The values to store.
	 * @return The resulting object array.
	 * @since 2019/10/13







<
<
<
<
<




<
<
<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







 







<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<







35
36
37
38
39
40
41





42
43
44
45



46
47
48
49
50
51
52
..
62
63
64
65
66
67
68































69
70
71
72
73
74
75
...
122
123
124
125
126
127
128



































































129
130
131
132
133
134
135
	
	/** Allocator for this task. */
	public final TaskAllocator allocator;
	
	/** The classpath. */
	public final ClassPath classpath;
	





	/** Classes which have been read and initialized. */
	private final HashMap<String, TaskClass> _classes =
		new HashMap<>();
	



	/**
	 * Initializes the client task.
	 *
	 * @param __pid The PID.
	 * @param __lid The LID.
	 * @param __cp The classpath used.
	 * @throws NullPointerException On null arguments.
................................................................................
		this.lid = __lid;
		this.classpath = __cp;
		
		// Initialize allocator for memory grabbing
		this.allocator = new TaskAllocator(__pid);
	}
	































	/**
	 * Creates a new thread
	 *
	 * @return The resulting thread.
	 * @since 2019/10/13
	 */
	public final TaskThread createThread()
................................................................................
			rv.initializeClassInfoSetup(this);
		}
		
		// Perform post initialization as needed
		return rv.initializeClassInfo(this);
	}
	



































































	/**
	 * Loads an object array with the given values and class type.
	 *
	 * @param __cl The class type.
	 * @param __vs The values to store.
	 * @return The resulting object array.
	 * @since 2019/10/13