--- /dev/null
+2-3 ptites infos car il manque le readme.txt et les tests
+le build se fait avec libgc.mmp(dll)
+Il faut juste faire attention a la limitation introduite par l'emulateur,
+les static roots ne sont pas recuperables dynamiquement(il y a les API pour
+ca, mais ce sont des bouchons).
+Donc sur emulateur, il faut uniquement travailler avec des dlls(gc et
+clients de gc) ou un exe, et recuperer les statics roots avec
+global_init_static_root, a appeler par dll. ou exe.
+Sur target, il faut utiliser au contraire des libs statiques, on recupere
+les static roots avec le linker. Il faut simplement appeler
+global_init_static_root dans l'exe principal comem pr l'emu, qui se charge
+de tout.
+
--- /dev/null
+/*\r
+============================================================================\r
+ Name : bld.inf\r
+ Author : \r
+ Copyright : \r
+ Description : This file provides the information required for building the\r
+ whole of a libgc.\r
+============================================================================\r
+*/\r
+\r
+PRJ_PLATFORMS\r
+default armv5\r
+\r
+PRJ_MMPFILES\r
+libgc.mmp\r
--- /dev/null
+TARGET libgc.dll\r
+\r
+TARGETTYPE dll\r
+UID 0x1000008d 0x200107C2 // check uid\r
+\r
+EXPORTUNFROZEN\r
+EPOCALLOWDLLDATA\r
+//ALWAYS_BUILD_AS_ARM\r
+//nocompresstarget\r
+//srcdbg\r
+//baseaddress 00500000\r
+//LINKEROPTION CW -map libgc.map\r
+//LINKEROPTION CW -filealign 0x10000\r
+\r
+CAPABILITY PowerMgmt ReadDeviceData ReadUserData WriteDeviceData WriteUserData SwEvent LocalServices NetworkServices UserEnvironment\r
+\r
+\r
+MACRO ALL_INTERIOR_POINTERS\r
+MACRO GC_DLL\r
+MACRO GC_BUILD\r
+MACRO SYMBIAN\r
+\r
+USERINCLUDE ..\..\include\r
+USERINCLUDE ..\..\include\private\r
+\r
+SYSTEMINCLUDE \epoc32\include\r
+SYSTEMINCLUDE \epoc32\include\stdapis\r
+\r
+SOURCEPATH ..\..\\r
+\r
+SOURCE allchblk.c\r
+SOURCE alloc.c\r
+SOURCE blacklst.c\r
+SOURCE dbg_mlc.c\r
+SOURCE dyn_load.c\r
+SOURCE finalize.c\r
+//SOURCE gc_cpp.cpp\r
+SOURCE headers.c\r
+SOURCE mach_dep.c\r
+SOURCE malloc.c\r
+SOURCE mallocx.c\r
+SOURCE mark.c\r
+SOURCE mark_rts.c\r
+SOURCE misc.c\r
+SOURCE new_hblk.c\r
+SOURCE obj_map.c\r
+SOURCE os_dep.c\r
+SOURCE symbian.cpp\r
+SOURCE ptr_chck.c\r
+SOURCE reclaim.c\r
+SOURCE stubborn.c\r
+SOURCE typd_mlc.c\r
+\r
+/*\r
+#ifdef ENABLE_ABIV2_MODE\r
+ DEBUGGABLE_UDEBONLY\r
+#endif\r
+*/\r
+\r
+// Using main() as entry point\r
+STATICLIBRARY libcrt0.lib\r
+\r
+// libc and euser are always needed when using main() entry point\r
+LIBRARY libc.lib \r
+\r
+\r
+LIBRARY euser.lib\r
+LIBRARY efsrv.lib\r
+LIBRARY avkon.lib\r
+LIBRARY eikcore.lib
\ No newline at end of file
--- /dev/null
+
+// INCLUDE FILES
+#include "gcconfig.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int winscw_data_end;
+
+#ifdef __cplusplus
+ }
+#endif
+
+// End Of File
+
--- /dev/null
+
+// INCLUDE FILES
+#include "gcconfig.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int winscw_data_start;
+
+#ifdef __cplusplus
+ }
+#endif
+
+// End Of File
+
# endif
#endif
+#if defined(__SYMBIAN32__) && defined(GC_DLL)
+# ifdef GC_BUILD
+# define GC_API extern EXPORT_C
+# else
+# define GC_API extern IMPORT_C
+# endif
+#endif
+
+
#ifndef GC_API
#define GC_API extern
#endif
#include "gc.h"
+#include "gcconfig.h"
+
#ifndef THINK_CPLUS
# define GC_cdecl
#else
else
return GC_MALLOC_UNCOLLECTABLE( size );}
-inline void* gc::operator new( size_t size, void *p ) {
+inline void* gc::operator new( size_t /*size*/, void *p ) {
return p;}
inline void gc::operator delete( void* obj ) {
#ifdef GC_PLACEMENT_DELETE
inline void gc::operator delete( void*, void* ) {}
- inline void gc::operator delete( void* p, GCPlacement gcp ) {
+ inline void gc::operator delete( void* p, GCPlacement /*gcp*/ ) {
GC_FREE(p);
}
#endif
inline void* gc::operator new[]( size_t size, GCPlacement gcp ) {
return gc::operator new( size, gcp );}
-inline void* gc::operator new[]( size_t size, void *p ) {
+inline void* gc::operator new[]( size_t /*size*/, void *p ) {
return p;}
inline void gc::operator delete[]( void* obj ) {
#ifdef GC_PLACEMENT_DELETE
inline void gc::operator delete[]( void*, void* ) {}
- inline void gc::operator delete[]( void* p, GCPlacement gcp ) {
+ inline void gc::operator delete[]( void* p, GCPlacement /*gcp*/ ) {
gc::operator delete(p); }
#endif
# ifdef GC_PLACEMENT_DELETE
inline void operator delete (
void *p,
- GCPlacement gcp,
- GCCleanUpFunc cleanup,
- void* clientData )
+ GCPlacement /*gcp*/,
+ GCCleanUpFunc /*cleanup*/,
+ void* /*clientData*/ )
{
GC_FREE(p);
}
--- /dev/null
+#ifndef __INIT_GLOBAL_STATIC_ROOTS_H_
+#define __INIT_GLOBAL_STATIC_ROOTS_H_
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+void init_global_static_roots();
+
+#ifdef __cplusplus
+ }
+#endif
+
+#endif // __INIT_GLOBAL_STATIC_ROOTS_H_
\ No newline at end of file
extern GC_bool GC_is_initialized; /* GC_init() has been run. */
+
#if defined(MSWIN32) || defined(MSWINCE)
void GC_deinit(void);
/* Free any resources allocated by */
/* (We use sprintf. Hopefully that doesn't */
/* allocate for long arguments.) */
GC_API void GC_err_printf(const char * format, ...);
+
+#ifdef __cplusplus
+extern "C" {
+#endif
GC_API void GC_log_printf(const char * format, ...);
+#ifdef __cplusplus
+ }
+#endif
+
void GC_err_puts(const char *s);
/* Write s to stderr, don't buffer, don't add */
/* newlines, don't ... */
/* Machine specific parts contributed by various people. See README file. */
+/* SYMBIAN */
+# if defined(__SYMBIAN32__)
+# ifndef SYMBIAN
+# define SYMBIAN
+ #ifdef __WINS__
+ #pragma data_seg(".data2")
+ #endif
+# endif
+# endif
+
/* First a unified test for Linux: */
# if defined(linux) || defined(__linux__)
# ifndef LINUX
/* Determine the machine type: */
# if defined(__arm__) || defined(__thumb__)
# define ARM32
-# if !defined(LINUX) && !defined(NETBSD)
+# if !defined(LINUX) && !defined(NETBSD) && !defined(SYMBIAN)
# define NOSYS
# define mach_type_known
# endif
# define M68K
# define mach_type_known
# endif
-# if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc)
+# if defined(THINK_C) || defined(__MWERKS__) && !defined(__powerc) && !defined(SYMBIAN)
# define M68K
# define MACOS
# define mach_type_known
# endif
-# if defined(__MWERKS__) && defined(__powerc) && !defined(__MACH__)
+# if defined(__MWERKS__) && defined(__powerc) && !defined(__MACH__) && !defined(SYMBIAN)
# define POWERPC
# define MACOS
# define mach_type_known
# define mach_type_known
# else
# if (defined(_MSDOS) || defined(_MSC_VER)) && (_M_IX86 >= 300) \
- || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__)
+ || defined(_WIN32) && !defined(__CYGWIN32__) && !defined(__CYGWIN__) \
+ && !defined(SYMBIAN)
# if defined(__LP64__) || defined(_WIN64)
# define X86_64
# else
# endif
/* Feel free to add more clauses here */
-
+# if defined(SYMBIAN)
+# define mach_type_known
+# endif
+
/* Or manually define the machine type here. A machine type is */
/* characterized by the architecture. Some */
/* machine types are further subdivided by OS. */
# define HAVE_BUILTIN_UNWIND_INIT
# endif
+# ifdef SYMBIAN
+# define MACH_TYPE "SYMBIAN"
+# define OS_TYPE "SYMBIAN"
+# define CPP_WORDSZ 32
+# define ALIGNMENT 4
+ #define DATASTART NULL
+ #define DATAEND NULL
+# define USE_MMAP
+# define NO_EXECUTE_PERMISSION
+# endif
+
# define STACK_GRAN 0x1000000
# ifdef M68K
# define MACH_TYPE "M68K"
--- /dev/null
+
+// INCLUDE FILES
+#include <e32def.h>
+
+#include <gc.h>
+#include <gcconfig.h>
+
+#include "init_global_static_roots.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+void init_global_static_roots()
+{
+ ptr_t dataStart = NULL;
+ ptr_t dataEnd = NULL;
+ #if defined (__WINS__)
+ extern int winscw_data_start, winscw_data_end;
+ dataStart = ((ptr_t)&winscw_data_start);
+ dataEnd = ((ptr_t)&winscw_data_end);
+ #else
+ extern int Image$$RW$$Limit[], Image$$RW$$Base[];
+ dataStart = ((ptr_t)Image$$RW$$Base);
+ dataEnd = ((ptr_t)Image$$RW$$Limit);
+ #endif //__WINS__
+
+ GC_add_roots(dataStart, dataEnd);
+
+}
+
+
+#ifdef __cplusplus
+ }
+#endif
# endif
# endif
-#if defined(__MWERKS__) && !defined(POWERPC)
+#if defined(__MWERKS__) && !defined(POWERPC) && !defined(SYMBIAN)
asm static void PushMacRegisters()
{
# include <tchar.h>
#endif
-#ifdef UNIX_LIKE
+#if defined (UNIX_LIKE) || defined(SYMBIAN)
# include <fcntl.h>
# include <sys/types.h>
# include <sys/stat.h>
#ifdef DYNAMIC_LOADING
# define GC_REGISTER_MAIN_STATIC_DATA() GC_register_main_static_data()
#else
+#ifdef SYMBIAN
+# define GC_REGISTER_MAIN_STATIC_DATA() FALSE
+#else
# define GC_REGISTER_MAIN_STATIC_DATA() TRUE
+#endif //SYMBIAN
#endif
GC_FAR struct _GC_arrays GC_arrays /* = { 0 } */;
if (0 != GETENV("GC_PRINT_VERBOSE_STATS")) {
GC_print_stats = VERBOSE;
}
-# if defined(UNIX_LIKE)
- {
+#if defined (UNIX_LIKE) || defined(SYMBIAN)
+ {
+ #if defined(SYMBIAN)
+ char * file_name = "c:\\libgc.log";
+ #else
char * file_name = GETENV("GC_LOG_FILE");
+ #endif
if (0 != file_name) {
int log_d = open(file_name, O_CREAT|O_WRONLY|O_APPEND, 0666);
if (log_d < 0) {
# if !defined(OS2) && !defined(PCR) && !defined(AMIGA) && !defined(MACOS) \
&& !defined(MSWINCE)
# include <sys/types.h>
+# include <fcntl.h>
# if !defined(MSWIN32)
# include <unistd.h>
# endif
#endif /* FREEBSD_STACKBOTTOM */
+#ifdef SYMBIAN
+ptr_t GC_get_main_stack_base(void)
+{
+ return (ptr_t)GC_get_main_symbian_stack_base();
+}
+#endif
+
#if !defined(BEOS) && !defined(AMIGA) && !defined(MSWIN32) \
&& !defined(MSWINCE) && !defined(OS2) && !defined(NOSYS) && !defined(ECOS) \
- && !defined(CYGWIN32)
+ && !defined(CYGWIN32) && !defined(SYMBIAN)
ptr_t GC_get_main_stack_base(void)
{
# define HEAP_START 0
#endif
+#ifdef SYMBIAN
+extern char* GC_get_private_path_and_zero_file();
+#endif
+
ptr_t GC_unix_mmap_get_mem(word bytes)
{
void *result;
# ifndef USE_MMAP_ANON
static GC_bool initialized = FALSE;
- if (!initialized) {
- zero_fd = open("/dev/zero", O_RDONLY);
+ if (!initialized) {
+ #ifdef SYMBIAN
+ char* path = GC_get_private_path_and_zero_file();
+ zero_fd = open(path, O_RDWR | O_CREAT, 0666);
+ free( path );
+ #else
+ zero_fd = open("/dev/zero", O_RDONLY);
+ #endif
fcntl(zero_fd, F_SETFD, FD_CLOEXEC);
initialized = TRUE;
}
--- /dev/null
+
+#include <e32cmn.h>
+#include <e32std.h>
+#include <f32file.h>
+#include <aknutils.h>
+#include <stdlib.h>
+#include <string.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+int GC_get_main_symbian_stack_base()
+ {
+ TThreadStackInfo aInfo;
+ TInt err = RThread().StackInfo(aInfo);
+ if ( !err )
+ {
+ return aInfo.iBase;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+char* GC_get_private_path_and_zero_file()
+ {
+ // always on c: drive
+ RFs fs;
+ fs.Connect();
+ fs.CreatePrivatePath( EDriveC );
+ TFileName path;
+ fs.PrivatePath( path );
+ fs.Close();
+ _LIT( KCDrive, "c:" );
+ path.Insert( 0, KCDrive );
+
+
+ //convert to char*, assume ascii
+ TBuf8<KMaxFileName> path8;
+ path8.Copy( path );
+ _LIT8( KZero8, "zero" );
+ path8.Append( KZero8 );
+
+ size_t size = path8.Length() + 1;
+ char* copyChar = (char*) malloc( size );
+ memcpy( copyChar, path8.PtrZ(), size );
+
+ return copyChar; // ownership passed
+ }
+
+#ifdef __cplusplus
+ }
+#endif