Check-in [609678434f]

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

Overview
Comment:Initialize pool values.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 609678434f39a494a52747e0560f63d13dcd61b4
User & Date: stephanie.gawroriski 2019-09-11 14:30:36
Context
2019-09-11
14:36
Correct dual pool encoding and the wrong section offsets being used for normal entry writes. check-in: c6dca51a8d user: stephanie.gawroriski tags: trunk
14:30
Initialize pool values. check-in: 609678434f user: stephanie.gawroriski tags: trunk
14:23
Read of class names. check-in: 925f4d70f5 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/libs/tool-classfile/dev/shadowtail/classfile/mini/DualPoolEncoder.java.

134
135
136
137
138
139
140




141
142
143
144
145
146
147
				if (iswide)
					numparts = -numparts;
				
				// Resulting parts and value
				Object value;
				int[] parts = new int[numparts];
				




				// Depends on the type
				switch (etype)
				{
						// String
					case STRING:
						// Read hash code and length
						parts[0] = xd.readUnsignedShort();







>
>
>
>







134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
				if (iswide)
					numparts = -numparts;
				
				// Resulting parts and value
				Object value;
				int[] parts = new int[numparts];
				
				// Debug
				todo.DEBUG.note("Entry: ty=%s, np=%d, of=%d(%d), ln=%d",
					etype, numparts, eoff, baseoff + eoff, elen);
				
				// Depends on the type
				switch (etype)
				{
						// String
					case STRING:
						// Read hash code and length
						parts[0] = xd.readUnsignedShort();

Changes to runt/libs/tool-classfile/dev/shadowtail/classfile/pool/BasicPool.java.

6
7
8
9
10
11
12


13
14
15
16
17
18
19
..
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
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.pool;

import java.util.ArrayList;


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

/**
 * This represents a basic constant pool.
 *
................................................................................
	private final List<BasicPoolEntry> _linear;
	
	/**
	 * Input for the basic pool.
	 *
	 * @param __it The input entries.
	 * @throws NullPointerException On null arguments.














	 * @since 2019/09/07
	 */
	public BasicPool(Iterable<BasicPoolEntry> __it)
		throws NullPointerException
	{
		if (__it == null)
			throw new NullPointerException("NARG");
		
		throw new todo.TODO();
























	}
	
	/**
	 * Gets the pool entry by index.
	 *
	 * @param __i The index to get.
	 * @return The index of the given entry.
	 * @throws IndexOutOfBoundsException If the entry is not within bounds.
	 * @since 2019/09/11
	 */
	public final BasicPoolEntry byIndex(int __i)
		throws IndexOutOfBoundsException
	{
		throw new todo.TODO();













	}
}








>
>







 







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



|




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













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



6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
..
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
111
112
113
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------

package dev.shadowtail.classfile.pool;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;

/**
 * This represents a basic constant pool.
 *
................................................................................
	private final List<BasicPoolEntry> _linear;
	
	/**
	 * Input for the basic pool.
	 *
	 * @param __it The input entries.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/09/11
	 */
	public BasicPool(BasicPoolEntry... __it)
		throws NullPointerException
	{
		this(Arrays.<BasicPoolEntry>asList(__it));
	}
	
	/**
	 * Input for the basic pool.
	 *
	 * @param __it The input entries.
	 * @throws IllegalArgumentException If a pool entry was duplicated.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/09/07
	 */
	public BasicPool(Iterable<BasicPoolEntry> __it)
		throws IllegalArgumentException, NullPointerException
	{
		if (__it == null)
			throw new NullPointerException("NARG");
		
		// Initial guessed size?
		int igs = ((__it instanceof Collection) ?
			((Collection)__it).size() : 16);
			
		// Where the entries go
		List<BasicPoolEntry> linear = new ArrayList<>(igs);
		Map<Object, BasicPoolEntry> entries = new LinkedHashMap<>();
		
		// Process entries
		for (BasicPoolEntry e : __it)
		{
			if (e == null)
				throw new NullPointerException("NARG");
			
			// Just add to the end of the list
			linear.add(e);
			
			// {@squirreljme.error JC4k Duplicated pool entry. (The entry)}
			if (null != entries.put(e.value, e))
				throw new IllegalArgumentException("JC4k " + e);
		}
		
		// Set
		this._entries = entries;
		this._linear = linear;
	}
	
	/**
	 * Gets the pool entry by index.
	 *
	 * @param __i The index to get.
	 * @return The index of the given entry.
	 * @throws IndexOutOfBoundsException If the entry is not within bounds.
	 * @since 2019/09/11
	 */
	public final BasicPoolEntry byIndex(int __i)
		throws IndexOutOfBoundsException
	{
		return this._linear.get(__i);
	}
	
	/**
	 * Gets the pool entry by value.
	 *
	 * @param __v The value to get.
	 * @return The entry or {@code null} if it was not found.
	 * @since 2019/09/11
	 */
	public final BasicPoolEntry byValue(Object __v)
		throws IndexOutOfBoundsException
	{
		return this._entries.get(__v);
	}
}