/*
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
*
* under the terms of the GNU General Public License version 2 only, as
* published by the Free Software Foundation.
*
* This code is distributed in the hope that it will be useful, but WITHOUT
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
* version 2 for more details (a copy is included in the LICENSE file that
* accompanied this code).
*
* You should have received a copy of the GNU General Public License version
* 2 along with this work; if not, write to the Free Software Foundation,
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
*
* Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
* or visit www.oracle.com if you need additional information or have any
* questions.
*/
package ilib;
byte[] classfileBuffer) {
return c.result();
}
static boolean verbose = false;
final ClassReaderWriter c;
final boolean isSystem;
int constantPoolCount;
int methodsCount;
int methodsCountPos;
int profiler;
}
byte[] injection;
return currentSize;
}
injection = new byte[3];
}
return injection;
}
}
byte[] injection;
return currentSize + 1;
}
injection = new byte[4];
}
return injection;
}
}
int tracker;
return currentSize + 1;
}
}
try (FileOutputStream fileOut =
{
}
}
}
}
byte[] injection = new byte[6];
return injection;
}
}
this.c = c;
}
void doit() {
int i;
int constantPoolCountPos = c.generatedPosition();
constantPoolCount = c.copyU2();
// copy old constant pool
if (verbose) {
}
if (options.shouldInstrumentIndexed) {
if (allocInjector == null) {
// first time - create it
allocInjector = new IndexedInjector();
}
"(I)V");
} else if (options.shouldInstrumentObject) {
if (allocInjector == null) {
// first time - create it
allocInjector = new ObjectInjector();
}
} else {
if (allocInjector == null) {
// first time - create it
allocInjector = new SimpleInjector();
}
"()V");
}
}
if (options.shouldInstrumentCall) {
if (options.shouldInstrumentIndexed) {
if (callInjector == null) {
// first time - create it
callInjector = new IndexedInjector();
}
"(I)V");
} else {
if (callInjector == null) {
// first time - create it
callInjector = new SimpleInjector();
}
"()V");
}
}
if (verbose) {
}
c.setSection(1);
int interfaceCount = c.copyU2();
if (verbose) {
}
copyFields(); // fields
copyMethods(); // methods
int attrCountPos = c.generatedPosition();
if (verbose) {
}
// copy the class attributes
}
void copyFields() {
if (verbose) {
}
for (int i = 0; i < count; ++i) {
if (verbose) {
}
}
}
void copyMethods() {
methodsCountPos = c.generatedPosition();
methodsCount = c.copyU2();
int initialMethodsCount = methodsCount;
if (verbose) {
}
for (int i = 0; i < initialMethodsCount; ++i) {
copyMethod();
}
}
void copyMethod() {
return;
}
c.copyU2(); // descriptor
if (verbose) {
}
for (int i = 0; i < attrCount; ++i) {
}
}
// first, copy the native method with the name changed
// accessFlags have already been copied
// need to replicate these attributes (esp Exceptions) in wrapper
// so mark this location so we can rewind
for (int i = 0; i < attrCount; ++i) {
}
if (true) {
}
// now write the wrapper method
// rewind to wrapped attributes
c.rewind();
for (int i = 0; i < attrCount; ++i) {
}
// generate a Code attribute for the wrapper method
// increment method count
}
for (int i = 0; i < attrCount; ++i) {
copyAttr();
}
}
void copyAttr() {
if (verbose) {
}
}
// check for Code attr
if (nameIndex == c.codeAttributeIndex) {
try {
} catch (IOException exc) {
}
} else {
if (verbose) {
}
}
}
// check for Code attr
if (nameIndex == c.lineNumberAttributeIndex) {
} else if (nameIndex == c.localVarAttributeIndex) {
} else {
if (verbose) {
}
}
}
if (verbose) {
}
int attrLengthPos = c.generatedPosition();
c.copyU2(); // max locals
int codeLengthPos = c.generatedPosition();
return;
}
if (isSystem) {
if (verbose) {
}
return;
}
if (verbose) {
}
if (!options.shouldInstrumentObjectInit) {
return;
}
}
if (verbose) {
}
return;
}
}
return;
}
if (options.shouldInstrumentNew) {
}
if (options.shouldInstrumentCall) {
}
}
ib.adjustOffsets();
// fix up code length
if (verbose) {
", new: " + newCodeLength);
}
for (int i = 0; i < attrCount; ++i) {
}
// fix up attr length
if (verbose) {
", new: " + newAttrLength);
}
}
case 'B': // byte
case 'C': // char
case 'I': // int
case 'S': // short
case 'Z': // boolean
case 'F': // float
case 'D': // double
case 'J': // long
return index + 1;
case 'L': // object
int i = index + 1;
++i;
}
return i + 1;
case '[': // array
}
throw new InternalError("should not reach here");
}
int getWrappedTrackerIndex() {
if (wrappedTrackerIndex == 0) {
}
return wrappedTrackerIndex;
}
int getThisClassIndex() {
if (thisClassIndex == 0) {
}
return thisClassIndex;
}
int index = 1;
int slot = 0;
++slot;
}
char type;
switch (type) {
case 'B': // byte
case 'C': // char
case 'I': // int
case 'S': // short
case 'Z': // boolean
case 'F': // float
case 'L': // object
case '[': // array
++slot;
break;
case 'D': // double
case 'J': // long
slot += 2;
break;
}
}
return slot;
}
int attrLengthPos = c.generatedPosition();
int codeLengthPos = c.generatedPosition();
c.writeU1(opc_sipush);
// set-up args
int index = 1;
int slot = 0;
++slot;
}
char type;
switch (type) {
case 'B': // byte
case 'C': // char
case 'I': // int
case 'S': // short
case 'Z': // boolean
++slot;
break;
case 'F': // float
++slot;
break;
case 'D': // double
slot += 2;
break;
case 'J': // long
slot += 2;
break;
case 'L': // object
case '[': // array
++slot;
break;
}
}
// call the wrapped version
} else {
}
c.writeU2(wrappedIndex);
// return correct type
case 'B': // byte
case 'C': // char
case 'I': // int
case 'S': // short
case 'Z': // boolean
c.writeU1(opc_ireturn);
break;
case 'F': // float
c.writeU1(opc_freturn);
break;
case 'D': // double
c.writeU1(opc_dreturn);
break;
case 'J': // long
c.writeU1(opc_lreturn);
break;
case 'L': // object
case '[': // array
c.writeU1(opc_areturn);
break;
case 'V': // void
c.writeU1(opc_return);
break;
}
// end of code
// fix up code length
// fix up attr length
}
return classIndex;
}
}
int methodNameIndex,
int descrIndex) {
return methodIndex;
}
for (int i = 0; i < len; ++i) {
}
return constantPoolCount++;
}
return constantPoolCount++;
}
return constantPoolCount++;
}
c.writeU2(descrIndex);
return constantPoolCount++;
}
c.writeU2(classIndex);
return constantPoolCount++;
}
}