Check-in [10a700c260]

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

Overview
Comment:Base for process.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:10a700c2601afbc1b8f21a0508e66a6360632391
User & Date: stephanie.gawroriski 2019-02-03 17:48:46
Context
2019-02-05
20:06
Some reworking of register things to make it easier to do things. check-in: ba413d128b user: stephanie.gawroriski tags: trunk
2019-02-03
17:48
Base for process. check-in: 10a700c260 user: stephanie.gawroriski tags: trunk
08:02
Backup developer notes. check-in: 3ce32d1a0a user: squirreljme tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Added runt/libs/tool-classfile-scrf-compiler/net/multiphasicapps/scrf/compiler/MemoryType.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
// -*- 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;

/**
 * This represents the type of memory something uses.
 *
 * @since 2019/02/03
 */
public enum MemoryType
{
	/** Integer. */
	INTEGER,
	
	/** Long. */
	LONG,
	
	/** Pointer. */
	POINTER,
	
	/** End. */
	;
	
	/**
	 * Returns the memory type of the given field.
	 *
	 * @param __f The input field.
	 * @return The memory type used.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/02/03
	 */
	public static MemoryType of(FieldReference __f)
		throws NullPointerException
	{
		if (__f == null)
			throw new NullPointerException("NARG");
		
		return MemoryType.of(__f.memberType());
	}
	
	/**
	 * Returns the memory type of the given field.
	 *
	 * @param __f The input field.
	 * @return The memory type used.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/02/03
	 */
	public static MemoryType of(FieldDescriptor __f)
		throws NullPointerException
	{
		if (__f == null)
			throw new NullPointerException("NARG");
		
		// If an object, treat as pointer
		if (__f.isObject())
			return POINTER;
		
		throw new todo.TODO();
	}
}

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

7
8
9
10
11
12
13

14
15
16
17
18
19
20
..
33
34
35
36
37
38
39



40
41
42
43
44
45
46
..
67
68
69
70
71
72
73



74
75
76
77
78
79
80
...
128
129
130
131
132
133
134






135






136
137
138
139
140
141
142
// 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.ByteCode;

import net.multiphasicapps.classfile.Instruction;
import net.multiphasicapps.classfile.InstructionIndex;
import net.multiphasicapps.classfile.JavaType;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.StackMapTable;
import net.multiphasicapps.classfile.StackMapTableState;
import net.multiphasicapps.scrf.RegisterCode;
................................................................................
	protected final RegisterSet registers;
	
	/** The types and state of the stack will be initialized with this. */
	protected final StackMapTable smt;
	
	/** Explicit monitor register. */
	protected final WorkRegister rmonitor;



	
	/** Builder for register codes. */
	protected final RegisterCodeBuilder codebuilder;
	
	/**
	 * Initializes the primitive processor.
	 *
................................................................................
		
		// Cache the stack map table, it will be used much to initialize in
		// areas which registers are what
		this.smt = __bc.stackMapTable();
		
		// Initialize the code builder
		this.codebuilder = new RegisterCodeBuilder(__mp.vtable);



	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/01/21
	 */
	@Override
................................................................................
				case InstructionIndex.ALOAD_3:
					cb.addCopyPointer(vop - InstructionIndex.ALOAD_0,
						registers.virtualPush());
					break;
					
					// Load static field
				case InstructionIndex.GETSTATIC:






					throw new todo.TODO();






				
					// Nop
				case InstructionIndex.NOP:
					cb.addNop();
					break;
					
					// Load from indexed local







>







 







>
>
>







 







>
>
>







 







>
>
>
>
>
>
|
>
>
>
>
>
>







7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
..
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
...
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
// 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.ByteCode;
import net.multiphasicapps.classfile.FieldReference;
import net.multiphasicapps.classfile.Instruction;
import net.multiphasicapps.classfile.InstructionIndex;
import net.multiphasicapps.classfile.JavaType;
import net.multiphasicapps.classfile.MethodDescriptor;
import net.multiphasicapps.classfile.StackMapTable;
import net.multiphasicapps.classfile.StackMapTableState;
import net.multiphasicapps.scrf.RegisterCode;
................................................................................
	protected final RegisterSet registers;
	
	/** The types and state of the stack will be initialized with this. */
	protected final StackMapTable smt;
	
	/** Explicit monitor register. */
	protected final WorkRegister rmonitor;
	
	/** The VTable of imports and exports. */
	protected final VTableBuilder vtable;
	
	/** Builder for register codes. */
	protected final RegisterCodeBuilder codebuilder;
	
	/**
	 * Initializes the primitive processor.
	 *
................................................................................
		
		// Cache the stack map table, it will be used much to initialize in
		// areas which registers are what
		this.smt = __bc.stackMapTable();
		
		// Initialize the code builder
		this.codebuilder = new RegisterCodeBuilder(__mp.vtable);
		
		// We need the vtable to refer to things
		this.vtable = __mp.vtable;
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/01/21
	 */
	@Override
................................................................................
				case InstructionIndex.ALOAD_3:
					cb.addCopyPointer(vop - InstructionIndex.ALOAD_0,
						registers.virtualPush());
					break;
					
					// Load static field
				case InstructionIndex.GETSTATIC:
					FieldReference sfr = inst.<FieldReference>argument(0,
						FieldReference.class);
					switch (MemoryType.of(sfr))
					{
						case POINTER:
							if (true)
								throw new todo.TODO();
							break;
						
						default:
							throw new todo.TODO(sfr.toString());
					}
					break;
				
					// Nop
				case InstructionIndex.NOP:
					cb.addNop();
					break;
					
					// Load from indexed local

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

6
7
8
9
10
11
12

13
14
15
16
17
18
19
..
79
80
81
82
83
84
85
86


87
















// ---------------------------------------------------------------------------
// 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 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
................................................................................
			// Debug
			todo.DEBUG.note("@%d = %s", id, __o);
			
			// Return the ID of this new entry
			return id;
		}
	}
}


























>







 







|
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
>
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
..
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
................................................................................
			// 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();
	}
}