Check-in [fbe1cde25c]

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

Overview
Comment:Base for boot libraries.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:fbe1cde25cd62d2eed62aa6df4b18a2ccdf33e69
User & Date: stephanie.gawroriski 2019-06-14 19:20:45
Context
2019-06-15
07:03
Backup developer notes. check-in: 5c762513e0 user: squirreljme tags: trunk
2019-06-14
19:20
Base for boot libraries. check-in: fbe1cde25c user: stephanie.gawroriski tags: trunk
18:23
Add JVMFunction.jvmLoadStringNoIntern(). check-in: c04fe0c5c9 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added runt/klib/supervisor/cc/squirreljme/jvm/BootLibrary.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
// -*- 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;

/**
 * This represents a single boot library.
 *
 * @since 2019/06/14
 */
public final class BootLibrary
{
	/** The offset to the jar count. */
	public static final int ROM_NUMJARS_OFFSET =
		4;
	
	/** Offset to the table of contents offset. */
	public static final int ROM_TOCOFFSET_OFFSET =
		28;
	
	/**
	 * Returns all of the libraries which are available to the bootstrap.
	 *
	 * @param __rombase The ROM base.
	 * @return The available bootstrap libraries.
	 * @since 2019/06/14
	 */
	public static final BootLibrary[] bootLibraries(int __rombase)
	{
		// Number of JARs in the ROM
		int numjars = Assembly.memReadJavaInt(__rombase, ROM_NUMJARS_OFFSET);
		
		// Offset to table of contents
		int tocoff = Assembly.memReadJavaInt(__rombase, ROM_TOCOFFSET_OFFSET);
		
		// Debug
		todo.DEBUG.code('n', 'J', numjars);
		todo.DEBUG.code('t', 'O', tocoff);
		todo.DEBUG.note("NumJars: %d, TocOff: %d", numjars, tocoff);
		
		Assembly.breakpoint();
		throw new todo.TODO();
	}
}

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

40
41
42
43
44
45
46



47
48
49
50
51
		int __rombase, int __romsize, int __confbase, int __confsize)
	{
		// Initialize the RAM links to setup dirty bits and initialize the
		// last block of memory with anything that remains. This makes it so
		// the RAM is actually useable.
		Allocator.__initRamLinks(__rambase, __ramsize);
		



		Assembly.breakpoint();
		throw new todo.TODO();
	}
}








>
>
>





40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
		int __rombase, int __romsize, int __confbase, int __confsize)
	{
		// Initialize the RAM links to setup dirty bits and initialize the
		// last block of memory with anything that remains. This makes it so
		// the RAM is actually useable.
		Allocator.__initRamLinks(__rambase, __ramsize);
		
		// Load boot libraries that are available
		BootLibrary[] bootlibs = BootLibrary.bootLibraries(__rombase);
		
		Assembly.breakpoint();
		throw new todo.TODO();
	}
}

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

280
281
282
283
284
285
286
287


288
289
290
291
292
293
294
295
296
297
298



299
300
301
302
303
304
305
	 *
	 * @param __p The pointer to load the string bytes from.
	 * @return The resulting and interned string.
	 * @since 2019/05/26
	 */
	public static final String jvmLoadString(int __p)
	{
		return JVMFunction.jvmLoadStringNoIntern(__p).intern();


	}
	
	/**
	 * Loads a string from memory and returns it.
	 *
	 * @param __p The pointer to load the string bytes from.
	 * @return The loaded string.
	 * @since 2019/06/14
	 */
	public static final String jvmLoadStringNoIntern(int __p)
	{



		// Access of invalid object?
		if (__p == Constants.BAD_MAGIC)
			throw new VirtualMachineError();
		
		// Cannot load from a null string
		if (__p == 0)
			throw new VirtualMachineError();







|
>
>











>
>
>







280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
	 *
	 * @param __p The pointer to load the string bytes from.
	 * @return The resulting and interned string.
	 * @since 2019/05/26
	 */
	public static final String jvmLoadString(int __p)
	{
		String base = JVMFunction.jvmLoadStringNoIntern(__p);
		todo.DEBUG.code('J', 's', Assembly.objectToPointer(base));
		return base.intern();
	}
	
	/**
	 * Loads a string from memory and returns it.
	 *
	 * @param __p The pointer to load the string bytes from.
	 * @return The loaded string.
	 * @since 2019/06/14
	 */
	public static final String jvmLoadStringNoIntern(int __p)
	{
		// Note
		todo.DEBUG.code('J', 'S', __p);
		
		// Access of invalid object?
		if (__p == Constants.BAD_MAGIC)
			throw new VirtualMachineError();
		
		// Cannot load from a null string
		if (__p == 0)
			throw new VirtualMachineError();

Changes to runt/klib/supervisor/java/lang/Integer.java.

15
16
17
18
19
20
21














22
23
24
25
26
27
28
29
30
31
32
33
34
35
 * This represents a boxed integer.
 *
 * @since 2019/05/25
 */
public final class Integer
	extends Number
{














	/**
	 * Returns a boxed value.
	 *
	 * @param __v The value to use.
	 * @return The boxed value.
	 * @since 2019/05/26
	 */
	public static final Integer valueOf(int __v)
	{
		Assembly.breakpoint();
		throw new todo.TODO();
	}
}








>
>
>
>
>
>
>
>
>
>
>
>
>
>









|
<



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
 * This represents a boxed integer.
 *
 * @since 2019/05/25
 */
public final class Integer
	extends Number
{
	/** The value of this integer. */
	private transient int _value;
	
	/**
	 * Initializes this integer.
	 *
	 * @param __v The value used.
	 * @since 2019/06/14
	 */
	public Integer(int __v)
	{
		this._value = __v;
	}
	
	/**
	 * Returns a boxed value.
	 *
	 * @param __v The value to use.
	 * @return The boxed value.
	 * @since 2019/05/26
	 */
	public static final Integer valueOf(int __v)
	{
		return new Integer(__v);

	}
}