Check-in [915ab69ac6]

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

Overview
Comment:Add check for the current thread in another method and call that to make sure calls are not done out of thread.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:915ab69ac6129378885624046f0241692e499640
User & Date: stephanie.gawroriski 2019-01-11 02:29:02
Context
2019-01-11
02:44
Add means to protect runMethod() from being called across threads. check-in: 679430edaf user: stephanie.gawroriski tags: trunk
02:29
Add check for the current thread in another method and call that to make sure calls are not done out of thread. check-in: 915ab69ac6 user: stephanie.gawroriski tags: trunk
02:21
Add MethodHandle which is a better and much simpler means to refering to methods for entry and it can have multiple lookup types as well. check-in: 102720fa69 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to runt/libs/summercoat-vm/cc/squirreljme/vm/summercoat/RunningThread.java.

64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
...
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
...
146
147
148
149
150
151
152



153
154
155
156
157
158
159
...
185
186
187
188
189
190
191



192
193
194
195
196
197
198
...
202
203
204
205
206
207
208



209
210
211
212
213
214
215
216
217
218
219
220



221
222
223




224














	 * is not the current thread.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/01/10
	 */
	public void execEnterMethod(MethodHandle __mh, Value... __args)
		throws IllegalStateException, NullPointerException
	{
		// {@squirreljme.error AE02 This thread has already been started and
		// as such this method may only be called from within that thread.}
		if (this._didstart && this != Thread.currentThread())
			throw new IllegalStateException("AE02");
		
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/01/05
................................................................................
	 */
	public Value runMethod(MethodHandle __mh, Value... __args)
		throws IllegalStateException, NullPointerException
	{
		if (__mh == null)
			throw new NullPointerException("NARG");
		
		// {@squirreljme.error AE01 This thread has already been started and
		// as such this method may only be called from within that thread.}
		if (this._didstart && this != Thread.currentThread())
			throw new IllegalStateException("AE01");
		
		throw new todo.TODO();
	}
	
	/**
	 * Creates a new array instance.
	 *
................................................................................
	 * @since 2019/01/10
	 */
	public final ArrayInstance vmNewArray(LoadedClass __cl, int __len)
		throws NullPointerException
	{
		if (__cl == null)
			throw new NullPointerException("NARG");



		
		throw new todo.TODO();
	}
	
	/**
	 * Creates a new instance of the given class.
	 *
................................................................................
	public final Instance vmNewInstance(LoadedClass __cl,
		MethodDescriptor __desc, Value... __args)
		throws NullPointerException
	{
		if (__cl == null || __desc == null)
			throw new NullPointerException("NARG");
		



		// Defensive copy
		__args = (__args == null ? new Value[0] : __args.clone());
		
		throw new todo.TODO();
	}
	
	/**
................................................................................
	 * @return The virtual static method.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/01/10
	 */
	public final Instance vmStaticMethod(MethodHandle __mh)
		throws NullPointerException
	{



		throw new todo.TODO();
	}
	
	/**
	 * Translates the specified string to an in VM string.
	 *
	 * @param __in The input string.
	 * @return The instance of the string or the associated {@code null}.
	 * @since 2019/01/10
	 */
	public final Instance vmTranslateString(String __in)
	{



		throw new todo.TODO();
	}
}


























|
|
<
<







 







|
|
<
<







 







>
>
>







 







>
>
>







 







>
>
>












>
>
>


|
>
>
>
>
|
>
>
>
>
>
>
>
>
>
>
>
>
>
>
64
65
66
67
68
69
70
71
72


73
74
75
76
77
78
79
...
105
106
107
108
109
110
111
112
113


114
115
116
117
118
119
120
...
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
...
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
...
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
	 * is not the current thread.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/01/10
	 */
	public void execEnterMethod(MethodHandle __mh, Value... __args)
		throws IllegalStateException, NullPointerException
	{
		// Must be the same thread
		__checkSameThread();


		
		throw new todo.TODO();
	}
	
	/**
	 * {@inheritDoc}
	 * @since 2019/01/05
................................................................................
	 */
	public Value runMethod(MethodHandle __mh, Value... __args)
		throws IllegalStateException, NullPointerException
	{
		if (__mh == null)
			throw new NullPointerException("NARG");
		
		// Must be the same thread
		__checkSameThread();


		
		throw new todo.TODO();
	}
	
	/**
	 * Creates a new array instance.
	 *
................................................................................
	 * @since 2019/01/10
	 */
	public final ArrayInstance vmNewArray(LoadedClass __cl, int __len)
		throws NullPointerException
	{
		if (__cl == null)
			throw new NullPointerException("NARG");
		
		// Must be the same thread
		__checkSameThread();
		
		throw new todo.TODO();
	}
	
	/**
	 * Creates a new instance of the given class.
	 *
................................................................................
	public final Instance vmNewInstance(LoadedClass __cl,
		MethodDescriptor __desc, Value... __args)
		throws NullPointerException
	{
		if (__cl == null || __desc == null)
			throw new NullPointerException("NARG");
		
		// Must be the same thread
		__checkSameThread();
		
		// Defensive copy
		__args = (__args == null ? new Value[0] : __args.clone());
		
		throw new todo.TODO();
	}
	
	/**
................................................................................
	 * @return The virtual static method.
	 * @throws NullPointerException On null arguments.
	 * @since 2019/01/10
	 */
	public final Instance vmStaticMethod(MethodHandle __mh)
		throws NullPointerException
	{
		// Must be the same thread
		__checkSameThread();
		
		throw new todo.TODO();
	}
	
	/**
	 * Translates the specified string to an in VM string.
	 *
	 * @param __in The input string.
	 * @return The instance of the string or the associated {@code null}.
	 * @since 2019/01/10
	 */
	public final Instance vmTranslateString(String __in)
	{
		// Must be the same thread
		__checkSameThread();
		
		throw new todo.TODO();
	}
	
	/**
	 * Checks that the call was done in the same thread, since when the thread
	 * is running it will completely break if another thread decides it wants
	 * to do things in this thread.
	 *
	 * @throws IllegalStateException If the thread was started and the check
	 * was performed in a different thread.
	 * @since 2019/01/10
	 */
	private final void __checkSameThread()
		throws IllegalStateException
	{
		// {@squirreljme.error AE01 This thread has already been started and
		// as such this method may only be called from within that thread.}
		if (this._didstart && this != Thread.currentThread())
			throw new IllegalStateException("AE01");
	}
}