You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@harmony.apache.org by va...@apache.org on 2006/12/05 07:55:52 UTC
svn commit: r482527 - in /harmony/enhanced/drlvm/trunk:
build/patches/win/APR/misc/win32/ build/patches/win/APR/threadproc/win32/
vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/
vm/gc_cc/javasrc/org/apache/harmony/drlvm/gc_cc/ vm/gc_cc/src...
Author: varlax
Date: Mon Dec 4 22:55:50 2006
New Revision: 482527
URL: http://svn.apache.org/viewvc?view=rev&rev=482527
Log:
Fixed eol-style.
Modified:
harmony/enhanced/drlvm/trunk/build/patches/win/APR/misc/win32/env.c (props changed)
harmony/enhanced/drlvm/trunk/build/patches/win/APR/threadproc/win32/thread.c (contents, props changed)
harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Factory.java (contents, props changed)
harmony/enhanced/drlvm/trunk/vm/gc_cc/javasrc/org/apache/harmony/drlvm/gc_cc/GCHelper.java (props changed)
harmony/enhanced/drlvm/trunk/vm/gc_cc/src/gc_jni.cpp (props changed)
harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/magics.cpp (contents, props changed)
harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/jvmti/Breakpoint1/Breakpoint1.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/jvmti/Breakpoint1/agent.cpp (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/jvmti/Breakpoint1/agent.h (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/jvmti/Breakpoint1/breakpoint.cpp (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/jvmti/SingleStep1/SingleStep1.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/jvmti/SingleStep1/agent.cpp (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/jvmti/SingleStep1/agent.h (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/jvmti/SingleStep1/singlestep.cpp (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/jvmti/VMInit1/VMInit1.cpp (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/jvmti/VMInit1/VMInit1.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassGenericsTest4.java (contents, props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java (contents, props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResource.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResourceAsStream.java (contents, props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest0.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest10.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest11.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest29.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest31.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest34.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest39.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest40.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest41.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest42.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/LocalClassAccessCheckTest.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/smoke/exception/FinalizeStackTest.java (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/unit/ulist/ulist_test.cpp (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/unit/ulist/unit_test.h (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/unit/ulist/unit_test_logger.h (props changed)
harmony/enhanced/drlvm/trunk/vm/tests/unit/ulist/unit_test_main.h (props changed)
harmony/enhanced/drlvm/trunk/vm/thread/src/thread_helpers_ipf.c (props changed)
harmony/enhanced/drlvm/trunk/vm/vmcore/include/annotation.h (props changed)
harmony/enhanced/drlvm/trunk/vm/vmcore/include/cci.h (props changed)
harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h (props changed)
harmony/enhanced/drlvm/trunk/vm/vmcore/include/vtable.h (props changed)
harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelper.java (props changed)
Propchange: harmony/enhanced/drlvm/trunk/build/patches/win/APR/misc/win32/env.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/drlvm/trunk/build/patches/win/APR/threadproc/win32/thread.c
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/build/patches/win/APR/threadproc/win32/thread.c?view=diff&rev=482527&r1=482526&r2=482527
==============================================================================
--- harmony/enhanced/drlvm/trunk/build/patches/win/APR/threadproc/win32/thread.c (original)
+++ harmony/enhanced/drlvm/trunk/build/patches/win/APR/threadproc/win32/thread.c Mon Dec 4 22:55:50 2006
@@ -1,282 +1,282 @@
-/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
- * applicable.
- *
- * Licensed under the Apache License, Version 2.0 (the "License");
- * you may not use this file except in compliance with the License.
- * You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-#include "apr_private.h"
-#include "win32/apr_arch_threadproc.h"
-#include "apr_thread_proc.h"
-#include "apr_general.h"
-#include "apr_lib.h"
-#include "apr_portable.h"
-#if APR_HAVE_PROCESS_H
-#include <process.h>
-#endif
-#include "apr_arch_misc.h"
-
-/* Chosen for us by apr_initialize */
-DWORD tls_apr_thread = 0;
-
-APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new,
- apr_pool_t *pool)
-{
- (*new) = (apr_threadattr_t *)apr_palloc(pool,
- sizeof(apr_threadattr_t));
-
- if ((*new) == NULL) {
- return APR_ENOMEM;
- }
-
- (*new)->pool = pool;
- (*new)->detach = 0;
- (*new)->stacksize = 0;
-
- return APR_SUCCESS;
-}
-
-APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr,
- apr_int32_t on)
-{
- attr->detach = on;
- return APR_SUCCESS;
-}
-
-APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr)
-{
- if (attr->detach == 1)
- return APR_DETACH;
- return APR_NOTDETACH;
-}
-
-APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr,
- apr_size_t stacksize)
-{
- attr->stacksize = stacksize;
- return APR_SUCCESS;
-}
-
-APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
- apr_size_t size)
-{
- return APR_ENOTIMPL;
-}
-
-static void *dummy_worker(void *opaque)
-{
- apr_thread_t *thd = (apr_thread_t *)opaque;
- TlsSetValue(tls_apr_thread, thd->td);
- return thd->func(thd, thd->data);
-}
-
-APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new,
- apr_threadattr_t *attr,
- apr_thread_start_t func,
- void *data, apr_pool_t *pool)
-{
- apr_status_t stat;
- unsigned temp;
- HANDLE handle;
-
- (*new) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t));
-
- if ((*new) == NULL) {
- return APR_ENOMEM;
- }
-
- (*new)->pool = pool;
- (*new)->data = data;
- (*new)->func = func;
- (*new)->td = NULL;
- stat = apr_pool_create(&(*new)->pool, pool);
- if (stat != APR_SUCCESS) {
- return stat;
- }
-
- /* Use 0 for Thread Stack Size, because that will default the stack to the
- * same size as the calling thread.
- */
-#ifndef _WIN32_WCE
- if ((handle = (HANDLE)_beginthreadex(NULL,
- attr && attr->stacksize > 0 ? attr->stacksize : 0,
- (unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker,
- (*new), 0, &temp)) == 0) {
- return APR_FROM_OS_ERROR(_doserrno);
- }
-#else
- if ((handle = CreateThread(NULL,
- attr && attr->stacksize > 0 ? attr->stacksize : 0,
- (unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker,
- (*new), 0, &temp)) == 0) {
- return apr_get_os_error();
- }
-#endif
- if (attr && attr->detach) {
- CloseHandle(handle);
- }
- else
- (*new)->td = handle;
-
- return APR_SUCCESS;
-}
-
-APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd,
- apr_status_t retval)
-{
- thd->exitval = retval;
- apr_pool_destroy(thd->pool);
- thd->pool = NULL;
-#ifndef _WIN32_WCE
- _endthreadex(0);
-#else
- ExitThread(0);
-#endif
- return APR_SUCCESS;
-}
-
-APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval,
- apr_thread_t *thd)
-{
- apr_status_t rv = APR_SUCCESS;
-
- if (!thd->td) {
- /* Can not join on detached threads */
- return APR_DETACH;
- }
- rv = WaitForSingleObject(thd->td, INFINITE);
- if ( rv == WAIT_OBJECT_0 || rv == WAIT_ABANDONED) {
- /* If the thread_exit has been called */
- if (!thd->pool)
- *retval = thd->exitval;
- else
- rv = APR_INCOMPLETE;
- }
- else
- rv = apr_get_os_error();
- CloseHandle(thd->td);
- thd->td = NULL;
-
- return rv;
-}
-
-APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd)
-{
- if (thd->td && CloseHandle(thd->td)) {
- thd->td = NULL;
- return APR_SUCCESS;
- }
- else {
- return apr_get_os_error();
- }
-}
-
-APR_DECLARE(void) apr_thread_yield()
-{
- /* SwitchToThread is not supported on Win9x, but since it's
- * primarily a noop (entering time consuming code, therefore
- * providing more critical threads a bit larger timeslice)
- * we won't worry too much if it's not available.
- */
-#ifndef _WIN32_WCE
- if (apr_os_level >= APR_WIN_NT) {
- SwitchToThread();
- }
-#endif
-}
-
-APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key,
- apr_thread_t *thread)
-{
- return apr_pool_userdata_get(data, key, thread->pool);
-}
-
-APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key,
- apr_status_t (*cleanup) (void *),
- apr_thread_t *thread)
-{
- return apr_pool_userdata_set(data, key, cleanup, thread->pool);
-}
-
-
-APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void)
-{
- HANDLE hthread = (HANDLE)TlsGetValue(tls_apr_thread);
- HANDLE hproc;
-
- if (hthread) {
- return hthread;
- }
-
- hproc = GetCurrentProcess();
- hthread = GetCurrentThread();
- if (!DuplicateHandle(hproc, hthread,
- hproc, &hthread, 0, FALSE,
- DUPLICATE_SAME_ACCESS)) {
- return NULL;
- }
- TlsSetValue(tls_apr_thread, hthread);
- return hthread;
-}
-
-APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd,
- apr_thread_t *thd)
-{
- if (thd == NULL) {
- return APR_ENOTHREAD;
- }
- *thethd = &(thd->td);
- return APR_SUCCESS;
-}
-
-APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd,
- apr_os_thread_t *thethd,
- apr_pool_t *pool)
-{
- if (pool == NULL) {
- return APR_ENOPOOL;
- }
- if ((*thd) == NULL) {
- (*thd) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t));
- (*thd)->pool = pool;
- }
- (*thd)->td = *thethd;
- return APR_SUCCESS;
-}
-
-APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control,
- apr_pool_t *p)
-{
- (*control) = apr_pcalloc(p, sizeof(**control));
- return APR_SUCCESS;
-}
-
-APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control,
- void (*func)(void))
-{
- if (!InterlockedExchange(&control->value, 1)) {
- func();
- }
- return APR_SUCCESS;
-}
-
-APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1,
- apr_os_thread_t tid2)
-{
- /* Since the only tid's we support our are own, and
- * apr_os_thread_current returns the identical handle
- * to the one we created initially, the test is simple.
- */
- return (tid1 == tid2);
-}
-
-APR_POOL_IMPLEMENT_ACCESSOR(thread)
+/* Copyright 2000-2005 The Apache Software Foundation or its licensors, as
+ * applicable.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include "apr_private.h"
+#include "win32/apr_arch_threadproc.h"
+#include "apr_thread_proc.h"
+#include "apr_general.h"
+#include "apr_lib.h"
+#include "apr_portable.h"
+#if APR_HAVE_PROCESS_H
+#include <process.h>
+#endif
+#include "apr_arch_misc.h"
+
+/* Chosen for us by apr_initialize */
+DWORD tls_apr_thread = 0;
+
+APR_DECLARE(apr_status_t) apr_threadattr_create(apr_threadattr_t **new,
+ apr_pool_t *pool)
+{
+ (*new) = (apr_threadattr_t *)apr_palloc(pool,
+ sizeof(apr_threadattr_t));
+
+ if ((*new) == NULL) {
+ return APR_ENOMEM;
+ }
+
+ (*new)->pool = pool;
+ (*new)->detach = 0;
+ (*new)->stacksize = 0;
+
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_threadattr_detach_set(apr_threadattr_t *attr,
+ apr_int32_t on)
+{
+ attr->detach = on;
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_threadattr_detach_get(apr_threadattr_t *attr)
+{
+ if (attr->detach == 1)
+ return APR_DETACH;
+ return APR_NOTDETACH;
+}
+
+APR_DECLARE(apr_status_t) apr_threadattr_stacksize_set(apr_threadattr_t *attr,
+ apr_size_t stacksize)
+{
+ attr->stacksize = stacksize;
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_threadattr_guardsize_set(apr_threadattr_t *attr,
+ apr_size_t size)
+{
+ return APR_ENOTIMPL;
+}
+
+static void *dummy_worker(void *opaque)
+{
+ apr_thread_t *thd = (apr_thread_t *)opaque;
+ TlsSetValue(tls_apr_thread, thd->td);
+ return thd->func(thd, thd->data);
+}
+
+APR_DECLARE(apr_status_t) apr_thread_create(apr_thread_t **new,
+ apr_threadattr_t *attr,
+ apr_thread_start_t func,
+ void *data, apr_pool_t *pool)
+{
+ apr_status_t stat;
+ unsigned temp;
+ HANDLE handle;
+
+ (*new) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t));
+
+ if ((*new) == NULL) {
+ return APR_ENOMEM;
+ }
+
+ (*new)->pool = pool;
+ (*new)->data = data;
+ (*new)->func = func;
+ (*new)->td = NULL;
+ stat = apr_pool_create(&(*new)->pool, pool);
+ if (stat != APR_SUCCESS) {
+ return stat;
+ }
+
+ /* Use 0 for Thread Stack Size, because that will default the stack to the
+ * same size as the calling thread.
+ */
+#ifndef _WIN32_WCE
+ if ((handle = (HANDLE)_beginthreadex(NULL,
+ attr && attr->stacksize > 0 ? attr->stacksize : 0,
+ (unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker,
+ (*new), 0, &temp)) == 0) {
+ return APR_FROM_OS_ERROR(_doserrno);
+ }
+#else
+ if ((handle = CreateThread(NULL,
+ attr && attr->stacksize > 0 ? attr->stacksize : 0,
+ (unsigned int (APR_THREAD_FUNC *)(void *))dummy_worker,
+ (*new), 0, &temp)) == 0) {
+ return apr_get_os_error();
+ }
+#endif
+ if (attr && attr->detach) {
+ CloseHandle(handle);
+ }
+ else
+ (*new)->td = handle;
+
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_thread_exit(apr_thread_t *thd,
+ apr_status_t retval)
+{
+ thd->exitval = retval;
+ apr_pool_destroy(thd->pool);
+ thd->pool = NULL;
+#ifndef _WIN32_WCE
+ _endthreadex(0);
+#else
+ ExitThread(0);
+#endif
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_thread_join(apr_status_t *retval,
+ apr_thread_t *thd)
+{
+ apr_status_t rv = APR_SUCCESS;
+
+ if (!thd->td) {
+ /* Can not join on detached threads */
+ return APR_DETACH;
+ }
+ rv = WaitForSingleObject(thd->td, INFINITE);
+ if ( rv == WAIT_OBJECT_0 || rv == WAIT_ABANDONED) {
+ /* If the thread_exit has been called */
+ if (!thd->pool)
+ *retval = thd->exitval;
+ else
+ rv = APR_INCOMPLETE;
+ }
+ else
+ rv = apr_get_os_error();
+ CloseHandle(thd->td);
+ thd->td = NULL;
+
+ return rv;
+}
+
+APR_DECLARE(apr_status_t) apr_thread_detach(apr_thread_t *thd)
+{
+ if (thd->td && CloseHandle(thd->td)) {
+ thd->td = NULL;
+ return APR_SUCCESS;
+ }
+ else {
+ return apr_get_os_error();
+ }
+}
+
+APR_DECLARE(void) apr_thread_yield()
+{
+ /* SwitchToThread is not supported on Win9x, but since it's
+ * primarily a noop (entering time consuming code, therefore
+ * providing more critical threads a bit larger timeslice)
+ * we won't worry too much if it's not available.
+ */
+#ifndef _WIN32_WCE
+ if (apr_os_level >= APR_WIN_NT) {
+ SwitchToThread();
+ }
+#endif
+}
+
+APR_DECLARE(apr_status_t) apr_thread_data_get(void **data, const char *key,
+ apr_thread_t *thread)
+{
+ return apr_pool_userdata_get(data, key, thread->pool);
+}
+
+APR_DECLARE(apr_status_t) apr_thread_data_set(void *data, const char *key,
+ apr_status_t (*cleanup) (void *),
+ apr_thread_t *thread)
+{
+ return apr_pool_userdata_set(data, key, cleanup, thread->pool);
+}
+
+
+APR_DECLARE(apr_os_thread_t) apr_os_thread_current(void)
+{
+ HANDLE hthread = (HANDLE)TlsGetValue(tls_apr_thread);
+ HANDLE hproc;
+
+ if (hthread) {
+ return hthread;
+ }
+
+ hproc = GetCurrentProcess();
+ hthread = GetCurrentThread();
+ if (!DuplicateHandle(hproc, hthread,
+ hproc, &hthread, 0, FALSE,
+ DUPLICATE_SAME_ACCESS)) {
+ return NULL;
+ }
+ TlsSetValue(tls_apr_thread, hthread);
+ return hthread;
+}
+
+APR_DECLARE(apr_status_t) apr_os_thread_get(apr_os_thread_t **thethd,
+ apr_thread_t *thd)
+{
+ if (thd == NULL) {
+ return APR_ENOTHREAD;
+ }
+ *thethd = &(thd->td);
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_os_thread_put(apr_thread_t **thd,
+ apr_os_thread_t *thethd,
+ apr_pool_t *pool)
+{
+ if (pool == NULL) {
+ return APR_ENOPOOL;
+ }
+ if ((*thd) == NULL) {
+ (*thd) = (apr_thread_t *)apr_palloc(pool, sizeof(apr_thread_t));
+ (*thd)->pool = pool;
+ }
+ (*thd)->td = *thethd;
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_thread_once_init(apr_thread_once_t **control,
+ apr_pool_t *p)
+{
+ (*control) = apr_pcalloc(p, sizeof(**control));
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(apr_status_t) apr_thread_once(apr_thread_once_t *control,
+ void (*func)(void))
+{
+ if (!InterlockedExchange(&control->value, 1)) {
+ func();
+ }
+ return APR_SUCCESS;
+}
+
+APR_DECLARE(int) apr_os_thread_equal(apr_os_thread_t tid1,
+ apr_os_thread_t tid2)
+{
+ /* Since the only tid's we support our are own, and
+ * apr_os_thread_current returns the identical handle
+ * to the one we created initially, the test is simple.
+ */
+ return (tid1 == tid2);
+}
+
+APR_POOL_IMPLEMENT_ACCESSOR(thread)
Propchange: harmony/enhanced/drlvm/trunk/build/patches/win/APR/threadproc/win32/thread.c
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Factory.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Factory.java?view=diff&rev=482527&r1=482526&r2=482527
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Factory.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Factory.java Mon Dec 4 22:55:50 2006
@@ -1,315 +1,315 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.HarmonyDRLVM.mm.mmtk;
-
-import org.mmtk.plan.Plan;
-import org.mmtk.plan.CollectorContext;
-import org.mmtk.plan.MutatorContext;
-import org.mmtk.plan.PlanConstraints;
-import org.mmtk.vm.*;
-import org.vmmagic.pragma.*;
-
-/**
- * This class defines factory methods for VM-specific types which must
- * be instantiated within MMTk. Since the concrete type is defined at
- * build time, we leave it to a concrete vm-specific instance of this class
- * to perform the object instantiation.
- *
- */
-/* 888888888888888888888888888888888888888
- *
- xom = (ObjectModel) Class.forName(vmPackage+".ObjectModel").newInstance();
-
- xas = (Assert) Class.forName(vmPackage+".Assert").newInstance();
- xba = (Barriers) Class.forName(vmPackage+".Barriers").newInstance();
- xco = (Collection) Class.forName(vmPackage+".Collection").newInstance();
- xme = (Memory) Class.forName(vmPackage+".Memory").newInstance();
- xop = (Options) Class.forName(vmPackage+".Options").newInstance();
- xrg = (ReferenceGlue) Class.forName(vmPackage+".ReferenceGlue").newInstance();
- xsc = (Scanning) Class.forName(vmPackage+".Scanning").newInstance();
- xst = (Statistics) Class.forName(vmPackage+".Statistics").newInstance();
- xsr = (Strings) Class.forName(vmPackage+".Strings").newInstance();
- xtr = (TraceInterface) Class.forName(vmPackage+".TraceInterface").newInstance();
- * 88888888888888888888888888888888888888888888888 */
-
-public class Factory extends org.mmtk.vm.Factory {
-
- private static final String vmPackage = "org.apache.HarmonyDRLVM.mm.mmtk";
-
- /**
- * Create a new ActivePlan instance using the appropriate VM-specific
- * concrete ActivePlan sub-class.
- *
- * @see ActivePlan
- * @return A concrete VM-specific ActivePlan instance.
- */
- public ActivePlan newActivePlan()
- {
- ActivePlan xx = null;
- try { xx = (ActivePlan)Class.forName(vmPackage + ".ActivePlan").newInstance(); }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-1); // we must *not* go on if the above has failed
- }
- return xx;
- }
-
- /**
- * Create a new Assert instance using the appropriate VM-specific
- * concrete Assert sub-class.
- *
- * @see Assert
- * @return A concrete VM-specific Assert instance.
- */
- public Assert newAssert()
- {
- Assert xx = null;
- try { xx = (Assert)Class.forName(vmPackage + ".Assert").newInstance(); }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-1); // we must *not* go on if the above has failed
- }
- return xx;
- }
-
- /**
- * Create a new Barriers instance using the appropriate VM-specific
- * concrete Barriers sub-class.
- *
- * @see Barriers
- * @return A concrete VM-specific Barriers instance.
- */
- public Barriers newBarriers()
- {
- Barriers xx = null;
- try { xx = (Barriers)Class.forName(vmPackage + ".Barriers").newInstance(); }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-1); // we must *not* go on if the above has failed
- }
- return xx;
- }
-
- /**
- * Create a new Collection instance using the appropriate VM-specific
- * concrete Collection sub-class.
- *
- * @see Collection
- * @return A concrete VM-specific Collection instance.
- */
- public Collection newCollection()
- {
- Collection xx = null;
- try { xx = (Collection)Class.forName(vmPackage + ".Collection").newInstance(); }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-1); // we must *not* go on if the above has failed
- }
- return xx;
- }
-
- /**
- * Create a new Lock instance using the appropriate VM-specific
- * concrete Lock sub-class.
- *
- * @see Lock
- * @param name The string to be associated with this lock instance
- * @return A concrete VM-specific Lock instance.
- */
- public Lock newLock(String name)
- {
- Lock xx = null;
- try { xx = (Lock)Class.forName(vmPackage + ".Lock").newInstance(); }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-1); // we must *not* go on if the above has failed
- }
- return xx;
- }
-
- /**
- * Create a new Memory instance using the appropriate VM-specific
- * concrete Memory sub-class.
- *
- * @see Memory
- * @return A concrete VM-specific Memory instance.
- */
- public Memory newMemory()
- {
- Memory xx = null;
- try { xx = (Memory)Class.forName(vmPackage + ".Memory").newInstance(); }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-1); // we must *not* go on if the above has failed
- }
- return xx;
- }
-
- /**
- * Create a new ObjectModel instance using the appropriate VM-specific
- * concrete ObjectModel sub-class.
- *
- * @see ObjectModel
- * @return A concrete VM-specific ObjectModel instance.
- */
- public ObjectModel newObjectModel()
- {
- ObjectModel xx = null;
- try { xx = (ObjectModel)Class.forName(vmPackage + ".ObjectModel").newInstance(); }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-1); // we must *not* go on if the above has failed
- }
- return xx;
- }
-
- /**
- * Create a new Options instance using the appropriate VM-specific
- * concrete Options sub-class.
- *
- * @see Options
- * @return A concrete VM-specific Options instance.
- */
- public Options newOptions()
- {
- Options xx = null;
- try { xx = (Options)Class.forName(vmPackage + ".Options").newInstance(); }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-1); // we must *not* go on if the above has failed
- }
- return xx;
- }
- /**
- * Create a new ReferenceGlue instance using the appropriate VM-specific
- * concrete ReferenceGlue sub-class.
- *
- * @see ReferenceGlue
- * @return A concrete VM-specific ReferenceGlue instance.
- */
- public ReferenceGlue newReferenceGlue()
- {
- ReferenceGlue xx = null;
- try { xx = (ReferenceGlue)Class.forName(vmPackage + ".ReferenceGlue").newInstance(); }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-1); // we must *not* go on if the above has failed
- }
- return xx;
- }
- /**
- * Create a new Scanning instance using the appropriate VM-specific
- * concrete Scanning sub-class.
- *
- * @see Scanning
- * @return A concrete VM-specific Scanning instance.
- */
- public Scanning newScanning()
- {
- Scanning xx = null;
- try { xx = (Scanning)Class.forName(vmPackage + ".Scanning").newInstance(); }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-1); // we must *not* go on if the above has failed
- }
- return xx;
- }
- /**
- * Create a new Statistics instance using the appropriate VM-specific
- * concrete Statistics sub-class.
- *
- * @see Statistics
- * @return A concrete VM-specific Statistics instance.
- */
- public Statistics newStatistics()
- {
- Statistics xx = null;
- try { xx = (Statistics)Class.forName(vmPackage + ".Statistics").newInstance(); }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-1); // we must *not* go on if the above has failed
- }
- return xx;
- }
- /**
- * Create a new Strings instance using the appropriate VM-specific
- * concrete Strings sub-class.
- *
- * @see Strings
- * @return A concrete VM-specific Strings instance.
- */
- public Strings newStrings()
- {
- Strings xx = null;
- try { xx = (Strings)Class.forName(vmPackage + ".Strings").newInstance(); }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-1); // we must *not* go on if the above has failed
- }
- return xx;
- }
- /**
- * Create a new SynchronizedCounter instance using the appropriate
- * VM-specific concrete SynchronizedCounter sub-class.
- *
- * @see SynchronizedCounter
- *
- * @return A concrete VM-specific SynchronizedCounter instance.
- */
- public SynchronizedCounter newSynchronizedCounter()
- {
- SynchronizedCounter xx = null;
- try { xx = (SynchronizedCounter)Class.forName(vmPackage + ".SynchronizedCounter").newInstance(); }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-1); // we must *not* go on if the above has failed
- }
- return xx;
- }
- /**
- * Create a new TraceInterface instance using the appropriate VM-specific
- * concrete TraceInterface sub-class.
- *
- * @see TraceInterface
- * @return A concrete VM-specific TraceInterface instance.
- */
- public TraceInterface newTraceInterface()
- {
- TraceInterface xx = null;
- try { xx = (TraceInterface)Class.forName(vmPackage + ".TraceInterface").newInstance(); }
- catch (Exception e)
- {
- e.printStackTrace();
- System.exit(-1); // we must *not* go on if the above has failed
- }
- return xx;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.HarmonyDRLVM.mm.mmtk;
+
+import org.mmtk.plan.Plan;
+import org.mmtk.plan.CollectorContext;
+import org.mmtk.plan.MutatorContext;
+import org.mmtk.plan.PlanConstraints;
+import org.mmtk.vm.*;
+import org.vmmagic.pragma.*;
+
+/**
+ * This class defines factory methods for VM-specific types which must
+ * be instantiated within MMTk. Since the concrete type is defined at
+ * build time, we leave it to a concrete vm-specific instance of this class
+ * to perform the object instantiation.
+ *
+ */
+/* 888888888888888888888888888888888888888
+ *
+ xom = (ObjectModel) Class.forName(vmPackage+".ObjectModel").newInstance();
+
+ xas = (Assert) Class.forName(vmPackage+".Assert").newInstance();
+ xba = (Barriers) Class.forName(vmPackage+".Barriers").newInstance();
+ xco = (Collection) Class.forName(vmPackage+".Collection").newInstance();
+ xme = (Memory) Class.forName(vmPackage+".Memory").newInstance();
+ xop = (Options) Class.forName(vmPackage+".Options").newInstance();
+ xrg = (ReferenceGlue) Class.forName(vmPackage+".ReferenceGlue").newInstance();
+ xsc = (Scanning) Class.forName(vmPackage+".Scanning").newInstance();
+ xst = (Statistics) Class.forName(vmPackage+".Statistics").newInstance();
+ xsr = (Strings) Class.forName(vmPackage+".Strings").newInstance();
+ xtr = (TraceInterface) Class.forName(vmPackage+".TraceInterface").newInstance();
+ * 88888888888888888888888888888888888888888888888 */
+
+public class Factory extends org.mmtk.vm.Factory {
+
+ private static final String vmPackage = "org.apache.HarmonyDRLVM.mm.mmtk";
+
+ /**
+ * Create a new ActivePlan instance using the appropriate VM-specific
+ * concrete ActivePlan sub-class.
+ *
+ * @see ActivePlan
+ * @return A concrete VM-specific ActivePlan instance.
+ */
+ public ActivePlan newActivePlan()
+ {
+ ActivePlan xx = null;
+ try { xx = (ActivePlan)Class.forName(vmPackage + ".ActivePlan").newInstance(); }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1); // we must *not* go on if the above has failed
+ }
+ return xx;
+ }
+
+ /**
+ * Create a new Assert instance using the appropriate VM-specific
+ * concrete Assert sub-class.
+ *
+ * @see Assert
+ * @return A concrete VM-specific Assert instance.
+ */
+ public Assert newAssert()
+ {
+ Assert xx = null;
+ try { xx = (Assert)Class.forName(vmPackage + ".Assert").newInstance(); }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1); // we must *not* go on if the above has failed
+ }
+ return xx;
+ }
+
+ /**
+ * Create a new Barriers instance using the appropriate VM-specific
+ * concrete Barriers sub-class.
+ *
+ * @see Barriers
+ * @return A concrete VM-specific Barriers instance.
+ */
+ public Barriers newBarriers()
+ {
+ Barriers xx = null;
+ try { xx = (Barriers)Class.forName(vmPackage + ".Barriers").newInstance(); }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1); // we must *not* go on if the above has failed
+ }
+ return xx;
+ }
+
+ /**
+ * Create a new Collection instance using the appropriate VM-specific
+ * concrete Collection sub-class.
+ *
+ * @see Collection
+ * @return A concrete VM-specific Collection instance.
+ */
+ public Collection newCollection()
+ {
+ Collection xx = null;
+ try { xx = (Collection)Class.forName(vmPackage + ".Collection").newInstance(); }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1); // we must *not* go on if the above has failed
+ }
+ return xx;
+ }
+
+ /**
+ * Create a new Lock instance using the appropriate VM-specific
+ * concrete Lock sub-class.
+ *
+ * @see Lock
+ * @param name The string to be associated with this lock instance
+ * @return A concrete VM-specific Lock instance.
+ */
+ public Lock newLock(String name)
+ {
+ Lock xx = null;
+ try { xx = (Lock)Class.forName(vmPackage + ".Lock").newInstance(); }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1); // we must *not* go on if the above has failed
+ }
+ return xx;
+ }
+
+ /**
+ * Create a new Memory instance using the appropriate VM-specific
+ * concrete Memory sub-class.
+ *
+ * @see Memory
+ * @return A concrete VM-specific Memory instance.
+ */
+ public Memory newMemory()
+ {
+ Memory xx = null;
+ try { xx = (Memory)Class.forName(vmPackage + ".Memory").newInstance(); }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1); // we must *not* go on if the above has failed
+ }
+ return xx;
+ }
+
+ /**
+ * Create a new ObjectModel instance using the appropriate VM-specific
+ * concrete ObjectModel sub-class.
+ *
+ * @see ObjectModel
+ * @return A concrete VM-specific ObjectModel instance.
+ */
+ public ObjectModel newObjectModel()
+ {
+ ObjectModel xx = null;
+ try { xx = (ObjectModel)Class.forName(vmPackage + ".ObjectModel").newInstance(); }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1); // we must *not* go on if the above has failed
+ }
+ return xx;
+ }
+
+ /**
+ * Create a new Options instance using the appropriate VM-specific
+ * concrete Options sub-class.
+ *
+ * @see Options
+ * @return A concrete VM-specific Options instance.
+ */
+ public Options newOptions()
+ {
+ Options xx = null;
+ try { xx = (Options)Class.forName(vmPackage + ".Options").newInstance(); }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1); // we must *not* go on if the above has failed
+ }
+ return xx;
+ }
+ /**
+ * Create a new ReferenceGlue instance using the appropriate VM-specific
+ * concrete ReferenceGlue sub-class.
+ *
+ * @see ReferenceGlue
+ * @return A concrete VM-specific ReferenceGlue instance.
+ */
+ public ReferenceGlue newReferenceGlue()
+ {
+ ReferenceGlue xx = null;
+ try { xx = (ReferenceGlue)Class.forName(vmPackage + ".ReferenceGlue").newInstance(); }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1); // we must *not* go on if the above has failed
+ }
+ return xx;
+ }
+ /**
+ * Create a new Scanning instance using the appropriate VM-specific
+ * concrete Scanning sub-class.
+ *
+ * @see Scanning
+ * @return A concrete VM-specific Scanning instance.
+ */
+ public Scanning newScanning()
+ {
+ Scanning xx = null;
+ try { xx = (Scanning)Class.forName(vmPackage + ".Scanning").newInstance(); }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1); // we must *not* go on if the above has failed
+ }
+ return xx;
+ }
+ /**
+ * Create a new Statistics instance using the appropriate VM-specific
+ * concrete Statistics sub-class.
+ *
+ * @see Statistics
+ * @return A concrete VM-specific Statistics instance.
+ */
+ public Statistics newStatistics()
+ {
+ Statistics xx = null;
+ try { xx = (Statistics)Class.forName(vmPackage + ".Statistics").newInstance(); }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1); // we must *not* go on if the above has failed
+ }
+ return xx;
+ }
+ /**
+ * Create a new Strings instance using the appropriate VM-specific
+ * concrete Strings sub-class.
+ *
+ * @see Strings
+ * @return A concrete VM-specific Strings instance.
+ */
+ public Strings newStrings()
+ {
+ Strings xx = null;
+ try { xx = (Strings)Class.forName(vmPackage + ".Strings").newInstance(); }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1); // we must *not* go on if the above has failed
+ }
+ return xx;
+ }
+ /**
+ * Create a new SynchronizedCounter instance using the appropriate
+ * VM-specific concrete SynchronizedCounter sub-class.
+ *
+ * @see SynchronizedCounter
+ *
+ * @return A concrete VM-specific SynchronizedCounter instance.
+ */
+ public SynchronizedCounter newSynchronizedCounter()
+ {
+ SynchronizedCounter xx = null;
+ try { xx = (SynchronizedCounter)Class.forName(vmPackage + ".SynchronizedCounter").newInstance(); }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1); // we must *not* go on if the above has failed
+ }
+ return xx;
+ }
+ /**
+ * Create a new TraceInterface instance using the appropriate VM-specific
+ * concrete TraceInterface sub-class.
+ *
+ * @see TraceInterface
+ * @return A concrete VM-specific TraceInterface instance.
+ */
+ public TraceInterface newTraceInterface()
+ {
+ TraceInterface xx = null;
+ try { xx = (TraceInterface)Class.forName(vmPackage + ".TraceInterface").newInstance(); }
+ catch (Exception e)
+ {
+ e.printStackTrace();
+ System.exit(-1); // we must *not* go on if the above has failed
+ }
+ return xx;
+ }
+}
Propchange: harmony/enhanced/drlvm/trunk/vm/MMTk/ext/vm/HarmonyDRLVM/org/apache/HarmonyDRLVM/mm/mmtk/Factory.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/gc_cc/javasrc/org/apache/harmony/drlvm/gc_cc/GCHelper.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/gc_cc/src/gc_jni.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/magics.cpp
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/magics.cpp?view=diff&rev=482527&r1=482526&r2=482527
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/magics.cpp (original)
+++ harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/magics.cpp Mon Dec 4 22:55:50 2006
@@ -1,63 +1,63 @@
-/*
-* Licensed to the Apache Software Foundation (ASF) under one or more
-* contributor license agreements. See the NOTICE file distributed with
-* this work for additional information regarding copyright ownership.
-* The ASF licenses this file to You under the Apache License, Version 2.0
-* (the "License"); you may not use this file except in compliance with
-* the License. You may obtain a copy of the License at
-*
-* http://www.apache.org/licenses/LICENSE-2.0
-*
-* Unless required by applicable law or agreed to in writing, software
-* distributed under the License is distributed on an "AS IS" BASIS,
-* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
-* See the License for the specific language governing permissions and
-* limitations under the License.
-*/
-/**
- * @version $Revision$
- */
-
-/**
- * @file
- * @brief Magics and WBs support for MMTk.
-*/
-
-#include "compiler.h"
-#include "enc_defs.h"
-#include "enc.h"
-
-#include "open/vm.h"
-#include "jit_import.h"
-#include "jit_intf.h"
-
-#include <vector>
-using std::vector;
-
-namespace Jitrino {
-namespace Jet {
-
-bool is_magic(Class_Handle k)
-{
- static const char unboxedName[] = "org/vmmagic/unboxed/";
- static const unsigned nameLen = sizeof(unboxedName)-1;
-
- assert(k!=NULL);
- const char * kname = class_get_name(k);
- return !strncmp(kname, unboxedName, nameLen);
-}
-
-bool is_magic(Method_Handle m)
-{
- assert(m != NULL);
- Class_Handle klass = method_get_class(m);
- return is_magic(klass);
-}
-
-#ifdef _EM64T_
-// sizeof_jt & vstack_replace_top_opnd aren't used on EM64T
-#else
-static size_t sizeof_jt(jtype jt) {
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements. See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License. You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+/**
+ * @version $Revision$
+ */
+
+/**
+ * @file
+ * @brief Magics and WBs support for MMTk.
+*/
+
+#include "compiler.h"
+#include "enc_defs.h"
+#include "enc.h"
+
+#include "open/vm.h"
+#include "jit_import.h"
+#include "jit_intf.h"
+
+#include <vector>
+using std::vector;
+
+namespace Jitrino {
+namespace Jet {
+
+bool is_magic(Class_Handle k)
+{
+ static const char unboxedName[] = "org/vmmagic/unboxed/";
+ static const unsigned nameLen = sizeof(unboxedName)-1;
+
+ assert(k!=NULL);
+ const char * kname = class_get_name(k);
+ return !strncmp(kname, unboxedName, nameLen);
+}
+
+bool is_magic(Method_Handle m)
+{
+ assert(m != NULL);
+ Class_Handle klass = method_get_class(m);
+ return is_magic(klass);
+}
+
+#ifdef _EM64T_
+// sizeof_jt & vstack_replace_top_opnd aren't used on EM64T
+#else
+static size_t sizeof_jt(jtype jt) {
static size_t sizes[] = {
1, //i8,
2, //i16,
@@ -73,316 +73,316 @@
};
size_t res= sizes[jt];
assert(res >= 1 && res<=8 && (res%2==0 || res == 1));
- return res;
-}
-
-/** creates new opnd with the specified type and generates move from old one to new one */
-static void vstack_replace_top_opnd(Compiler* c, jtype jt) {
- Opnd before = c->vstack(0).as_opnd();
- assert(sizeof_jt(jt) >= sizeof_jt(before.jt()) && sizeof(jt)<=32);
- Opnd after(jt, c->valloc(jt));
- c->mov(after, before);
- c->vpop();
- c->vpush(after);
-}
-#endif //not em64t
-
-bool Compiler::gen_magic(void)
-{
-#ifdef _EM64T_
- return false; //not tested
-#else
- const JInst& jinst = m_insts[m_pc];
- if (jinst.opcode != OPCODE_INVOKEVIRTUAL &&
- jinst.opcode != OPCODE_INVOKESTATIC &&
- jinst.opcode != OPCODE_INVOKESPECIAL &&
- jinst.opcode != OPCODE_NEW) {
- return false;
- }
-
- if (jinst.opcode == OPCODE_NEW) {
- // trying to create a magic instance ?
- Class_Handle klass = NULL;
- klass = vm_resolve_class_new(m_compileHandle, m_klass, jinst.op0);
- if (klass == NULL || !is_magic(klass)) {
- // not a magic - proceed as usual
- return false;
- }
- // Create fake instance on the stack:
- vpush(jobj);
- vstack(0).set(VA_NZ);
- return true;
- }
- //
- //
- //
- JavaByteCodes opkod = jinst.opcode;
- vector<jtype> args;
- jtype retType;
- bool is_static = opkod == OPCODE_INVOKESTATIC;
- get_args_info(is_static, jinst.op0, args, &retType);
- Method_Handle meth = NULL;
- if (opkod == OPCODE_INVOKESTATIC) {
- meth = resolve_static_method(m_compileHandle, m_klass, jinst.op0);
- }
- else if (opkod == OPCODE_INVOKEVIRTUAL) {
- meth = resolve_virtual_method(m_compileHandle, m_klass, jinst.op0);
- }
- else {
- assert(opkod == OPCODE_INVOKESPECIAL);
- meth = resolve_special_method(m_compileHandle, m_klass, jinst.op0);
- }
- if (meth == NULL || !is_magic(meth)) {
- return false;
- }
- //
- //
- //
- const char* mname = method_get_name(meth);
- //
- // Construction
- //
- if (!strcmp(mname, "<init>")) {
- // Currently only 'new <Magic>()' expected and handled
- assert(args.size() == 1);
- vpop();
- return true;
- }
-
- //
- // ADD, SUB, DIFF, etc - 2 args arithmetics
- ALU oper = alu_count;
-
- if (!strcmp(mname, "add")) { oper = alu_add; }
- else if (!strcmp(mname, "plus")) { oper = alu_add; }
- else if (!strcmp(mname, "sub")) { oper = alu_sub; }
- else if (!strcmp(mname, "minus")) { oper = alu_sub; }
- else if (!strcmp(mname, "diff")) { oper = alu_sub; }
- else if (!strcmp(mname, "or")) { oper = alu_or; }
- else if (!strcmp(mname, "xor")) { oper = alu_xor; }
- else if (!strcmp(mname, "and")) { oper = alu_and; }
- if (oper != alu_count) {
- Val& v0 = vstack(0, true);
- Val& v1 = vstack(1, true);
- Opnd newObj(jobj, valloc(jobj));
- mov(newObj, v1.as_opnd());
- alu(oper, newObj, v0.as_opnd());
- vpop();
- vpop();
- vpush(newObj);
- return true;
- }
-
- JavaByteCodes shiftOp = OPCODE_NOP;
- if (!strcmp(mname, "lsh")) {shiftOp = OPCODE_ISHL;}
- else if (!strcmp(mname, "rsha")) {shiftOp = OPCODE_ISHR;}
- else if (!strcmp(mname, "rshl")) {shiftOp = OPCODE_IUSHR;}
-
- if (shiftOp != OPCODE_NOP) {
- Opnd shiftAmount = vstack(0, false).as_opnd(i32);
- shiftAmount = vstack(0, true).as_opnd(i32);
- rlock(shiftAmount.reg());
- vpop();
- //changing type of obj opnd type to ia32
- vstack_replace_top_opnd(this, i32);
- vpush(shiftAmount);
- runlock(shiftAmount.reg());
- //processing as java bytecode and converting back to the obj type
- gen_a(shiftOp, i32);
- vstack_replace_top_opnd(this, jobj);
- return true;
- }
-
- if (!strcmp(mname, "not")) {
- Opnd v1 = vstack(0, true).as_opnd(jobj);
- rlock(v1.reg());
- Opnd v2(jobj, valloc(jobj));
- mov(v2, v1);
- bitwise_not(v2);
- runlock(v1.reg());
- vpop();
- vpush(v2);
- return true;
- }
-
- //
- // EQ, GE, GT, LE, LT, sXX - 2 args compare
- //
- COND cm = cond_none;
- if (!strcmp(mname, "EQ")) { cm = eq; }
- if (!strcmp(mname, "equals")) { cm = eq; }
- else if (!strcmp(mname, "NE")) { cm = ne; }
- // unsigned compare
- else if (!strcmp(mname, "GE")) { cm = ae; }
- else if (!strcmp(mname, "GT")) { cm = above; }
- else if (!strcmp(mname, "LE")) { cm = be;}
- else if (!strcmp(mname, "LT")) { cm = below; }
- // signed compare
- else if (!strcmp(mname, "sGE")) { cm = ge; }
- else if (!strcmp(mname, "sGT")) { cm = gt; }
- else if (!strcmp(mname, "sLE")) { cm = le;}
- else if (!strcmp(mname, "sLT")) { cm = lt; }
- //
- if (cm != cond_none) {
- Opnd o1 = vstack(1, true).as_opnd(i32);
- Opnd o2 = vstack(0, true).as_opnd(i32);
- alu(alu_cmp, o1, o2);
- vpop();
- vpop();
- Opnd boolResult(i32, valloc(i32));
- rlock(boolResult.reg());
- mov(boolResult, g_iconst_0);
- cmovcc(cm, boolResult, vaddr(i32, &g_iconst_1));
- runlock(boolResult.reg());
- vpush(boolResult);
- return true;
- }
-
- //
- // is<Smth> one arg testing
- //
- bool oneArgCmp = false;
- int theConst = 0;
- if (!strcmp(mname, "isZero")) { oneArgCmp = true; theConst = 0; }
- else if (!strcmp(mname, "isMax")) { oneArgCmp = true; theConst = ~0; }
- else if (!strcmp(mname, "isNull")) { oneArgCmp = true; theConst = 0; }
- if (oneArgCmp) {
- AR regVal = vstack(0, true).reg();
- rlock(regVal);
- alu(alu_cmp, Opnd(jobj, regVal), theConst);
-
- //save the result
- AR resultReg = valloc(i32);
- rlock(resultReg);
- mov(resultReg, Opnd(g_iconst_0));
- cmovcc(z, resultReg, vaddr(i32, &g_iconst_1));
- runlock(resultReg);
- vpop();
- vpush(Opnd(i32, resultReg));
-
- runlock(regVal);
- return true;
- }
-
- //
- // fromXXX - static creation from something
- //
- if (!strcmp(mname, "fromInt")) {
- vstack_replace_top_opnd(this, jobj);
- return true;
- }
- else if (!strcmp(mname, "fromIntSignExtend")) {
- vstack_replace_top_opnd(this, jobj);
- return true;
- }
- else if (!strcmp(mname, "fromIntZeroExtend")) {
- vstack_replace_top_opnd(this, jobj);
- return true;
- }
- else if (!strcmp(mname, "fromObject") ||
- !strcmp(mname, "toAddress") ||
- !strcmp(mname, "toObjectReference"))
- {
- vstack_replace_top_opnd(this, jobj);
- return true;
- }
-
- const char* msig = method_get_descriptor(meth);
- //
- // load<type> things
- //
- jtype jt = jvoid;
- bool load = true;
- bool has_offset = false;
-
- if (!strcmp(mname, "loadObjectReference")) { jt = jobj; }
- else if (!strcmp(mname, "loadAddress")) { jt = jobj; }
- else if (!strcmp(mname, "loadWord")) { jt = jobj; }
- else if (!strcmp(mname, "loadByte")) { jt = i8; }
- else if (!strcmp(mname, "loadChar")) { jt = u16; }
- else if (!strcmp(mname, "loadDouble")) { jt = dbl64; }
- else if (!strcmp(mname, "loadFloat")) { jt = flt32; }
- else if (!strcmp(mname, "loadInt")) { jt = i32; }
- else if (!strcmp(mname, "loadLong")) { jt = i64; }
- else if (!strcmp(mname, "loadShort")) { jt = i16; }
- else if (!strcmp(mname, "prepareWord")) { jt = i32; }
- else if (!strcmp(mname, "prepareObjectReference")) { jt = jobj;}
- else if (!strcmp(mname, "prepareAddress")) { jt = jobj;}
- else if (!strcmp(mname, "prepareInt")) { jt = i32; }
- else if (!strcmp(mname, "store")) {
- load = false;
- // store() must have at least one arg
- assert(strlen(msig) > strlen("()V"));
- char ch = msig[1]; // first symbol after '('.
- VM_Data_Type vdt = (VM_Data_Type)ch;
- switch(vdt) {
- case VM_DATA_TYPE_BOOLEAN: // i8
- case VM_DATA_TYPE_INT8: jt = i8; break;
- case VM_DATA_TYPE_INT16: jt = i16; break;
- case VM_DATA_TYPE_CHAR: jt = u16; break;
- case VM_DATA_TYPE_INT32: jt = i32; break;
- case VM_DATA_TYPE_INT64: jt = i64; break;
- case VM_DATA_TYPE_F4: jt = flt32; break;
- case VM_DATA_TYPE_F8: jt = dbl64; break;
- case VM_DATA_TYPE_ARRAY: // jobj
- case VM_DATA_TYPE_CLASS: jt = jobj; break;
- default: assert(false);
- }
- jtype retType;
- vector<jtype> args;
- get_args_info(meth, args, &retType);
- assert(args.size()>=2);
- has_offset = args.size() > 2;
- }
- if (jt != jvoid) {
- size_t jt_size = sizeof_jt(jt);
- if (load) {
- // if loadXX() has any arg, then it's offset
- if(strncmp(msig, "()", 2)) {
- has_offset = true;
- }
- }
- unsigned addr_depth = has_offset ? 1 : 0;
- if (!load) {
- ++addr_depth;
- if (is_wide(jt)) {
- ++addr_depth;
- }
- }
- AR addrReg = vstack(addr_depth, true).reg();
- rlock(addrReg);
-
- if (has_offset) {
- //Add offset. Save to the new location.
- AR addrWithOffsetReg = valloc(jobj);
- mov(addrWithOffsetReg, addrReg);
- runlock(addrReg);
- addrReg = addrWithOffsetReg;
- rlock(addrReg);
-
- AR offsetReg = vstack(0, true).reg();
- vpop();
- alu(alu_add, addrReg, offsetReg);
- }
-
- if (load) {
- vpop();
- if (!is_big(jt)) {
- AR resReg = valloc(jt);
- ld(jt, resReg, addrReg);
- Opnd resOpnd(jt, resReg);
- if (jt_size < 4) {
- Opnd extendedOpnd(i32, valloc(i32));
- if (jt == u16) {
- zx2(extendedOpnd, resOpnd);
- } else {
- sx(extendedOpnd, resOpnd);
- }
- resOpnd = extendedOpnd;
- }
- vpush(resOpnd);
-
- } else { //code is taken from array element load -> TODO: avoid duplication
+ return res;
+}
+
+/** creates new opnd with the specified type and generates move from old one to new one */
+static void vstack_replace_top_opnd(Compiler* c, jtype jt) {
+ Opnd before = c->vstack(0).as_opnd();
+ assert(sizeof_jt(jt) >= sizeof_jt(before.jt()) && sizeof(jt)<=32);
+ Opnd after(jt, c->valloc(jt));
+ c->mov(after, before);
+ c->vpop();
+ c->vpush(after);
+}
+#endif //not em64t
+
+bool Compiler::gen_magic(void)
+{
+#ifdef _EM64T_
+ return false; //not tested
+#else
+ const JInst& jinst = m_insts[m_pc];
+ if (jinst.opcode != OPCODE_INVOKEVIRTUAL &&
+ jinst.opcode != OPCODE_INVOKESTATIC &&
+ jinst.opcode != OPCODE_INVOKESPECIAL &&
+ jinst.opcode != OPCODE_NEW) {
+ return false;
+ }
+
+ if (jinst.opcode == OPCODE_NEW) {
+ // trying to create a magic instance ?
+ Class_Handle klass = NULL;
+ klass = vm_resolve_class_new(m_compileHandle, m_klass, jinst.op0);
+ if (klass == NULL || !is_magic(klass)) {
+ // not a magic - proceed as usual
+ return false;
+ }
+ // Create fake instance on the stack:
+ vpush(jobj);
+ vstack(0).set(VA_NZ);
+ return true;
+ }
+ //
+ //
+ //
+ JavaByteCodes opkod = jinst.opcode;
+ vector<jtype> args;
+ jtype retType;
+ bool is_static = opkod == OPCODE_INVOKESTATIC;
+ get_args_info(is_static, jinst.op0, args, &retType);
+ Method_Handle meth = NULL;
+ if (opkod == OPCODE_INVOKESTATIC) {
+ meth = resolve_static_method(m_compileHandle, m_klass, jinst.op0);
+ }
+ else if (opkod == OPCODE_INVOKEVIRTUAL) {
+ meth = resolve_virtual_method(m_compileHandle, m_klass, jinst.op0);
+ }
+ else {
+ assert(opkod == OPCODE_INVOKESPECIAL);
+ meth = resolve_special_method(m_compileHandle, m_klass, jinst.op0);
+ }
+ if (meth == NULL || !is_magic(meth)) {
+ return false;
+ }
+ //
+ //
+ //
+ const char* mname = method_get_name(meth);
+ //
+ // Construction
+ //
+ if (!strcmp(mname, "<init>")) {
+ // Currently only 'new <Magic>()' expected and handled
+ assert(args.size() == 1);
+ vpop();
+ return true;
+ }
+
+ //
+ // ADD, SUB, DIFF, etc - 2 args arithmetics
+ ALU oper = alu_count;
+
+ if (!strcmp(mname, "add")) { oper = alu_add; }
+ else if (!strcmp(mname, "plus")) { oper = alu_add; }
+ else if (!strcmp(mname, "sub")) { oper = alu_sub; }
+ else if (!strcmp(mname, "minus")) { oper = alu_sub; }
+ else if (!strcmp(mname, "diff")) { oper = alu_sub; }
+ else if (!strcmp(mname, "or")) { oper = alu_or; }
+ else if (!strcmp(mname, "xor")) { oper = alu_xor; }
+ else if (!strcmp(mname, "and")) { oper = alu_and; }
+ if (oper != alu_count) {
+ Val& v0 = vstack(0, true);
+ Val& v1 = vstack(1, true);
+ Opnd newObj(jobj, valloc(jobj));
+ mov(newObj, v1.as_opnd());
+ alu(oper, newObj, v0.as_opnd());
+ vpop();
+ vpop();
+ vpush(newObj);
+ return true;
+ }
+
+ JavaByteCodes shiftOp = OPCODE_NOP;
+ if (!strcmp(mname, "lsh")) {shiftOp = OPCODE_ISHL;}
+ else if (!strcmp(mname, "rsha")) {shiftOp = OPCODE_ISHR;}
+ else if (!strcmp(mname, "rshl")) {shiftOp = OPCODE_IUSHR;}
+
+ if (shiftOp != OPCODE_NOP) {
+ Opnd shiftAmount = vstack(0, false).as_opnd(i32);
+ shiftAmount = vstack(0, true).as_opnd(i32);
+ rlock(shiftAmount.reg());
+ vpop();
+ //changing type of obj opnd type to ia32
+ vstack_replace_top_opnd(this, i32);
+ vpush(shiftAmount);
+ runlock(shiftAmount.reg());
+ //processing as java bytecode and converting back to the obj type
+ gen_a(shiftOp, i32);
+ vstack_replace_top_opnd(this, jobj);
+ return true;
+ }
+
+ if (!strcmp(mname, "not")) {
+ Opnd v1 = vstack(0, true).as_opnd(jobj);
+ rlock(v1.reg());
+ Opnd v2(jobj, valloc(jobj));
+ mov(v2, v1);
+ bitwise_not(v2);
+ runlock(v1.reg());
+ vpop();
+ vpush(v2);
+ return true;
+ }
+
+ //
+ // EQ, GE, GT, LE, LT, sXX - 2 args compare
+ //
+ COND cm = cond_none;
+ if (!strcmp(mname, "EQ")) { cm = eq; }
+ if (!strcmp(mname, "equals")) { cm = eq; }
+ else if (!strcmp(mname, "NE")) { cm = ne; }
+ // unsigned compare
+ else if (!strcmp(mname, "GE")) { cm = ae; }
+ else if (!strcmp(mname, "GT")) { cm = above; }
+ else if (!strcmp(mname, "LE")) { cm = be;}
+ else if (!strcmp(mname, "LT")) { cm = below; }
+ // signed compare
+ else if (!strcmp(mname, "sGE")) { cm = ge; }
+ else if (!strcmp(mname, "sGT")) { cm = gt; }
+ else if (!strcmp(mname, "sLE")) { cm = le;}
+ else if (!strcmp(mname, "sLT")) { cm = lt; }
+ //
+ if (cm != cond_none) {
+ Opnd o1 = vstack(1, true).as_opnd(i32);
+ Opnd o2 = vstack(0, true).as_opnd(i32);
+ alu(alu_cmp, o1, o2);
+ vpop();
+ vpop();
+ Opnd boolResult(i32, valloc(i32));
+ rlock(boolResult.reg());
+ mov(boolResult, g_iconst_0);
+ cmovcc(cm, boolResult, vaddr(i32, &g_iconst_1));
+ runlock(boolResult.reg());
+ vpush(boolResult);
+ return true;
+ }
+
+ //
+ // is<Smth> one arg testing
+ //
+ bool oneArgCmp = false;
+ int theConst = 0;
+ if (!strcmp(mname, "isZero")) { oneArgCmp = true; theConst = 0; }
+ else if (!strcmp(mname, "isMax")) { oneArgCmp = true; theConst = ~0; }
+ else if (!strcmp(mname, "isNull")) { oneArgCmp = true; theConst = 0; }
+ if (oneArgCmp) {
+ AR regVal = vstack(0, true).reg();
+ rlock(regVal);
+ alu(alu_cmp, Opnd(jobj, regVal), theConst);
+
+ //save the result
+ AR resultReg = valloc(i32);
+ rlock(resultReg);
+ mov(resultReg, Opnd(g_iconst_0));
+ cmovcc(z, resultReg, vaddr(i32, &g_iconst_1));
+ runlock(resultReg);
+ vpop();
+ vpush(Opnd(i32, resultReg));
+
+ runlock(regVal);
+ return true;
+ }
+
+ //
+ // fromXXX - static creation from something
+ //
+ if (!strcmp(mname, "fromInt")) {
+ vstack_replace_top_opnd(this, jobj);
+ return true;
+ }
+ else if (!strcmp(mname, "fromIntSignExtend")) {
+ vstack_replace_top_opnd(this, jobj);
+ return true;
+ }
+ else if (!strcmp(mname, "fromIntZeroExtend")) {
+ vstack_replace_top_opnd(this, jobj);
+ return true;
+ }
+ else if (!strcmp(mname, "fromObject") ||
+ !strcmp(mname, "toAddress") ||
+ !strcmp(mname, "toObjectReference"))
+ {
+ vstack_replace_top_opnd(this, jobj);
+ return true;
+ }
+
+ const char* msig = method_get_descriptor(meth);
+ //
+ // load<type> things
+ //
+ jtype jt = jvoid;
+ bool load = true;
+ bool has_offset = false;
+
+ if (!strcmp(mname, "loadObjectReference")) { jt = jobj; }
+ else if (!strcmp(mname, "loadAddress")) { jt = jobj; }
+ else if (!strcmp(mname, "loadWord")) { jt = jobj; }
+ else if (!strcmp(mname, "loadByte")) { jt = i8; }
+ else if (!strcmp(mname, "loadChar")) { jt = u16; }
+ else if (!strcmp(mname, "loadDouble")) { jt = dbl64; }
+ else if (!strcmp(mname, "loadFloat")) { jt = flt32; }
+ else if (!strcmp(mname, "loadInt")) { jt = i32; }
+ else if (!strcmp(mname, "loadLong")) { jt = i64; }
+ else if (!strcmp(mname, "loadShort")) { jt = i16; }
+ else if (!strcmp(mname, "prepareWord")) { jt = i32; }
+ else if (!strcmp(mname, "prepareObjectReference")) { jt = jobj;}
+ else if (!strcmp(mname, "prepareAddress")) { jt = jobj;}
+ else if (!strcmp(mname, "prepareInt")) { jt = i32; }
+ else if (!strcmp(mname, "store")) {
+ load = false;
+ // store() must have at least one arg
+ assert(strlen(msig) > strlen("()V"));
+ char ch = msig[1]; // first symbol after '('.
+ VM_Data_Type vdt = (VM_Data_Type)ch;
+ switch(vdt) {
+ case VM_DATA_TYPE_BOOLEAN: // i8
+ case VM_DATA_TYPE_INT8: jt = i8; break;
+ case VM_DATA_TYPE_INT16: jt = i16; break;
+ case VM_DATA_TYPE_CHAR: jt = u16; break;
+ case VM_DATA_TYPE_INT32: jt = i32; break;
+ case VM_DATA_TYPE_INT64: jt = i64; break;
+ case VM_DATA_TYPE_F4: jt = flt32; break;
+ case VM_DATA_TYPE_F8: jt = dbl64; break;
+ case VM_DATA_TYPE_ARRAY: // jobj
+ case VM_DATA_TYPE_CLASS: jt = jobj; break;
+ default: assert(false);
+ }
+ jtype retType;
+ vector<jtype> args;
+ get_args_info(meth, args, &retType);
+ assert(args.size()>=2);
+ has_offset = args.size() > 2;
+ }
+ if (jt != jvoid) {
+ size_t jt_size = sizeof_jt(jt);
+ if (load) {
+ // if loadXX() has any arg, then it's offset
+ if(strncmp(msig, "()", 2)) {
+ has_offset = true;
+ }
+ }
+ unsigned addr_depth = has_offset ? 1 : 0;
+ if (!load) {
+ ++addr_depth;
+ if (is_wide(jt)) {
+ ++addr_depth;
+ }
+ }
+ AR addrReg = vstack(addr_depth, true).reg();
+ rlock(addrReg);
+
+ if (has_offset) {
+ //Add offset. Save to the new location.
+ AR addrWithOffsetReg = valloc(jobj);
+ mov(addrWithOffsetReg, addrReg);
+ runlock(addrReg);
+ addrReg = addrWithOffsetReg;
+ rlock(addrReg);
+
+ AR offsetReg = vstack(0, true).reg();
+ vpop();
+ alu(alu_add, addrReg, offsetReg);
+ }
+
+ if (load) {
+ vpop();
+ if (!is_big(jt)) {
+ AR resReg = valloc(jt);
+ ld(jt, resReg, addrReg);
+ Opnd resOpnd(jt, resReg);
+ if (jt_size < 4) {
+ Opnd extendedOpnd(i32, valloc(i32));
+ if (jt == u16) {
+ zx2(extendedOpnd, resOpnd);
+ } else {
+ sx(extendedOpnd, resOpnd);
+ }
+ resOpnd = extendedOpnd;
+ }
+ vpush(resOpnd);
+
+ } else { //code is taken from array element load -> TODO: avoid duplication
AR ar_lo = valloc(jt);
Opnd lo(jt, ar_lo);
rlock(lo);
@@ -396,139 +396,139 @@
do_mov(hi, mem_hi);
vpush2(lo, hi);
runlock(lo);
- runlock(hi);
- }
- } else {
- Opnd v0 = vstack(0, true).as_opnd(jt);
- if (!is_big(jt)) {
- mov(Opnd(jt, addrReg, 0), v0);
- } else {
- do_mov(Opnd(i32, addrReg, 0), v0);
- Opnd v1 = vstack(1, true).as_opnd(jt);
- do_mov(Opnd(i32, addrReg, 4), v1);
- }
- vpop(); // pop out value
- vpop(); // pop out Address
- }
- runlock(addrReg);
- return true;
- }
- //
- // max, one, zero
- //
- bool loadConst = false;
- if (!strcmp(mname, "max")) { loadConst = true; theConst = -1;}
- else if (!strcmp(mname, "one")) { loadConst = true; theConst = 1;}
- else if (!strcmp(mname, "zero")) { loadConst = true; theConst = 0;}
- else if (!strcmp(mname, "nullReference"))
- { loadConst = true; theConst = 0;}
- if (loadConst) {
- Opnd regOpnd(jobj, valloc(jobj));
- mov(regOpnd, theConst);
- vpush(regOpnd);
- return true;
- }
- //
- // toInt, toLong, toObjectRef, toWord(), etc.
- //
- jt = jvoid;
- if (!strcmp(mname, "toInt")) { jt = i32; }
- else if (!strcmp(mname, "toLong")) { jt = i64; }
- else if (!strcmp(mname, "toObjectRef")) { jt = jobj; }
- else if (!strcmp(mname, "toWord")) { jt = jobj; }
- else if (!strcmp(mname, "toAddress")) { jt = jobj; }
- else if (!strcmp(mname, "toObject")) { jt = jobj; }
- else if (!strcmp(mname, "toExtent")) { jt = jobj; }
- else if (!strcmp(mname, "toOffset")) { jt = jobj; }
- if (jt != jvoid) {
- if (jt!=i64) {
- vstack_replace_top_opnd(this, jt);
- return true;
- }
- vstack_replace_top_opnd(this, i32);
-
- Opnd srcOpnd = vstack(0, true).as_opnd(i32);
+ runlock(hi);
+ }
+ } else {
+ Opnd v0 = vstack(0, true).as_opnd(jt);
+ if (!is_big(jt)) {
+ mov(Opnd(jt, addrReg, 0), v0);
+ } else {
+ do_mov(Opnd(i32, addrReg, 0), v0);
+ Opnd v1 = vstack(1, true).as_opnd(jt);
+ do_mov(Opnd(i32, addrReg, 4), v1);
+ }
+ vpop(); // pop out value
+ vpop(); // pop out Address
+ }
+ runlock(addrReg);
+ return true;
+ }
+ //
+ // max, one, zero
+ //
+ bool loadConst = false;
+ if (!strcmp(mname, "max")) { loadConst = true; theConst = -1;}
+ else if (!strcmp(mname, "one")) { loadConst = true; theConst = 1;}
+ else if (!strcmp(mname, "zero")) { loadConst = true; theConst = 0;}
+ else if (!strcmp(mname, "nullReference"))
+ { loadConst = true; theConst = 0;}
+ if (loadConst) {
+ Opnd regOpnd(jobj, valloc(jobj));
+ mov(regOpnd, theConst);
+ vpush(regOpnd);
+ return true;
+ }
+ //
+ // toInt, toLong, toObjectRef, toWord(), etc.
+ //
+ jt = jvoid;
+ if (!strcmp(mname, "toInt")) { jt = i32; }
+ else if (!strcmp(mname, "toLong")) { jt = i64; }
+ else if (!strcmp(mname, "toObjectRef")) { jt = jobj; }
+ else if (!strcmp(mname, "toWord")) { jt = jobj; }
+ else if (!strcmp(mname, "toAddress")) { jt = jobj; }
+ else if (!strcmp(mname, "toObject")) { jt = jobj; }
+ else if (!strcmp(mname, "toExtent")) { jt = jobj; }
+ else if (!strcmp(mname, "toOffset")) { jt = jobj; }
+ if (jt != jvoid) {
+ if (jt!=i64) {
+ vstack_replace_top_opnd(this, jt);
+ return true;
+ }
+ vstack_replace_top_opnd(this, i32);
+
+ Opnd srcOpnd = vstack(0, true).as_opnd(i32);
Opnd lo(jt, valloc(jt));
do_mov(lo, srcOpnd);
Opnd hi(jt, g_iconst_0);
vpop();
- vpush2(lo, hi);
- return true;
- }
-
- if (!strcmp(mname, "attempt")) {
- AR addrReg;
- if (args.size() == 4) { //attempt with Offset
- AR newAddressReg = valloc(jobj);
- rlock(newAddressReg);
- addrReg= vstack(3, true).reg();
- mov(newAddressReg, addrReg);
- AR offsetReg= vstack(0, true).reg();
- alu(alu_add, newAddressReg, offsetReg);
- runlock(newAddressReg);
- addrReg = newAddressReg;
- vpop();
- } else {
- addrReg = vstack(2, true).reg();
- }
- rlock(addrReg);
- AR newReg = vstack(0, true).reg();
- rlock(newReg);
- AR oldReg = vstack(1, true).reg();
-
- cmpxchg(true, addrReg, newReg, oldReg);
-
- runlock(addrReg);
- runlock(newReg);
-
- //save the result
- AR resultReg = valloc(i32);
- rlock(resultReg);
- mov(resultReg, Opnd(g_iconst_0));
- cmovcc(z, resultReg, vaddr(i32, &g_iconst_1));
- runlock(resultReg);
-
- //fixing the stack and saving the result.
- vpop();
- vpop();
- vpop();
- vpush(Opnd(i32, resultReg));
-
- return true;
- }
-
- //
- // xArray stuff
- //
- if (!strcmp(mname, "create")) {
- VM_Data_Type atype = VM_DATA_TYPE_INT32;
- Class_Handle elem_class = class_get_class_of_primitive_type(atype);
- assert(elem_class != NULL);
- Class_Handle array_class = class_get_array_of_class(elem_class);
- assert(array_class != NULL);
- Allocation_Handle ah = class_get_allocation_handle(array_class);
- gen_new_array(ah);
- return true;
- }
-
- if (!strcmp(mname, "get")) {
- gen_arr_load(jobj);
- return true;
- }
-
- if (!strcmp(mname, "set")) {
- gen_arr_store(jobj, false);
- return true;
- }
- if (!strcmp(mname, "length")) {
- gen_array_length();
- return true;
- }
- //assert(false);
- return false;
-
-#endif //not em64t
-}
-
-}}; // ~namespace Jitrino::Jet
+ vpush2(lo, hi);
+ return true;
+ }
+
+ if (!strcmp(mname, "attempt")) {
+ AR addrReg;
+ if (args.size() == 4) { //attempt with Offset
+ AR newAddressReg = valloc(jobj);
+ rlock(newAddressReg);
+ addrReg= vstack(3, true).reg();
+ mov(newAddressReg, addrReg);
+ AR offsetReg= vstack(0, true).reg();
+ alu(alu_add, newAddressReg, offsetReg);
+ runlock(newAddressReg);
+ addrReg = newAddressReg;
+ vpop();
+ } else {
+ addrReg = vstack(2, true).reg();
+ }
+ rlock(addrReg);
+ AR newReg = vstack(0, true).reg();
+ rlock(newReg);
+ AR oldReg = vstack(1, true).reg();
+
+ cmpxchg(true, addrReg, newReg, oldReg);
+
+ runlock(addrReg);
+ runlock(newReg);
+
+ //save the result
+ AR resultReg = valloc(i32);
+ rlock(resultReg);
+ mov(resultReg, Opnd(g_iconst_0));
+ cmovcc(z, resultReg, vaddr(i32, &g_iconst_1));
+ runlock(resultReg);
+
+ //fixing the stack and saving the result.
+ vpop();
+ vpop();
+ vpop();
+ vpush(Opnd(i32, resultReg));
+
+ return true;
+ }
+
+ //
+ // xArray stuff
+ //
+ if (!strcmp(mname, "create")) {
+ VM_Data_Type atype = VM_DATA_TYPE_INT32;
+ Class_Handle elem_class = class_get_class_of_primitive_type(atype);
+ assert(elem_class != NULL);
+ Class_Handle array_class = class_get_array_of_class(elem_class);
+ assert(array_class != NULL);
+ Allocation_Handle ah = class_get_allocation_handle(array_class);
+ gen_new_array(ah);
+ return true;
+ }
+
+ if (!strcmp(mname, "get")) {
+ gen_arr_load(jobj);
+ return true;
+ }
+
+ if (!strcmp(mname, "set")) {
+ gen_arr_store(jobj, false);
+ return true;
+ }
+ if (!strcmp(mname, "length")) {
+ gen_array_length();
+ return true;
+ }
+ //assert(false);
+ return false;
+
+#endif //not em64t
+}
+
+}}; // ~namespace Jitrino::Jet
Propchange: harmony/enhanced/drlvm/trunk/vm/jitrino/src/jet/magics.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/jitrino/src/optimizer/helper_inliner.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/jvmti/Breakpoint1/Breakpoint1.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/jvmti/Breakpoint1/agent.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/jvmti/Breakpoint1/agent.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/jvmti/Breakpoint1/breakpoint.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/jvmti/SingleStep1/SingleStep1.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/jvmti/SingleStep1/agent.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/jvmti/SingleStep1/agent.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/jvmti/SingleStep1/singlestep.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/jvmti/VMInit1/VMInit1.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/jvmti/VMInit1/VMInit1.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassGenericsTest4.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassGenericsTest4.java?view=diff&rev=482527&r1=482526&r2=482527
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassGenericsTest4.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassGenericsTest4.java Mon Dec 4 22:55:50 2006
@@ -117,8 +117,10 @@
if(!$Mc3$02.$Mc3$04.class.getName().equals("java.lang.ClassGenericsTest4$1$Mc3$02$$Mc3$04")) fail("test_1, case 010 FAILED: "+$Mc3$02.$Mc3$04.class.getName());
if(!$Mc3$02.$Mc3$04.class.getSimpleName().equals("$Mc3$04")) fail("test_1, case 011 FAILED: "+$Mc3$02.$Mc3$04.class.getSimpleName());
if($Mc3$02.$Mc3$04.class.getCanonicalName() != null) fail("test_1, case 012 FAILED: "+$Mc3$02.$Mc3$04.class.getCanonicalName());
- Type ab[] = null;ParameterizedType pt = null;
if(RuntimeAdditionalSupport1.openingFlag) {
-try{
at = $Mc3$02.$Mc3$04.class.getTypeParameters();
+ Type ab[] = null;ParameterizedType pt = null;
+if(RuntimeAdditionalSupport1.openingFlag) {
+try{
+ at = $Mc3$02.$Mc3$04.class.getTypeParameters();
tv = (TypeVariable)at[0];
if(!tv.getName().equals("T5")) fail("test_1, case 0121 FAILED: "+tv.getName());
/*Type*/ ab/*[]*/ = tv.getBounds();
@@ -190,7 +192,8 @@
if(!ac[2].getSimpleName().equals("$Mc3$04")) fail("test_1, case 051 FAILED: "+ac[2].getSimpleName());
if(ac[2].getCanonicalName() != null) fail("test_1, case 052 FAILED: "+ac[2].getCanonicalName());
if(RuntimeAdditionalSupport1.openingFlag) {
-try{
at = ac[2].getTypeParameters();
+try{
+ at = ac[2].getTypeParameters();
tv = (TypeVariable)at[0];
if(!tv.getName().equals("T5")) fail("test_1, case 053 FAILED: "+tv.getName());
ab = tv.getBounds();
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassGenericsTest4.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java?view=diff&rev=482527&r1=482526&r2=482527
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java Mon Dec 4 22:55:50 2006
@@ -637,7 +637,8 @@
cl = ClassLoader.getSystemClassLoader();
// TEST CASE #1:
- try {
tcl.loadClass("#org.apache.harmony.lang.generics.TemplateSet");
+ try {
+ tcl.loadClass("#org.apache.harmony.lang.generics.TemplateSet");
assertTrue("Error1", tcl.findLoadedClass("org.apache.harmony.lang.generics.TemplateSet")
.getName().equals("org.apache.harmony.lang.generics.TemplateSet"));
//tcl.loadClass("#javax.imageio.IIOImage");
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassLoaderTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResource.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResourceAsStream.java
URL: http://svn.apache.org/viewvc/harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResourceAsStream.java?view=diff&rev=482527&r1=482526&r2=482527
==============================================================================
--- harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResourceAsStream.java (original)
+++ harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResourceAsStream.java Mon Dec 4 22:55:50 2006
@@ -101,8 +101,10 @@
Void.class.getResourceAsStream("/" + afn[j])
.available() >= 0);
return;
- }catch(java.io.IOException _){
}catch(Throwable e){
- System.out.println(e.toString());
}
+ }catch(java.io.IOException _){
+ }catch(Throwable e){
+ System.out.println(e.toString());
+ }
//return;
}
}
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/ClassTestGetResourceAsStream.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest0.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest10.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest11.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest29.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest31.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest34.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest39.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest40.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest41.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/RuntimeAdditionalTest42.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/kernel/java/lang/reflect/LocalClassAccessCheckTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/smoke/exception/FinalizeStackTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/unit/ulist/ulist_test.cpp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/unit/ulist/unit_test.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/unit/ulist/unit_test_logger.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/tests/unit/ulist/unit_test_main.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/thread/src/thread_helpers_ipf.c
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/include/annotation.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/include/cci.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/include/class_member.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/include/vtable.h
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: harmony/enhanced/drlvm/trunk/vm/vmcore/src/kernel_classes/javasrc/org/apache/harmony/drlvm/VMHelper.java
------------------------------------------------------------------------------
svn:eol-style = native