本文整理汇总了Java中com.sun.squawk.util.Assert.shouldNotReachHere方法的典型用法代码示例。如果您正苦于以下问题:Java Assert.shouldNotReachHere方法的具体用法?Java Assert.shouldNotReachHere怎么用?Java Assert.shouldNotReachHere使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类com.sun.squawk.util.Assert
的用法示例。
在下文中一共展示了Assert.shouldNotReachHere方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: getCodeForSynthesizedConstructor
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
/**
* Gets the "Code" attribute for this synthesized constructor which
* contains the bytecode implementing a call to the default constructor
* of the super class.
*
* @return the data in the "Code" attribute for this synthesized constructor
* excluding the first 6 bytes
*/
private byte[] getCodeForSynthesizedConstructor() {
try {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
DataOutputStream dos = new DataOutputStream(baos);
/*
* Now build the "Code" attribute
*/
dos.writeShort(1); // max_stack
dos.writeShort(1); // max_locals
dos.writeInt(5); // code_length
dos.writeByte(Opcode.opc_aload_0); // code[0]
dos.writeByte(Opcode.opc_invokespecial); // code[1]
dos.writeShort(6); // code[2-3]
dos.writeByte(Opcode.opc_return); // code[4]
dos.writeShort(0); // exception_table_length
dos.writeShort(0); // attributes_count
dos.close();
return baos.toByteArray();
} catch (IOException e) {
Assert.shouldNotReachHere();
return null;
}
}
示例2: opc_putstatic
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
/**
* Processes an instruction that pops a value from the
* operand stack and assigns it to a static field.
*
* @param field the referenced field
*/
private void opc_putstatic(Field field) {
if (field.hasConstant() && field.getType().isPrimitive()) {
if (VM.getCurrentIsolate().getLeafSuite().contains(field.getDefiningClass())) {
// Class structure can be modified so set the flag indicating that it
// should reify its constant fields when it is initialized.
// Assume class defined in a parent suite to be read only
field.getDefiningClass().updateModifiers(Modifier.COMPLETE_RUNTIME_STATICS);
} else {
throw Assert.shouldNotReachHere("writing to constant field of immutable class not supported");
}
}
// java putstatic stack ops: value -> ... (stack usage: 1)
// squawk putstatic stack ops: value -> ..., or class_object, value -> .... (stack usage: 2)
// so change maxstack, but after append.
StackProducer value = frame.pop(field.getType());
PutStatic instruction = new PutStatic(field, value);
append(instruction);
if (field.getDefiningClass() != method.getDefiningClass()) {
frame.growMaxStack(1); // for the class_ version
}
frame.resetMaxStack();
}
示例3: toString
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
/**
* Gets the string representation of the pseudo opcode
*
* @return a string
*/
public String toString() {
if (Assert.ASSERTS_ENABLED) {
String str = null;
switch (tag) {
case TRY: str = "try"; break;
case TRYEND: str = "tryend"; break;
case CATCH: str = "catch"; break;
case TARGET: str = "target"; break;
case POSITION: str = "position"; break;
default: Assert.shouldNotReachHere();
}
return "["+str +"] index = "+index+" context = "+context;
} else {
return super.toString();
}
}
示例4: getFramePointerByteOffset
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
/**
* @see InterpCompiler
*/
public int getFramePointerByteOffset(int fp_value) {
switch (fp_value) {
case com.sun.squawk.vm.FP.parm0: return 8;
case com.sun.squawk.vm.FP.returnIP: return 4;
case com.sun.squawk.vm.FP.returnFP: return 0;
case com.sun.squawk.vm.FP.local0: return -4;
}
Assert.shouldNotReachHere();
return 0;
}
示例5: getPrimitiveConstantValue
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
/**
* Gets the constant value of a primitive static field.
*
* @return the constant value of this primitive static field
*/
public long getPrimitiveConstantValue() {
Assert.that(Modifier.hasConstant(modifiers));
pos = signatureStart;
int id = getSignatureType(readTypeID()).getSystemID();
int dataSize = (signatureCount - 1);
Assert.that(dataSize > 0);
long value = 0;
for (int bite = 0; bite != dataSize; ++bite) {
int shift = bite * 8;
long b = nextByte() & 0xFF;
value |= (b << shift);
}
switch (id) {
case CID.BOOLEAN:
case CID.BYTE: return (byte)value;
case CID.CHAR: return (char)value;
case CID.SHORT: return (short)value;
/*if[FLOATS]*/
case CID.FLOAT:
/*end[FLOATS]*/
case CID.INT: return (int)value;
/*if[FLOATS]*/
case CID.DOUBLE:
/*end[FLOATS]*/
case CID.LONG: return value;
default:
Assert.shouldNotReachHere(
/*if[DEBUG_CODE_ENABLED]*/
"id = " + id
/*end[DEBUG_CODE_ENABLED]*/
);
return 0;
}
}
示例6: doBranch
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
/**
* Common functionality for emitting absolute and conditional branches.
*
* @param opcode
* @param instruction
* @param target
*/
private void doBranch(int opcode, Branch branch, Target target) {
int targetOffset = target.getBytecodeOffset();
/*
* If this is the first pass and the target is ahead of the current
* position then there is no way of knowing what it will be. In this
* case just assume that the target is the current instruction. The real
* address will be found on the next pass.
*/
if (state == INIT && branch.isForward()) {
count += 2; // Minimum size
needAnotherPass = true;
} else {
/*
* Emit the code and if the size of the ommited code does not equal
* the extimated position of the next instruction then add 1 byte
* to the estimate and try the instuction again until it is right.
*/
if (emitBranch(opcode, targetOffset, 1)) {
return;
}
if (emitBranch(opcode, targetOffset, 2)) {
return;
}
if (emitBranch(opcode, targetOffset, 3)) {
return;
}
if (emitBranch(opcode, targetOffset, 5)) {
return;
}
Assert.shouldNotReachHere();
}
}
示例7: getObject
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
/**
* Gets the value of an instance reference typed field.
*
* @param object the object to extract the reference typed value from
* @param field the metadata for the field
* @return the value of <code>field</code> in <code>object</code>
*/
public static Object getObject(Object object, Field field) {
try {
return jvmField(field).get(object);
} catch (Exception ex) {
Assert.shouldNotReachHere();
return null;
}
}
示例8: copyObjectGraph
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
/**
* Make a copy of the object graph in RAM rooted at a given object.
*
* @param object the root of the object graph to copy
* @return the ObjectMemorySerializer.ControlBlock instance that contains the serialized object graph and
* its metadata
* @throws OutOfMemoryError if there was insufficient memory to do the copy
*/
static ObjectMemorySerializer.ControlBlock copyObjectGraph(Object object) throws HostedPragma {
/*if[!ENABLE_ISOLATE_MIGRATION]*/
Assert.shouldNotReachHere();
return null;
/*else[ENABLE_ISOLATE_MIGRATION]*/
// Assert.always(GC.inRam(object));
//
// /*
// * Free up as much memory as possible.
// */
// collectGarbage(true);
//
// ObjectMemorySerializer.ControlBlock cb = ObjectMemorySerializer.ControlBlock.createControlBlock();
//
// int graphSize = (int)(GC.totalMemory() - GC.freeMemory());
// byte[] bits = new byte[GC.calculateOopMapSizeInBytes(graphSize)];
// cb.oopMap = new com.sun.squawk.util.BitSet(bits);
// executeCOG(object, cb);
//
// if (cb.memory == null) {
// throw VM.getOutOfMemoryError();
// }
//
// // Adjust the oop map to be exactly the right size
// byte[] memory = cb.memory;
// byte[] newBits = new byte[GC.calculateOopMapSizeInBytes(memory.length)];
// GC.arraycopy(bits, 0, newBits, 0, newBits.length);
// cb.oopMap = new com.sun.squawk.util.BitSet(newBits);
//
// return cb;
/*end[ENABLE_ISOLATE_MIGRATION]*/
}
示例9: load
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
/**
* Loads the definition of a class from its class file.
*
* @param cf the class file definition to load
*/
public void load(ClassFile cf) {
this.cf = cf;
this.klass = cf.getDefinedClass();
this.traceClassInfo = Translator.TRACING_ENABLED && Tracer.isTracing("classinfo", klass.getName());
Assert.that(klass.getState() < Klass.STATE_LOADED);
String classFilePath = getClassFilePath(klass);
InputStream is = null;
try {
ClasspathConnection classPath = translator.getClassPath();
if (classPath == null) {
throw new IOException("null class path");
}
is = classPath.openInputStream(classFilePath);
load(classFilePath, is);
} catch (IOException ioe) {
/*if[ENABLE_VERBOSE]*/
if (VM.isHosted() || VM.isVeryVerbose()) {
/*else[ENABLE_VERBOSE]*/
// if (VM.isHosted()) {
/*end[ENABLE_VERBOSE]*/
System.err.println("IO error while loading: " + klass);
ioe.printStackTrace();
}
throw new NoClassDefFoundError(prefix(ioe.toString()));
} catch (RuntimeException e) {
System.err.println("\n\nError while loading " + klass + "\n");
throw e;
} finally {
if (is != null) {
try {
is.close();
} catch (IOException ex) {
ex.printStackTrace();
Assert.shouldNotReachHere();
}
}
}
}
示例10: write
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
public void write() {
Assert.shouldNotReachHere();
}
示例11: doGetStatic
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void doGetStatic(GetStatic instruction) {
Field field = instruction.getField();
Klass klass = field.getDefiningClass();
if (klass.hasGlobalStatics()) {
emitGlobalVariableAccess(field, true);
} else {
int opcode;
switch (field.getType().getSystemID()) {
case CID.BYTE: // fall through ...
case CID.BOOLEAN: // fall through ...
case CID.SHORT: // fall through ...
case CID.CHAR: // fall through ...
case CID.INT: opcode = OPC.GETSTATIC_I; break;
/*if[FLOATS]*/
case CID.FLOAT: opcode = OPC.GETSTATIC_F; break;
case CID.DOUBLE: opcode = OPC.GETSTATIC_D; break;
/*else[FLOATS]*/
// case CID.FLOAT:
// case CID.DOUBLE: Assert.shouldNotReachHere("NO FLOATS");
/*end[FLOATS]*/
case CID.LONG: opcode = OPC.GETSTATIC_L; break;
case CID.OFFSET: // fall through
case CID.UWORD: // ...
case CID.ADDRESS: opcode = Klass.SQUAWK_64 ?
OPC.GETSTATIC_L:
OPC.GETSTATIC_I; break;
default: opcode = OPC.GETSTATIC_O; break;
}
if (klass == method.getDefiningClass()) {
switch (opcode) {
case OPC.GETSTATIC_I: opcode = OPC.CLASS_GETSTATIC_I; break;
case OPC.GETSTATIC_L: opcode = OPC.CLASS_GETSTATIC_L; break;
case OPC.GETSTATIC_O: opcode = OPC.CLASS_GETSTATIC_O; break;
/*if[FLOATS]*/
case OPC.GETSTATIC_F: opcode = OPC.CLASS_GETSTATIC_F; break;
case OPC.GETSTATIC_D: opcode = OPC.CLASS_GETSTATIC_D; break;
/*end[FLOATS]*/
default: Assert.shouldNotReachHere();
}
} else {
emitConstantObject(klass);
}
emitUnsigned(opcode, field.getOffset() + CS.firstVariable);
}
}
示例12: handleClose
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
/** @inheritdoc */
public AddressClosedException handleClose(MailboxAddress address) {
throw Assert.shouldNotReachHere(); // Clients never get the address of serverBox, so this should never get called:
}
示例13: read
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
public void read() {
Assert.shouldNotReachHere();
}
示例14: doStackMerge
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
/**
* {@inheritDoc}
*/
public void doStackMerge(StackMerge instruction) {
Assert.shouldNotReachHere();
}
示例15: exit
import com.sun.squawk.util.Assert; //导入方法依赖的package包/类
/**
* Terminates the currently running Java application. This
* method never returns normally.
* <p>
* If called by a MIDlet, a SecurityException will be thrown. MIDlets should call MIDlet.notifyDestroyed() instead.
* <p>
* The argument serves as a status code; by convention, a nonzero
* status code indicates abnormal termination.
*
* @param status exit status.
* @since JDK1.0
*/
public void exit(int status) {
Isolate iso = VM.getCurrentIsolate();
if (iso.isMidlet()) {
throw new SecurityException("MIDlets should call MIDlet.notifyDestroyed()");
}
iso.exit(status);
Assert.shouldNotReachHere();
}