Check-in [ae01fc3475]

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

Overview
Comment:Minor work on cleanup.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:ae01fc34756fbd55cc5af58fd52be7a0623aef3c
User & Date: stephanie.gawroriski 2019-02-06 00:28:30
Context
2019-02-06
08:02
Backup developer notes. check-in: 59063dccda user: squirreljme tags: trunk
00:28
Minor work on cleanup. check-in: ae01fc3475 user: stephanie.gawroriski tags: trunk
2019-02-05
20:57
Minor work. check-in: 29f98c01b8 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/libs/tool-classfile-scrf-compiler/net/multiphasicapps/scrf/compiler/PrimitiveByteCodeProcessor.java.

142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
						registers.virtualPush());
					break;
					
					// Load static field
				case InstructionIndex.GETSTATIC:
					FieldReference sfr = inst.<FieldReference>argument(0,
						FieldReference.class);
					if (true)
						throw new todo.TODO();
					/*
					cb.addLoad(???, vtable., registers.virtualPush());
					MemoryType __t, MemorySource __from, int __to)
					if (true)
						throw new todo.TODO();*/
					break;
				
					// Nop
				case InstructionIndex.NOP:
					cb.addNop();
					break;
					







|
|
<
|
<
<
<







142
143
144
145
146
147
148
149
150

151



152
153
154
155
156
157
158
						registers.virtualPush());
					break;
					
					// Load static field
				case InstructionIndex.GETSTATIC:
					FieldReference sfr = inst.<FieldReference>argument(0,
						FieldReference.class);
					MemoryType sfmt = ProcessorUtils.memoryTypeOf(sfr);
					cb.addLoad(sfmt, vtable.addFieldReference(true, sfr),

						registers.virtualPush(sfr.memberType().stackWidth()));



					break;
				
					// Nop
				case InstructionIndex.NOP:
					cb.addNop();
					break;
					

Added runt/libs/tool-classfile-scrf-compiler/net/multiphasicapps/scrf/compiler/ProcessorUtils.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
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// Multi-Phasic Applications: SquirrelJME
//     Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
//     Copyright (C) Multi-Phasic Applications <multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.scrf.compiler;

import net.multiphasicapps.classfile.FieldDescriptor;
import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.scrf.MemoryType;

/**
 * This contains utilities that can be used for processing.
 *
 * @since 2019/02/05
 */
public final class ProcessorUtils
{
	/**
	 * Not used.
	 *
	 * @since 2019/02/05
	 */
	private ProcessorUtils()
	{
	}
	
	/**
	 * Returns the memory type of the given field.
	 *
	 * @param __f The field to get the type of.
	 * @return The type of the field.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/02/05
	 */
	public static final MemoryType memoryTypeOf(FieldReference __f)
		throws NullPointerException
	{
		if (__f == null)
			throw new NullPointerException("NARG");
		
		return ProcessorUtils.memoryTypeOf(__f.memberType());
	}
	
	/**
	 * Returns the memory type of the given field.
	 *
	 * @param __f The field to get the type of.
	 * @return The type of the field.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/02/05
	 */
	public static final MemoryType memoryTypeOf(FieldDescriptor __f)
		throws NullPointerException
	{
		if (__f == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

Changes to runt/libs/tool-classfile-scrf-compiler/net/multiphasicapps/scrf/compiler/VTableBuilder.java.

7
8
9
10
11
12
13

14
15
16
17
18
19
20
..
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
..
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
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.scrf.compiler;

import net.multiphasicapps.classfile.FieldReference;

import java.util.LinkedHashMap;
import java.util.Map;

/**
 * This is the builder for vtables which are used to contain some run-time
 * determined information about a class, it effectively allows the VM to
 * access other classes and information without needing to build a combined
................................................................................
 */
public final class VTableBuilder
{
	/** String table. */
	protected final StringTableBuilder strings;
	
	/** The table of entries which may accordingly be mapped. */
	private final Map<Object, Integer> _table =
		new LinkedHashMap<>();
	
	/** The next ID to use for entries. */
	private int _nextid;
	
	/**
	 * Initializes the VTable builder.
................................................................................
	 * Adds a single entry to the vtable.
	 *
	 * @param __o The item to add.
	 * @return The position of the entry in the table.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/01/19
	 */
	public final int add(Object __o)
		throws NullPointerException
	{
		if (__o == null)
			throw new NullPointerException("NARG");
		
		// Prevent multiple threads from building the VTable
		Map<Object, Integer> table = this._table;
		synchronized (this)
		{
			// If there is already a slot for this entry then use that
			Integer vx = table.get(__o);
			if (vx != null)
				return vx;
			
			// The index to store this entry at
			int id = this._nextid++;
			table.put(__o, id);
			
			// Debug
			todo.DEBUG.note("@%d = %s", id, __o);
			
			// Return the ID of this new entry
			return id;
		}
	}
	
	/**
	 * Adds a field reference to the vtable.
	 *
	 * @param __static Is this field static?
	 * @param __f The field to add.
	 * @return The index of the added entry.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/02/03
	 */
	public final int addFieldReference(boolean __static, FieldReference __f)

		throws NullPointerException
	{
		if (__f == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}








>







 







|







 







|






|



|





|





|












|
>









7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
..
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
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package net.multiphasicapps.scrf.compiler;

import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.scrf.VTableIndex;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * This is the builder for vtables which are used to contain some run-time
 * determined information about a class, it effectively allows the VM to
 * access other classes and information without needing to build a combined
................................................................................
 */
public final class VTableBuilder
{
	/** String table. */
	protected final StringTableBuilder strings;
	
	/** The table of entries which may accordingly be mapped. */
	private final Map<Object, VTableIndex> _table =
		new LinkedHashMap<>();
	
	/** The next ID to use for entries. */
	private int _nextid;
	
	/**
	 * Initializes the VTable builder.
................................................................................
	 * Adds a single entry to the vtable.
	 *
	 * @param __o The item to add.
	 * @return The position of the entry in the table.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/01/19
	 */
	public final VTableIndex add(Object __o)
		throws NullPointerException
	{
		if (__o == null)
			throw new NullPointerException("NARG");
		
		// Prevent multiple threads from building the VTable
		Map<Object, VTableIndex> table = this._table;
		synchronized (this)
		{
			// If there is already a slot for this entry then use that
			VTableIndex vx = table.get(__o);
			if (vx != null)
				return vx;
			
			// The index to store this entry at
			int id = this._nextid++;
			table.put(__o, (vx = new VTableIndex(id)));
			
			// Debug
			todo.DEBUG.note("@%d = %s", id, __o);
			
			// Return the ID of this new entry
			return vx;
		}
	}
	
	/**
	 * Adds a field reference to the vtable.
	 *
	 * @param __static Is this field static?
	 * @param __f The field to add.
	 * @return The index of the added entry.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/02/03
	 */
	public final VTableIndex addFieldReference(boolean __static,
		FieldReference __f)
		throws NullPointerException
	{
		if (__f == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
	}
}

Changes to runt/libs/tool-classfile/net/multiphasicapps/classfile/FieldDescriptor.java.

253
254
255
256
257
258
259





















260
261
262
263
264
265
266
...
318
319
320
321
322
323
324











325
326
327
328
329
330
331
332
333
334
335
336
	 * @return If this is an object type.
	 * @since 2017/09/16
	 */
	public boolean isObject()
	{
		return !isPrimitive();
	}





















	
	/**
	 * Returns the primitive type for this field.
	 *
	 * @return The primitive type to use or {@code null} if there is none.
	 * @since 2017/10/16
	 */
................................................................................
				return SimpleStorageType.DOUBLE;
			
				// Should not occur
			default:
				throw new todo.OOPS();
		}
	}











	
	/**
	 * {@inheritDoc}
	 * @since 2017/06/12
	 */
	@Override
	public String toString()
	{
		return this.string;
	}
}








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







 







>
>
>
>
>
>
>
>
>
>
>












253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
...
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
	 * @return If this is an object type.
	 * @since 2017/09/16
	 */
	public boolean isObject()
	{
		return !isPrimitive();
	}
	
	/**
	 * Returns if this is a wide field or not.
	 *
	 * @return If this is a wide field.
	 * @since 2019/02/05
	 */
	public final boolean isWide()
	{
		if (this.isObject())
			return false;
		switch (this.primitiveType())
		{
			case LONG:
			case DOUBLE:
				return true;
			
			default:
				return false;
		}
	}
	
	/**
	 * Returns the primitive type for this field.
	 *
	 * @return The primitive type to use or {@code null} if there is none.
	 * @since 2017/10/16
	 */
................................................................................
				return SimpleStorageType.DOUBLE;
			
				// Should not occur
			default:
				throw new todo.OOPS();
		}
	}
	
	/**
	 * Returns the width of this field on the stack.
	 *
	 * @return The width of the field on the stack.
	 * @since 2019/02/05
	 */
	public final int stackWidth()
	{
		return (this.isWide() ? 2 : 1);
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2017/06/12
	 */
	@Override
	public String toString()
	{
		return this.string;
	}
}