Check-in [9d0c6d9c70]

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

Overview
Comment:Reduce the number of pool items that are used by removing names and handles.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1: 9d0c6d9c70539b80bac4b8f97b73fa979ba8a0c4
User & Date: stephanie.gawroriski 2019-04-17 01:14:27
Context
2019-04-17
01:20
FieldDescriptor becomes ClassName since they are similar. check-in: df13b978a5 user: stephanie.gawroriski tags: trunk
01:14
Reduce the number of pool items that are used by removing names and handles. check-in: 9d0c6d9c70 user: stephanie.gawroriski tags: trunk
01:00
Correct compile error. check-in: 8940f06d87 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

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

72
73
74
75
76
77
78

79
80

81


82
83
84
85
86
87
88
...
113
114
115
116
117
118
119

120
121
122



123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
...
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// Field access
		if (__v instanceof AccessedField)
		{
			AccessedField af = (AccessedField)__v;

			return this.__add(__v,
				af.time().ordinal(), af.type().ordinal(),

				this.add(af.field()));


		}
		
		// Class name
		else if (__v instanceof ClassName)
		{
			// Write representation of array type and its component type to
			// make sure they are always added
................................................................................
			return this.__add(names, indexes);
		}
		
		// Record handle for the method
		else if (__v instanceof InvokedMethod)
		{
			InvokedMethod iv = (InvokedMethod)__v;

			
			return this.__add(__v,
				iv.type().ordinal(), this.add(iv.handle()));



		}
		
		// Field descriptor
		else if (__v instanceof FieldDescriptor)
			return this.__add(__v,
				this.add(__v.toString()), this.add(
					((FieldDescriptor)__v).className()));
		
		// Field/Method name
		else if (__v instanceof FieldName ||
			__v instanceof MethodName)
			return this.__add(__v,
				this.add(__v.toString()));
		
		// Field reference
		else if (__v instanceof FieldReference)
		{
			FieldReference v = (FieldReference)__v;
			return this.__add(__v,
				this.add(v.className()),
				this.add(v.memberName()),
				this.add(v.memberType()));
		}
		
		// Method descriptor, add parts of the descriptor naturally
		else if (__v instanceof MethodDescriptor)
		{
			MethodDescriptor md = (MethodDescriptor)__v;
			
			// Setup with initial string
................................................................................
			
			// Put in descriptor with all the pieces
			return this.__add(__v,
				isubs);
		}
		
		// Method handle
		else if (__v instanceof MethodHandle)
		{
			MethodHandle v = (MethodHandle)__v;
			return this.__add(__v,
				this.add(v.outerClass()),
				this.add(v.name()),
				this.add(v.descriptor()));
		}
		
		// String
		else if (__v instanceof String)
			return this.__add(__v,
				__v.hashCode(),
				((String)__v).length());
		







>

|
>
|
>
>







 







>


|
>
>
>









|


|


|






|







 







|






|







72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
...
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
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
...
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
		if (__v == null)
			throw new NullPointerException("NARG");
		
		// Field access
		if (__v instanceof AccessedField)
		{
			AccessedField af = (AccessedField)__v;
			FieldReference fr = af.field();
			return this.__add(__v,
				af.time().ordinal(),
				af.type().ordinal(),
				this.add(fr.className()),
				this.add(fr.memberName().toString()),
				this.add(fr.memberType()));
		}
		
		// Class name
		else if (__v instanceof ClassName)
		{
			// Write representation of array type and its component type to
			// make sure they are always added
................................................................................
			return this.__add(names, indexes);
		}
		
		// Record handle for the method
		else if (__v instanceof InvokedMethod)
		{
			InvokedMethod iv = (InvokedMethod)__v;
			MethodHandle mh = iv.handle();
			
			return this.__add(__v,
				iv.type().ordinal(),
				this.add(mh.outerClass()),
				this.add(mh.name().toString()),
				this.add(mh.descriptor()));
		}
		
		// Field descriptor
		else if (__v instanceof FieldDescriptor)
			return this.__add(__v,
				this.add(__v.toString()), this.add(
					((FieldDescriptor)__v).className()));
		
		// Field/Method name
		/*else if (__v instanceof FieldName ||
			__v instanceof MethodName)
			return this.__add(__v,
				this.add(__v.toString()));*/
		
		// Field reference
		/*else if (__v instanceof FieldReference)
		{
			FieldReference v = (FieldReference)__v;
			return this.__add(__v,
				this.add(v.className()),
				this.add(v.memberName()),
				this.add(v.memberType()));
		}*/
		
		// Method descriptor, add parts of the descriptor naturally
		else if (__v instanceof MethodDescriptor)
		{
			MethodDescriptor md = (MethodDescriptor)__v;
			
			// Setup with initial string
................................................................................
			
			// Put in descriptor with all the pieces
			return this.__add(__v,
				isubs);
		}
		
		// Method handle
		/*else if (__v instanceof MethodHandle)
		{
			MethodHandle v = (MethodHandle)__v;
			return this.__add(__v,
				this.add(v.outerClass()),
				this.add(v.name()),
				this.add(v.descriptor()));
		}*/
		
		// String
		else if (__v instanceof String)
			return this.__add(__v,
				__v.hashCode(),
				((String)__v).length());
		

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

267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
...
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
			
			// Build field information
			MinimizedField q;
			temp._fields.add((q = new MinimizedField(
				f.flags().toJavaBits(),
				basep,
				fsz,
				pool.<FieldName>addSelf(f.name()),
				pool.<FieldDescriptor>addSelf(f.type()),
				(cval == null ? null :
					pool.<Object>addSelf(cval.boxedValue())))));
			
			// Debug
			todo.DEBUG.note("Add field %s", q);
			
................................................................................
				}
			}
			
			// Add method
			MinimizedMethod q;
			temp._methods.add((q = new MinimizedMethod(mf.toJavaBits(),
				temp._count,
				pool.<MethodName>addSelf(m.name()),
				pool.<MethodDescriptor>addSelf(m.type()),
				transcode,
				lnt)));
			
			// Debug
			todo.DEBUG.note("Add method %s", q);
			







|







 







|







267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
...
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
			
			// Build field information
			MinimizedField q;
			temp._fields.add((q = new MinimizedField(
				f.flags().toJavaBits(),
				basep,
				fsz,
				new FieldName(pool.<String>addSelf(f.name().toString())),
				pool.<FieldDescriptor>addSelf(f.type()),
				(cval == null ? null :
					pool.<Object>addSelf(cval.boxedValue())))));
			
			// Debug
			todo.DEBUG.note("Add field %s", q);
			
................................................................................
				}
			}
			
			// Add method
			MinimizedMethod q;
			temp._methods.add((q = new MinimizedMethod(mf.toJavaBits(),
				temp._count,
				new MethodName(pool.<String>addSelf(m.name().toString())),
				pool.<MethodDescriptor>addSelf(m.type()),
				transcode,
				lnt)));
			
			// Debug
			todo.DEBUG.note("Add method %s", q);
			

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

61
62
63
64
65
66
67
68

69
70
71
72
73
74
75
			// Write field information
			for (MinimizedField m : this._fields)
			{
				// 16-bytes
				ddos.writeInt(m.flags);
				ddos.writeShort(Minimizer.__checkUShort(m.offset));
				ddos.writeShort(Minimizer.__checkUShort(m.size));
				ddos.writeShort(Minimizer.__checkUShort(__pool.get(m.name)));

				ddos.writeShort(Minimizer.__checkUShort(__pool.get(m.type)));
				ddos.writeShort(Minimizer.__checkUShort(__pool.get(m.value)));
				ddos.writeByte(m.datatype.ordinal());
				ddos.writeByte(0);
			}
			
			// Write end of table







|
>







61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
			// Write field information
			for (MinimizedField m : this._fields)
			{
				// 16-bytes
				ddos.writeInt(m.flags);
				ddos.writeShort(Minimizer.__checkUShort(m.offset));
				ddos.writeShort(Minimizer.__checkUShort(m.size));
				ddos.writeShort(Minimizer.__checkUShort(
					__pool.get(m.name.toString())));
				ddos.writeShort(Minimizer.__checkUShort(__pool.get(m.type)));
				ddos.writeShort(Minimizer.__checkUShort(__pool.get(m.value)));
				ddos.writeByte(m.datatype.ordinal());
				ddos.writeByte(0);
			}
			
			// Write end of table

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

113
114
115
116
117
118
119
120

121
122
123
124
125
126
127
			for (int i = 0; i < count; i++)
			{
				MinimizedMethod m = methods.get(i);
				
				// 16-bytes
				ddos.writeInt(m.flags);
				ddos.writeShort(Minimizer.__checkUShort(m.index));
				ddos.writeShort(Minimizer.__checkUShort(__pool.get(m.name)));

				ddos.writeShort(Minimizer.__checkUShort(__pool.get(m.type)));
				ddos.writeShort(Minimizer.__checkUShort(codeoff + offcode[i]));
				ddos.writeShort(Minimizer.__checkUShort(lineoff + offline[i]));
				ddos.writeByte(0);
				ddos.writeByte(0);
			}
			







|
>







113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
			for (int i = 0; i < count; i++)
			{
				MinimizedMethod m = methods.get(i);
				
				// 16-bytes
				ddos.writeInt(m.flags);
				ddos.writeShort(Minimizer.__checkUShort(m.index));
				ddos.writeShort(Minimizer.__checkUShort(
					__pool.get(m.name.toString())));
				ddos.writeShort(Minimizer.__checkUShort(__pool.get(m.type)));
				ddos.writeShort(Minimizer.__checkUShort(codeoff + offcode[i]));
				ddos.writeShort(Minimizer.__checkUShort(lineoff + offline[i]));
				ddos.writeByte(0);
				ddos.writeByte(0);
			}