#include <stdint.h>
#include <sys/stat.h>
-#include "mm/memory.h"
+#include "mm/memory.hpp"
#include "native/jni.hpp"
#include "native/llni.h"
# include "native/vm/include/java_lang_VMClassLoader.h"
#endif
-#include "toolbox/logging.h"
+#include "toolbox/logging.hpp"
#include "toolbox/list.hpp"
#if defined(ENABLE_ASSERTION)
#include "vm/assertion.hpp"
#endif
+#include "vm/array.hpp"
#include "vm/jit/builtin.hpp"
#include "vm/class.hpp"
-#include "vm/classcache.h"
+#include "vm/classcache.hpp"
#include "vm/exceptions.hpp"
#include "vm/globals.hpp"
#include "vm/initialize.hpp"
#include "vm/javaobjects.hpp"
-#include "vm/linker.h"
+#include "vm/linker.hpp"
#include "vm/loader.hpp"
#include "vm/options.h"
#include "vm/primitive.hpp"
#include "vm/statistics.h"
#include "vm/string.hpp"
#include "vm/vm.hpp"
-#include "vm/zip.h"
+#include "vm/zip.hpp"
#include "vm/jit/asmpart.h"
*/
JNIEXPORT jclass JNICALL Java_java_lang_VMClassLoader_defineClass(JNIEnv *env, jclass clazz, jobject cl, jstring name, jbyteArray data, jint offset, jint len, jobject pd)
{
- utf *utfname;
- classinfo *c;
- classloader_t *loader;
- java_handle_bytearray_t* ba;
- uint8_t* stream;
+ utf* utfname;
+ classinfo* c;
+ classloader_t* loader;
+ uint8_t* stream;
#if defined(ENABLE_JVMTI)
jint new_class_data_len = 0;
/* check the indexes passed */
- if ((offset < 0) || (len < 0) || ((offset + len) > LLNI_array_size(data))) {
+ ByteArray ba(data);
+
+ if ((offset < 0) || (len < 0) || ((offset + len) > ba.get_length())) {
exceptions_throw_arrayindexoutofboundsexception();
return NULL;
}
else
#endif
{
- ba = (java_handle_bytearray_t*) data;
- stream = (uint8_t *) &LLNI_array_direct(ba, offset);
+ stream = ((uint8_t *) ba.get_raw_data_ptr()) + offset;
c = class_define(utfname, loader, len, stream, (java_handle_t *) pd);
}
struct stat buf; /* buffer for stat */
jboolean ret; /* return value of "add" */
+ // Get current list of classpath entries.
+ SuckClasspath& suckclasspath = VM::get_current()->get_suckclasspath();
+
/* get the resource name as utf string */
utfname = javastring_toutf((java_handle_t *) name, false);
/* iterate over all classpath entries */
- for (List<list_classpath_entry*>::iterator it = list_classpath_entries->begin(); it != list_classpath_entries->end(); it++) {
+ for (SuckClasspath::iterator it = suckclasspath.begin(); it != suckclasspath.end(); it++) {
list_classpath_entry* lce = *it;
/* clear path pointer */