Explorar o código

[cpp] Make Gc extens cppia friendly

Hugh %!s(int64=8) %!d(string=hai) anos
pai
achega
0798aa8d65
Modificáronse 3 ficheiros con 77 adicións e 30 borrados
  1. 37 0
      std/cpp/NativeGc.hx
  2. 1 0
      std/cpp/cppia/HostClasses.hx
  3. 39 30
      std/cpp/vm/Gc.hx

+ 37 - 0
std/cpp/NativeGc.hx

@@ -18,5 +18,42 @@ extern class NativeGc
    {
       return Pointer.fromRaw( allocGcBytesRaw(inBytes, false) );
    }
+
+
+   @:native("__hxcpp_enable") @:extern
+   static public function enable(inEnable:Bool) : Void { }
+
+   @:native("__hxcpp_collect") @:extern
+   static public function run(major:Bool) : Void { }
+
+   @:native("__hxcpp_gc_compact") @:extern
+   static public function compact() : Void { }
+
+   @:native("__hxcpp_gc_trace") @:extern
+   static public function nativeTrace(sought:Class<Dynamic>,printInstances:Bool) : Int return 0;
+
+   @:native("__hxcpp_gc_do_not_kill") @:extern
+   static public function doNotKill(inObject:Dynamic) : Void { }
+
+   @:native("__hxcpp_get_next_zombie") @:extern
+   static public function getNextZombie() : Dynamic return null;
+
+   @:native("__hxcpp_gc_safe_point") @:extern
+   static public function safePoint() : Void { }
+
+   @:native("__hxcpp_enter_gc_free_zone") @:extern
+   static public function enterGCFreeZone() : Void { }
+
+   @:native("__hxcpp_exit_gc_free_zone") @:extern
+   static public function exitGCFreeZone() : Void { }
+
+   @:native("__hxcpp_set_minimum_free_space") @:extern
+   static public function setMinimumFreeSpace(inBytes:Int) : Void { }
+
+   @:native("__hxcpp_set_target_free_space_percentage") @:extern
+   static public function setTargetFreeSpacePercentage(inPercentage:Int) : Void { }
+
+   @:native("__hxcpp_set_minimum_working_memory") @:extern
+   static public function setMinimumWorkingMemory(inBytes:Int) : Void { }
 }
 

+ 1 - 0
std/cpp/cppia/HostClasses.hx

@@ -55,6 +55,7 @@ class HostClasses
    "cpp.vm.WeakRef",
    "cpp.Object",
    "cpp.Int64",
+   "cpp.Finalizable",
    "Std",
    "StringBuf",
    "sys.db.Mysql",

+ 39 - 30
std/cpp/vm/Gc.hx

@@ -54,50 +54,59 @@ class Gc
 
    static public function versionCheck() { return true; }
 
+   static public function trace(sought:Class<Dynamic>,printInstances:Bool=true) : Int
+   {
+      return cpp.NativeGc.nativeTrace(sought,printInstances);
+   }
 
 
-   @:native("__hxcpp_enable") @:extern
-   static public function enable(inEnable:Bool) : Void { }
-
-   @:native("__hxcpp_collect") @:extern
-   static public function run(major:Bool) : Void { }
-
-   @:native("__hxcpp_gc_compact") @:extern
-   static public function compact() : Void { }
+   #if !cppia inline #end
+   static public function enable(inEnable:Bool) : Void
+      cpp.NativeGc.enable(inEnable);
 
-   @:native("__hxcpp_gc_trace") @:extern
-   static public function nativeTrace(sought:Class<Dynamic>,printInstances:Bool) : Int return 0;
+   #if !cppia inline #end
+   static public function run(major:Bool) : Void
+      cpp.NativeGc.run(major);
 
-   static public function trace(sought:Class<Dynamic>,printInstances:Bool=true) : Int
-   {
-      return nativeTrace(sought,printInstances);
-   }
+   #if !cppia inline #end
+   static public function compact() : Void
+      cpp.NativeGc.compact();
 
-   @:native("__hxcpp_gc_do_not_kill") @:extern
-   static public function doNotKill(inObject:Dynamic) : Void { }
+   #if !cppia inline #end
+   static public function doNotKill(inObject:Dynamic) : Void
+      cpp.NativeGc.doNotKill(inObject);
 
-   @:native("__hxcpp_get_next_zombie") @:extern
-   static public function getNextZombie() : Dynamic return null;
+   #if !cppia inline #end
+   static public function getNextZombie() : Dynamic
+      return cpp.NativeGc.getNextZombie();
 
-   @:native("__hxcpp_gc_safe_point") @:extern
-   static public function safePoint() : Void { }
+   #if !cppia inline #end
+   static public function safePoint() : Void
+      cpp.NativeGc.safePoint();
 
-   @:native("__hxcpp_enter_gc_free_zone") @:extern
-   static public function enterGCFreeZone() : Void { }
+   #if !cppia inline #end
+   static public function enterGCFreeZone() : Void
+      cpp.NativeGc.enterGCFreeZone();
 
-   @:native("__hxcpp_exit_gc_free_zone") @:extern
-   static public function exitGCFreeZone() : Void { }
+   #if !cppia inline #end
+   static public function exitGCFreeZone() : Void
+      cpp.NativeGc.exitGCFreeZone();
 
-   @:native("__hxcpp_set_minimum_free_space") @:extern
-   static public function setMinimumFreeSpace(inBytes:Int) : Void { }
+   #if !cppia inline #end
+   static public function setMinimumFreeSpace(inBytes:Int) : Void
+      cpp.NativeGc.setMinimumFreeSpace(inBytes);
 
-   @:native("__hxcpp_set_target_free_space_percentage") @:extern
-   static public function setTargetFreeSpacePercentage(inPercentage:Int) : Void { }
+   #if !cppia inline #end
+   static public function setTargetFreeSpacePercentage(inPercentage:Int) : Void
+      cpp.NativeGc.setTargetFreeSpacePercentage(inPercentage);
 
-   @:native("__hxcpp_set_minimum_working_memory") @:extern
-   static public function setMinimumWorkingMemory(inBytes:Int) : Void { }
+   #if !cppia inline #end
+   static public function setMinimumWorkingMemory(inBytes:Int) : Void
+      cpp.NativeGc.setMinimumWorkingMemory(inBytes);
 
+   #if !cppia
    @:native("__hxcpp_set_finalizer") @:extern
    static public function setFinalizer<T>(inObject:T, inFinalizer:cpp.Callable<T->Void> ) : Void { }
+   #end
 }