Commit 27be465d authored by Stephanie Gawroriski's avatar Stephanie Gawroriski
Browse files

Remove the old IPC stuff, it is not used in any way.

parent 61e6dfc0
Pipeline #90982 passed with stages
in 5 minutes and 59 seconds
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.jvm;
/**
* This is a router which just forward IPC requests to the standard manager.
*
* @since 2019/12/28
*/
@Deprecated
public final class DefaultIPCRouter
implements IPCCallback
{
/**
* {@inheritDoc}
* @since 2019/12/28
*/
@Override
@Deprecated
public final long ipcCall(int __tid, int __ipcid, int __a, int __b,
int __c, int __d, int __e, int __f, int __g, int __h)
{
return IPCManager.ipcCall(__tid, __ipcid, __a, __b, __c, __d, __e,
__f, __g, __h);
}
}
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.jvm;
/**
* Anything which would like to listen for IPCs must implement and register
* this callback.
*
* @since 2019/12/28
*/
@Deprecated
public interface IPCCallback
{
/**
* Any classes which
*
* @param __tid The origin task ID.
* @param __ipcid The ID number of the IPC interface.
* @param __a Argument A.
* @param __b Argument B.
* @param __c Argument C.
* @param __d Argument D.
* @param __e Argument E.
* @param __f Argument F.
* @param __g Argument G.
* @param __h Argument H.
* @return The result of the IPC call.
* @since 2019/12/28
*/
@Deprecated
long ipcCall(int __tid, int __ipcid, int __a, int __b, int __c, int __d,
int __e, int __f, int __g, int __h);
}
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.jvm;
/**
* This is an exception which was thrown in a cross RPC call.
*
* @since 2019/12/28
*/
public class IPCException
extends RuntimeException
{
/** The class name note pointer. */
protected final int classnotepointer;
/**
* Initializes the exception with an unknown type.
*
* @since 2019/12/28
*/
public IPCException()
{
this.classnotepointer = 0;
}
/**
* Initializes the IPC Exception.
*
* @param __cnp The class note pointer which was used.
* @since 2019/12/28
*/
public IPCException(int __cnp)
{
this.classnotepointer = __cnp;
}
}
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.jvm;
import java.util.HashMap;
import java.util.Map;
/**
* This class is used to manage the IPC interface and allow any service to
* register IPC messages and such.
*
* @since 2019/12/28
*/
@Deprecated
public final class IPCManager
{
/** Services that are available. */
@Deprecated
private static final Map<Integer, IPCCallback> _IPC_MAP =
new HashMap<>();
/**
* No instances of this class.
*
* @since 2019/12/28
*/
@Deprecated
private IPCManager()
{
}
/**
* This is the handler for IPC messages.
*
* @param __tid The origin task ID.
* @param __ipcid The ID number of the IPC interface.
* @param __a Argument A.
* @param __b Argument B.
* @param __c Argument C.
* @param __d Argument D.
* @param __e Argument E.
* @param __f Argument F.
* @param __g Argument G.
* @param __h Argument H.
* @return The result of the IPC call.
* @since 2019/12/28
*/
@Deprecated
public static final long ipcCall(int __tid, int __ipcid, int __a, int __b,
int __c, int __d, int __e, int __f, int __g, int __h)
{
IPCCallback handler = null;
// Find the IPC Callback handler
Map<Integer, IPCCallback> ipcmap = IPCManager._IPC_MAP;
synchronized (ipcmap)
{
handler = ipcmap.get(__ipcid);
}
// Drop the call if there is no handler
if (handler == null)
return 0;
// Perform the call
return handler.ipcCall(__tid, __ipcid, __a, __b, __c, __d, __e, __f,
__g, __h);
}
/**
* This is the handler for IPC messages, which performs unfolding
* accordingly.
*
* @param __tid The origin task ID.
* @param __v Input values.
* @return The result of the IPC call.
* @throws NullPointerException On null arguments.
* @since 2019/12/28
*/
@Deprecated
public static final long ipcCall(int __tid, int... __v)
throws NullPointerException
{
if (__v == null)
throw new NullPointerException("NARG");
int n = __v.length;
return IPCManager.ipcCall(__tid,
(0 < n ? __v[0] : 0),
(1 < n ? __v[1] : 0),
(2 < n ? __v[2] : 0),
(3 < n ? __v[3] : 0),
(4 < n ? __v[4] : 0),
(5 < n ? __v[5] : 0),
(6 < n ? __v[6] : 0),
(7 < n ? __v[7] : 0),
(8 < n ? __v[8] : 0));
}
/**
* This is the handler for IPC messages, which performs unfolding
* accordingly.
*
* @param __tid The origin task ID.
* @param __ipcid The ID number of the IPC interface.
* @param __v Input values.
* @return The result of the IPC call.
* @throws NullPointerException On null arguments.
* @since 2019/12/28
*/
@Deprecated
public static final long ipcCall(int __tid, int __ipcid, int... __v)
throws NullPointerException
{
if (__v == null)
throw new NullPointerException("NARG");
int n = __v.length;
return IPCManager.ipcCall(__tid,
__ipcid,
(0 < n ? __v[0] : 0),
(1 < n ? __v[1] : 0),
(2 < n ? __v[2] : 0),
(3 < n ? __v[3] : 0),
(4 < n ? __v[4] : 0),
(5 < n ? __v[5] : 0),
(6 < n ? __v[6] : 0),
(7 < n ? __v[7] : 0));
}
/**
* Registers the given ID with the specified callback.
*
* @param __ipcid The IPC ID to listen on.
* @param __cb The callback for the IPC.
* @throws IllegalArgumentException If IPC ID is zero.
* @throws NullPointerException On null arguments.
* @since 2019/12/28
*/
@Deprecated
public static final void register(int __ipcid, IPCCallback __cb)
throws IllegalArgumentException, NullPointerException
{
if (__cb == null)
throw new NullPointerException("NARG");
// {@squirreljme.error ZZ3u It is not valid to register the zero
// IPC ID.}
if (__ipcid == 0)
throw new IllegalArgumentException("ZZ3u");
// Lock and register
Map<Integer, IPCCallback> ipcmap = IPCManager._IPC_MAP;
synchronized (ipcmap)
{
ipcmap.put(__ipcid, __cb);
}
}
}
// -*- Mode: Java; indent-tabs-mode: t; tab-width: 4 -*-
// ---------------------------------------------------------------------------
// SquirrelJME
// Copyright (C) Stephanie Gawroriski <xer@multiphasicapps.net>
// ---------------------------------------------------------------------------
// SquirrelJME is under the GNU General Public License v3+, or later.
// See license.mkd for licensing and copyright information.
// ---------------------------------------------------------------------------
package cc.squirreljme.jvm;
import cc.squirreljme.runtime.cldc.debug.Debugging;
/**
* This class contains the functions of the virtual machine.
*
* @deprecated This entire class is going to be removed as it will be made
* not needed with future changes.
* @since 2019/05/25
*/
@Deprecated
public final class JVMFunction
{
/**
* Not used.
*
* @since 2019/05/25
*/
@Deprecated
private JVMFunction()
{
}
/**
* Checks if the given object can be stored in the array.
*
* @param __p The array pointer.
* @param __v The value to check.
* @return If this object can be stored in the array then {@code 1} will
* be returned, otherwise {@code 0} will.
* @since 2019/04/27
*/
@Deprecated
public static final int jvmCanArrayStore(int __p, int __v)
{
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Returns the component type of the array
*
* @param __clid The class ID
* @return The component type of the array or {@code 0} if it is not an
* array.
* @since 2019/04/27
*/
@Deprecated
public static final int jvmComponentType(int __clid)
{
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Performs aggressive garbage collection of the JVM heap to free as much
* memory as possible.
*
* @since 2019/04/25
*/
@Deprecated
public static final void jvmGarbageCollect()
{
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Garbage collects a single object.
*
* @param __p The object to garbage collect.
* @since 2019/04/25
*/
@Deprecated
public static final void jvmGarbageCollectObject(int __p)
{
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Initializes the given class.
*
* @param __ns The noted string.
* @return The loaded class info.
* @since 2019/12/15
*/
@Deprecated
public static final ClassInfo jvmInitClass(int __ns)
{
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Searches the interface vtables for the class of object {@code __p}
* and searches for an interface implementation of class {@code __icl} and
* if one is found then the pointer for index {@code __mdx} is returned.
*
* @param __p The object to do a interface lookup on.
* @param __icl The interface class to find.
* @param __mdx The method index to relate to, of the interface class.
* @return The pointer to the code to be invoked in the low-word and the
* pool of the target class in the high-word.
* @since 2019/04/30
*/
@Deprecated
public static final long jvmInterfacePointer(int __p, int __icl, int __mdx)
{
Assembly.breakpoint();
throw Debugging.todo();
// Assembly.longPack(hi, lo)
}
/**
* Checks whether the given pointer is an array.
*
* @param __p The pointer to check.
* @return Either {@code 1} if it is an array or {@code 0} if it is not.
* @since 2019/04/27
*/
@Deprecated
public static final int jvmIsArray(int __p)
{
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Checks whether the given pointer is an instance of the given class.
*
* @param __p The pointer to check.
* @param __cldx The class index.
* @return Either {@code 1} if the class is an instance or {@code 0} if
* it is not.
* @since 2019/04/22
*/
@Deprecated
public static final int jvmIsInstance(int __p, int __cldx)
{
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Returns the {@link Class} instance for the given class info pointer,
* if none has been created yet then it will be created as needed.
*
* @param <T> The class type.
* @param __cldx The class index pointer.
* @return The resulting class.
* @since 2020/11/27
*/
@Deprecated
public static final <T> Class<T> jvmLoadClass(int __cldx)
{
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Returns the {@link Class} instance for the given class info pointer,
* if none has been created yet then it will be created as needed.
*
* @param <T> The class type.
* @param __cldx The class index pointer.
* @return The resulting class.
* @since 2019/05/26
*/
@Deprecated
public static final <T> Class<T> jvmLoadClass(ClassInfo __cldx)
{
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Loads a string from memory and returns an `intern()` string value.
*
* @param __p The pointer to load the string bytes from.
* @return The resulting string.
* @since 2019/05/26
*/
@Deprecated
public static final String jvmLoadString(int __p)
{
// Zero will be the null pointer
if (__p == 0)
return null;
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Reads a long value from the given address
*
* @param __addr The address to access.
* @param __off The address offset.
* @return The read value.
* @since 2019/05/29
*/
@Deprecated
public static final long jvmMemReadLong(int __addr, int __off)
{
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Writes a long value to the given address
*
* @param __addr The address to access.
* @param __off The address offset.
* @param __hv The high value.
* @param __lv The low value.
* @since 2019/05/29
*/
@Deprecated
public static final void jvmMemWriteLong(int __addr, int __off, int __hv,
int __lv)
{
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Writes a long value to the given address
*
* @param __addr The address to access.
* @param __off The address offset.
* @param __v The value
* @since 2019/05/29
*/
@Deprecated
public static final void jvmMemWriteLong(int __addr, int __off, long __v)
{
JVMFunction.jvmMemWriteLong(__addr, __off,
(int)(__v >>> 32), (int)__v);
}
/**
* Enters the monitor for the given object.
*
* @param __p The object to enter.
* @since 2019/04/26
*/
@Deprecated
public static final void jvmMonitorEnter(int __p)
{
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Exits the monitor for the given object.
*
* @param __p The object to exit.
* @since 2019/04/26
*/
@Deprecated
public static final void jvmMonitorExit(int __p)
{
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Allocates a new object.
*
* @param __cl The class type.
* @return The resulting class pointer.
* @throws OutOfMemoryError If there is not enough memory to allocate the
* class.
* @since 2019/05/24
*/
@Deprecated
public static final int jvmNew(int __cl)
throws OutOfMemoryError
{
Assembly.breakpoint();
throw Debugging.todo();
}
/**
* Allocates a new array.
*
* @param __at The array type.
* @param __len The length of the array.
* @return The resulting array pointer.
* @throws NegativeArraySizeException If the array length is negative.
* @throws OutOfMemoryError If there is not enough memory to allocate the
* array.
* @since 2019/04/24
*/
@Deprecated
public static final int jvmNewArray(int __at, int __len)
throws NegativeArraySizeException, OutOfMemoryError