Check-in [79482f1be1]

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

Overview
Comment:Remove TimeAccess and replace with system calls.
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA1:79482f1be1bc7b5fb44dcaa1d6ebd0b9b77b1837
User & Date: stephanie.gawroriski 2019-05-23 16:48:46
Context
2019-05-23
17:13
Remove TimeAccess implementation in SpringCoat. check-in: 07a440d973 user: stephanie.gawroriski tags: trunk
16:48
Remove TimeAccess and replace with system calls. check-in: 79482f1be1 user: stephanie.gawroriski tags: trunk
16:41
Add API levels to system calls. check-in: 21e5cd0712 user: stephanie.gawroriski tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Deleted bldt/javase/libs/javase-runtime/cc/squirreljme/runtime/cldc/asm/TimeAccess.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
// -*- 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 cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * Used to provide access to the time.
 *
 * @since 2018/10/14
 */
public final class TimeAccess
{
	/**
	 * Not used.
	 *
	 * @since 2018/10/14
	 */
	private TimeAccess()
	{
	}
	
	/**
	 * Returns the current time in milliseconds UTC since the epoch.
	 *
	 * @return The since since the epoch in UTC milliseconds.
	 * @since 2018/03/01
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final long currentTimeMillis()
	{
		return System.currentTimeMillis();
	}
	
	/**
	 * Returns the current monotonic clock time.
	 *
	 * @return The current monotonic clock time.
	 * @since 2018/03/01
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final long nanoTime()
	{
		return System.nanoTime();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
















































































































Deleted runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/asm/TimeAccess.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
// -*- 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 cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * Used to provide access to the time.
 *
 * @since 2018/10/14
 */
public final class TimeAccess
{
	/**
	 * Not used.
	 *
	 * @since 2018/10/14
	 */
	private TimeAccess()
	{
	}
	
	/**
	 * Returns the current time in milliseconds UTC since the epoch.
	 *
	 * @return The since since the epoch in UTC milliseconds.
	 * @since 2018/03/01
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native long currentTimeMillis();
	
	/**
	 * Returns the current monotonic clock time.
	 *
	 * @return The current monotonic clock time.
	 * @since 2018/03/01
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final native long nanoTime();
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<




































































































Changes to runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/vki/SystemCallError.java.

10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26


27







package cc.squirreljme.runtime.cldc.vki;

/**
 * This interface contains the various error codes for all of the system calls.
 *
 * @since 2019/05/23
 */
public interface SystemCallError
{
	/** No error, or success. */
	public static final short NO_ERROR =
		0;
	
	/** The system call is not supported. */
	public static final short UNSUPPORTED_SYSTEM_CALL =
		-1;
}

















|








|
>
>
|
>
>
>
>
>
>
>
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
package cc.squirreljme.runtime.cldc.vki;

/**
 * This interface contains the various error codes for all of the system calls.
 *
 * @since 2019/05/23
 */
public final class SystemCallError
{
	/** No error, or success. */
	public static final short NO_ERROR =
		0;
	
	/** The system call is not supported. */
	public static final short UNSUPPORTED_SYSTEM_CALL =
		-1;
	
	/**
	 * Not used.
	 *
	 * @since 2019/05/23
	 */
	private SystemCallError()
	{
	}
}

Changes to runt/apis/cldc-compact/cc/squirreljme/runtime/cldc/vki/SystemCallIndex.java.

13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
53
54
55
56
57
58
59
60


61







import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * This contains the index of system calls.
 *
 * @since 2019/05/23
 */
public interface SystemCallIndex
{
	/** Checks if the system call is supported. */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_3_0_DEV)
	public static final short QUERY_INDEX =
		0;
	
	/** Gets the last error state. */
................................................................................
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_3_0_DEV)
	public static final short TIME_HI_NANO_MONO =
		6;
	
	/** System call count. */
	public static final int NUM_SYSCALLS =
		7;
}

















|







 







|
>
>
|
>
>
>
>
>
>
>
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
..
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * This contains the index of system calls.
 *
 * @since 2019/05/23
 */
public final class SystemCallIndex
{
	/** Checks if the system call is supported. */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_3_0_DEV)
	public static final short QUERY_INDEX =
		0;
	
	/** Gets the last error state. */
................................................................................
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_3_0_DEV)
	public static final short TIME_HI_NANO_MONO =
		6;
	
	/** System call count. */
	public static final int NUM_SYSCALLS =
		7;
	
	/**
	 * Not used.
	 *
	 * @since 2019/05/23
	 */
	private SystemCallIndex()
	{
	}
}

Changes to runt/apis/cldc-compact/java/lang/System.java.

10
11
12
13
14
15
16

17
18
19

20
21
22
23
24
25
26
...
152
153
154
155
156
157
158
159



160
161
162
163
164
165
166
...
435
436
437
438
439
440
441
442




443
444
445
446
447
448
449

package java.lang;

import cc.squirreljme.runtime.cldc.asm.ConsoleOutput;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import cc.squirreljme.runtime.cldc.asm.SystemAccess;
import cc.squirreljme.runtime.cldc.asm.SystemProperties;

import cc.squirreljme.runtime.cldc.asm.TimeAccess;
import cc.squirreljme.runtime.cldc.io.ConsoleOutputStream;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

import java.io.OutputStream;
import java.io.PrintStream;
import java.security.Permission;

/**
 * This class contains methods which are used to interact with the system and
 * the environment.
................................................................................
	 *
	 * @return The number of milliseconds since the epoch.
	 * @since 2017/11/10
	 */
	public static long currentTimeMillis()
	{
		// Returns the current time in UTC, not local time zone.
		return TimeAccess.currentTimeMillis();



	}
	
	/**
	 * Indicates that the application exits with the given code.
	 *
	 * @param __e The exit code, the value of this code may change according
	 * to the host operating system and the resulting process might not exit
................................................................................
	 * 584 years).
	 *
	 * @return The number of nanoseconds which have passed.
	 * @since 2016/06/16
	 */
	public static long nanoTime()
	{
		return TimeAccess.nanoTime();




	}
	
	/**
	 * Sets the new destination for standard error.
	 *
	 * Note that the {@link System#err} field is not changed, a wrapper class
	 * is used to prevent reflective abuse.







>
|
|
|
>







 







|
>
>
>







 







|
>
>
>
>







10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
...
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
...
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458

package java.lang;

import cc.squirreljme.runtime.cldc.asm.ConsoleOutput;
import cc.squirreljme.runtime.cldc.asm.ObjectAccess;
import cc.squirreljme.runtime.cldc.asm.SystemAccess;
import cc.squirreljme.runtime.cldc.asm.SystemProperties;
import cc.squirreljme.runtime.cldc.io.ConsoleOutputStream;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;
import cc.squirreljme.runtime.cldc.vki.Assembly;
import cc.squirreljme.runtime.cldc.vki.SystemCallError;
import cc.squirreljme.runtime.cldc.vki.SystemCallIndex;
import java.io.OutputStream;
import java.io.PrintStream;
import java.security.Permission;

/**
 * This class contains methods which are used to interact with the system and
 * the environment.
................................................................................
	 *
	 * @return The number of milliseconds since the epoch.
	 * @since 2017/11/10
	 */
	public static long currentTimeMillis()
	{
		// Returns the current time in UTC, not local time zone.
		return ((Assembly.sysCallV(
				SystemCallIndex.TIME_LO_MILLI_WALL) & 0xFFFFFFFFL) |
			(((long)Assembly.sysCallV(
				SystemCallIndex.TIME_HI_MILLI_WALL)) << 32L));
	}
	
	/**
	 * Indicates that the application exits with the given code.
	 *
	 * @param __e The exit code, the value of this code may change according
	 * to the host operating system and the resulting process might not exit
................................................................................
	 * 584 years).
	 *
	 * @return The number of nanoseconds which have passed.
	 * @since 2016/06/16
	 */
	public static long nanoTime()
	{
		// Returns the current monotonic clock time
		return ((Assembly.sysCallV(
				SystemCallIndex.TIME_LO_NANO_MONO) & 0xFFFFFFFFL) |
			(((long)Assembly.sysCallV(
				SystemCallIndex.TIME_HI_NANO_MONO)) << 32L));
	}
	
	/**
	 * Sets the new destination for standard error.
	 *
	 * Note that the {@link System#err} field is not changed, a wrapper class
	 * is used to prevent reflective abuse.

Deleted runt/libs/common-vm-stubs/cc/squirreljme/runtime/cldc/asm/TimeAccess.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
// -*- 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 cc.squirreljme.runtime.cldc.asm;

import cc.squirreljme.runtime.cldc.annotation.Api;
import cc.squirreljme.runtime.cldc.lang.ApiLevel;

/**
 * Used to provide access to the time.
 *
 * @since 2018/10/14
 */
public final class TimeAccess
{
	/**
	 * Not used.
	 *
	 * @since 2018/10/14
	 */
	private TimeAccess()
	{
	}
	
	/**
	 * Returns the current time in milliseconds UTC since the epoch.
	 *
	 * @return The since since the epoch in UTC milliseconds.
	 * @since 2018/03/01
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final long currentTimeMillis()
	{
		return System.currentTimeMillis();
	}
	
	/**
	 * Returns the current monotonic clock time.
	 *
	 * @return The current monotonic clock time.
	 * @since 2018/03/01
	 */
	@Api(ApiLevel.LEVEL_SQUIRRELJME_0_2_0_20181225)
	public static final long nanoTime()
	{
		return System.nanoTime();
	}
}

<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<
<