Check-in [23cd4679f0]

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

Overview
Comment:Implement allocation of string arrays.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | wip-springcoat-bringup
Files: files | file ages | folders
SHA1: 23cd4679f0b9c17123f01b9128d35e75613606bc
User & Date: stephanie.gawroriski 2020-03-26 00:08:44
Context
2020-03-27
00:25
A bunch of cleanup and such. check-in: 446a1a1728 user: stephanie.gawroriski tags: wip-springcoat-bringup
2020-03-26
00:08
Implement allocation of string arrays. check-in: 23cd4679f0 user: stephanie.gawroriski tags: wip-springcoat-bringup
2020-03-23
00:17
Add base for array viewer and simple object views. check-in: 7d82f2b57d user: stephanie.gawroriski tags: wip-springcoat-bringup
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to .idea/fileTemplates/code/Switch Default Branch.java.

1
throw Debugging.oops(${EXPRESSION})
|
1
throw Debugging.oops(${EXPRESSION});

Changes to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/ObjectLoader.java.

5
6
7
8
9
10
11

12

13
14
15
16
17
18
19
...
130
131
132
133
134
135
136
137
































































































// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;


import cc.squirreljme.vm.springcoat.objects.ArrayViewer;

import java.util.Map;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ConstantValueString;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodNameAndType;

/**
................................................................................
		SpringPointer utfPointer = machine.tasks.memory.loadUtf(
			__in.toString());
		
		// Call the string internal intern since it does the things needed
		return __thread.invokeMethod(true, ObjectLoader._STRING_CLASS,
			ObjectLoader._LOAD_NAME_AND_TYPE, utfPointer.pointer);
	}
}







































































































>

>







 







|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
...
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
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
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package cc.squirreljme.vm.springcoat;

import cc.squirreljme.runtime.cldc.debug.Debugging;
import cc.squirreljme.vm.springcoat.objects.ArrayViewer;
import cc.squirreljme.vm.springcoat.objects.ObjectViewer;
import java.util.Map;
import net.multiphasicapps.classfile.ClassName;
import net.multiphasicapps.classfile.ConstantValueString;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.MethodNameAndType;

/**
................................................................................
		SpringPointer utfPointer = machine.tasks.memory.loadUtf(
			__in.toString());
		
		// Call the string internal intern since it does the things needed
		return __thread.invokeMethod(true, ObjectLoader._STRING_CLASS,
			ObjectLoader._LOAD_NAME_AND_TYPE, utfPointer.pointer);
	}
	
	/**
	 * Allocates new array.
	 *
	 * @param <T> The type of array viewer to create.
	 * @param __thread The creating thread.
	 * @param __componentType The component type.
	 * @param __len The length of the array.
	 * @return The array viewer.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/03/25
	 */
	public static <T> ArrayViewer<T> newArray(SpringThreadWorker __thread,
		SpringClass __componentType, int __len)
		throws NullPointerException
	{
		if (__thread == null || __componentType == null)
			throw new NullPointerException("NARG");
		
		throw Debugging.todo();
	}
	
	/**
	 * Creates a new instance of the given class.
	 *
	 * @param __thread The thread to allocate under.
	 * @param __class The class to allocate.
	 * @return The allocated object.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/03/25
	 */
	public static ObjectViewer newInstance(SpringThreadWorker __thread,
		SpringClass __class)
		throws NullPointerException
	{
		if (__thread == null || __class == null)
			throw new NullPointerException("NARG");
		
		throw Debugging.todo();
	}
	
	/**
	 * Allocates a new string.
	 *
	 * @param __thread The allocating thread.
	 * @param __s The string to allocate.
	 * @return The allocated string.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/03/25
	 */
	public static ObjectViewer newString(SpringThreadWorker __thread,
		String __s)
		throws NullPointerException
	{
		if (__thread == null || __s == null)
			throw new NullPointerException("NARG");
		
		throw Debugging.todo();
	}
	
	/**
	 * Initializes a new string array.
	 *
	 * @param __thread The thread to create under.
	 * @param __vs Array values.
	 * @return The resultant array.
	 * @throws NullPointerException On null arguments.
	 * @since 2020/03/22
	 */
	public static ArrayViewer<ObjectViewer> newStringArray(
		SpringThreadWorker __thread, String... __vs)
		throws NullPointerException
	{
		if (__thread == null)
			throw new NullPointerException("NARG");
		
		if (__vs == null)
			__vs = new String[0];
		
		// Allocate array
		ArrayViewer<ObjectViewer> rv = ObjectLoader.<ObjectViewer>newArray(
			__thread,
			__thread.machine.classloader.loadClass(ObjectLoader._STRING_CLASS),
			__vs.length);
		
		// Store strings into the array
		for (int i = 0, n = __vs.length; i < n; i++)
		{
			String v = __vs[i];
			
			if (v != null)
				rv.set(i, ObjectLoader.newString(__thread, v));
		}
		
		return rv;
	}
}

Changes to emulators/springcoat-vm/src/main/java/cc/squirreljme/vm/springcoat/SpringMachine.java.

16
17
18
19
20
21
22


23
24
25
26
27
28
29
...
307
308
309
310
311
312
313




314
315
316
317
318
319
320
import cc.squirreljme.emulator.vm.VirtualMachine;
import cc.squirreljme.jvm.ThreadStartIndex;
import cc.squirreljme.runtime.cldc.asm.TaskAccess;
import cc.squirreljme.vm.VMClassLibrary;
import cc.squirreljme.vm.springcoat.exceptions.SpringFatalException;
import cc.squirreljme.vm.springcoat.exceptions.SpringMachineExitException;
import cc.squirreljme.vm.springcoat.exceptions.SpringVirtualMachineException;


import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import net.multiphasicapps.classfile.ClassName;
................................................................................
		
		// All code enters at a static main method, regardless of the
		// circumstances
		SpringMethod main = entrycl.lookupMethod(true,
			new MethodNameAndType("main", "([Ljava/lang/String;)V"));
		SpringPointer mainFp = this.tasks.memory.bindMethod(main);
		




		// Initialize main program arguments
		String[] inargs = this._args;
		int inlen = inargs.length;
		
		// Setup array
		SpringArrayObject outargs = worker.allocateArray(
			worker.resolveClass(new ClassName("java/lang/String")), inlen);







>
>







 







>
>
>
>







16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
...
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
import cc.squirreljme.emulator.vm.VirtualMachine;
import cc.squirreljme.jvm.ThreadStartIndex;
import cc.squirreljme.runtime.cldc.asm.TaskAccess;
import cc.squirreljme.vm.VMClassLibrary;
import cc.squirreljme.vm.springcoat.exceptions.SpringFatalException;
import cc.squirreljme.vm.springcoat.exceptions.SpringMachineExitException;
import cc.squirreljme.vm.springcoat.exceptions.SpringVirtualMachineException;
import cc.squirreljme.vm.springcoat.objects.ArrayViewer;
import cc.squirreljme.vm.springcoat.objects.ObjectViewer;
import java.io.PrintStream;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;
import net.multiphasicapps.classfile.ClassName;
................................................................................
		
		// All code enters at a static main method, regardless of the
		// circumstances
		SpringMethod main = entrycl.lookupMethod(true,
			new MethodNameAndType("main", "([Ljava/lang/String;)V"));
		SpringPointer mainFp = this.tasks.memory.bindMethod(main);
		
		// Load in main program arguments
		ArrayViewer<ObjectViewer> mainArgs =
			ObjectLoader.newStringArray(worker, this._args);
		
		// Initialize main program arguments
		String[] inargs = this._args;
		int inlen = inargs.length;
		
		// Setup array
		SpringArrayObject outargs = worker.allocateArray(
			worker.resolveClass(new ClassName("java/lang/String")), inlen);