Added dummy locking

This commit is contained in:
Willem Cazander 2022-10-24 15:33:58 +02:00
parent 15dae610ba
commit 6f211c8b86
5 changed files with 94 additions and 12 deletions

View file

@ -6,14 +6,15 @@ import org.slf4j.LoggerFactory;
import love.distributedrebirth.bassboon.clazz.BãßBȍőnAuthor注; import love.distributedrebirth.bassboon.clazz.BãßBȍőnAuthor注;
/** /**
* Desktop game app base config. * Desktop GDXApp static config.
*/ */
@BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天") @BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
public final class GDXAppDesktopConfig { public final class GDXAppDesktopConfig {
private static final Logger LOG = LoggerFactory.getLogger(GDXAppDesktopConfig.class); protected static final Logger LOG = LoggerFactory.getLogger(GDXAppDesktopConfig.class);
public static int WINDOW_WIDTH = 1024; public static int WINDOW_WIDTH = 1024;
public static int WINDOW_HEIGHT = 768; public static int WINDOW_HEIGHT = 768;
public static String SINGLE_THREAD_JVM = "nosync"; // jpp: remove java.lang.Thread and all sync+lock code paths from jvm.
public static String WINDOW_TITLE = "GDXApp⁴ᴰ"; public static String WINDOW_TITLE = "GDXApp⁴ᴰ";
public static String[] WINDOW_ICONS = { public static String[] WINDOW_ICONS = {
"icon/window-128.png", "icon/window-128.png",

View file

@ -1,27 +1,34 @@
package love.distributedrebirth.gdxapp4d.boot.desktop; package love.distributedrebirth.gdxapp4d.boot.desktop;
import java.util.Arrays; import java.util.Arrays;
import java.util.List;
import com.badlogic.gdx.Files.FileType; import com.badlogic.gdx.Files.FileType;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3Application;
import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration; import com.badlogic.gdx.backends.lwjgl3.Lwjgl3ApplicationConfiguration;
import love.distributedrebirth.bassboon.Bãß;
import love.distributedrebirth.bassboon.clazz.BãßBȍőnAuthor注; import love.distributedrebirth.bassboon.clazz.BãßBȍőnAuthor注;
import love.distributedrebirth.gdxapp4d.tos4.GDXAppTos4; import love.distributedrebirth.gdxapp4d.tos4.GDXAppTos4;
import net.spookygames.gdx.nativefilechooser.desktop.DesktopFileChooser; import net.spookygames.gdx.nativefilechooser.desktop.DesktopFileChooser;
/** /**
* Desktop game app launcher. * Desktop GDXApp launcher.
*/ */
@BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天") @BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
public class GDXAppDesktopLauncher { public class GDXAppDesktopLauncher {
public static void main(String[] arg) { public static void main(String[] arg) {
GDXAppDesktopConfig.printBootMessage(); GDXAppDesktopConfig.printBootMessage();
List<String> args = Arrays.asList(arg);
if (args.contains(GDXAppDesktopConfig.SINGLE_THREAD_JVM)) {
GDXAppDesktopConfig.LOG.info("Bãß.характеристики.cpu=SINGLE_THREAD_JVM)");
Bãß.характеристики.熱蘭遮城.ױזךיךזװןיןיןןזױז();
}
int width = GDXAppDesktopConfig.WINDOW_WIDTH; int width = GDXAppDesktopConfig.WINDOW_WIDTH;
int height = GDXAppDesktopConfig.WINDOW_HEIGHT; int height = GDXAppDesktopConfig.WINDOW_HEIGHT;
GDXAppTos4.INSTANCE.BãßInit(Arrays.asList(arg), width, height, new DesktopFileChooser()); GDXAppTos4.INSTANCE.BãßInit(args, width, height, new DesktopFileChooser());
Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration(); Lwjgl3ApplicationConfiguration config = new Lwjgl3ApplicationConfiguration();
config.setMaxNetThreads(Runtime.getRuntime().availableProcessors()); config.setMaxNetThreads(Runtime.getRuntime().availableProcessors());

View file

@ -21,6 +21,7 @@ import love.distributedrebirth.bassboon.death.BãßBȍőnCoffinGhostSpell;
import love.distributedrebirth.bassboon.death.BãßBȍőnCoffinGhostSpellLock; import love.distributedrebirth.bassboon.death.BãßBȍőnCoffinGhostSpellLock;
import love.distributedrebirth.bassboon.death.spider.BãßBȍőnSpider; import love.distributedrebirth.bassboon.death.spider.BãßBȍőnSpider;
import love.distributedrebirth.bassboon.death.spider.BãßBȍőnSpiderSperm; import love.distributedrebirth.bassboon.death.spider.BãßBȍőnSpiderSperm;
import love.distributedrebirth.bassboon.jpp.util.concurrent.locks.DummyReadWriteLock;
/** /**
* Runtime for static bass noise. * Runtime for static bass noise.
@ -36,7 +37,7 @@ public interface Bãß {
private final Map<Object, BȍőnGrave> יְרוּשָׁלַיִם = new WeakHashMap<>(); private final Map<Object, BȍőnGrave> יְרוּשָׁלַיִם = new WeakHashMap<>();
private final List<BãßBȍőnSpiderSperm> സ്പഡർബ = Collections.synchronizedList(new ArrayList<>()); private final List<BãßBȍőnSpiderSperm> സ്പഡർബ = Collections.synchronizedList(new ArrayList<>());
private final 𝔅𝔬𝔫𝔢𝔏𝔬𝔞𝔡𝔢𝔯ʸᴰ 𝔪𝔬𝔬𝔫𝔖𝔭𝔢𝔩𝔩𝔚𝔬𝔯𝔨 = Bãß.характеристики.熱蘭遮城.ןיװיזױױדודזיןןןזךױזזז(); private final 𝔅𝔬𝔫𝔢𝔏𝔬𝔞𝔡𝔢𝔯ʸᴰ 𝔪𝔬𝔬𝔫𝔖𝔭𝔢𝔩𝔩𝔚𝔬𝔯𝔨 = Bãß.характеристики.熱蘭遮城.ןיװיזױױדודזיןןןזךױזזז();
private final ReadWriteLock = new ReentrantReadWriteLock(); // Mononoke Lock private final ReadWriteLock = Bãß.характеристики.熱蘭遮城.ןיװיןזךױזױדזיןןזזזױדו(); // Mononoke Lock
private final Lock 魎_BIBLE = .readLock(); private final Lock 魎_BIBLE = .readLock();
private final Lock 魎_SHEMIRA = .writeLock(); private final Lock 魎_SHEMIRA = .writeLock();
@ -44,6 +45,7 @@ public interface Bãß {
* Sarcophagus is closed for humans. * Sarcophagus is closed for humans.
*/ */
private 石棺ʸᴰ() { private 石棺ʸᴰ() {
Bãß.характеристики.熱蘭遮城.יזזןיזךױױזזױ = Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.CHAR_ATARI > Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.INT_ZERO;
} }
/** /**
@ -255,24 +257,28 @@ public interface Bãß {
enum характеристики { enum характеристики {
熱蘭遮城; 熱蘭遮城;
private boolean יזזןיזךױױזזױ = false; private boolean יזזןיזךױױזזױ = Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.PTR_VOID == Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.PTR_OBJECT;
private boolean יזױזװיךןךױזױ = Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.PTR_VOID != Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.PTR_OBJECT;
private Class<𝔅𝔬𝔫𝔢𝔏𝔬𝔞𝔡𝔢𝔯ʸᴰ> ןיװיךזדודיזןיןןזױיזזךױױז; private Class<𝔅𝔬𝔫𝔢𝔏𝔬𝔞𝔡𝔢𝔯ʸᴰ> ןיװיךזדודיזןיןןזױיזזךױױז;
protected void ױזךיךזװןיןיןןזױז() { private void ױזדיןזךזןיןױז() {
if (יזזןיזךױױזזױ) { if (יזזןיזךױױזזױ) {
throw new װошибкаיзапускаיракетыװ("יזזןיזךױױזזױ"); throw new װошибкаיзапускаיракетыװ("יזזןיזךױױזזױ");
} }
יזזןיזךױױזזױ = true; }
public void ױזךיךזװןיןיןןזױז() {
ױזדיןזךזןיןױז();
יזױזװיךןךױזױ = Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.PTR_VOID == Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.PTR_OBJECT;
} }
public void ױזךױזזװיךז(Class<𝔅𝔬𝔫𝔢𝔏𝔬𝔞𝔡𝔢𝔯ʸᴰ> ןיװיךזדודיזןיןןזױיזזךױױז) { public void ױזךױזזװיךז(Class<𝔅𝔬𝔫𝔢𝔏𝔬𝔞𝔡𝔢𝔯ʸᴰ> ןיװיךזדודיזןיןןזױיזזךױױז) {
if (יזזןיזךױױזזױ) { ױזדיןזךזןיןױז();
throw new װошибкаיзапускаיракетыװ("יזזןיזךױױזזױ");
}
this.ןיװיךזדודיזןיןןזױיזזךױױז = ןיװיךזדודיזןיןןזױיזזךױױז; this.ןיװיךזדודיזןיןןזױיזזךױױז = ןיװיךזדודיזןיןןזױיזזךױױז;
} }
protected 𝔅𝔬𝔫𝔢𝔏𝔬𝔞𝔡𝔢𝔯ʸᴰ ןיװיזױױדודזיןןןזךױזזז() { protected 𝔅𝔬𝔫𝔢𝔏𝔬𝔞𝔡𝔢𝔯ʸᴰ ןיװיזױױדודזיןןןזךױזזז() {
ױזדיןזךזןיןױז();
if (ןיװיךזדודיזןיןןזױיזזךױױז == Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.PTR_VOID) { if (ןיװיךזדודיזןיןןזױיזזךױױז == Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.PTR_VOID) {
return new DefaultBȍőnLoader(); return new DefaultBȍőnLoader();
} else { } else {
@ -284,6 +290,18 @@ public interface Bãß {
} }
} }
} }
protected ReadWriteLock ןיװיןזךױזױדזיןןזזזױדו() {
ױזדיןזךזןיןױז();
if (יזױזװיךןךױזױ) {
//System.out.println("LOCK: ReentrantReadWriteLock");
return new ReentrantReadWriteLock();
} else {
//System.out.println("LOCK: DummyReadWriteLock");
return new DummyReadWriteLock();
}
}
protected class װошибкаיзапускаיракетыװ extends RuntimeException { protected class װошибкаיзапускаיракетыװ extends RuntimeException {
private static final long serialVersionUID = Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.LONG_ONE; private static final long serialVersionUID = Bãß.ℭỗᶇṧⱦᶏꬼȶʂ.LONG_ONE;
protected װошибкаיзапускаיракетыװ(Exception err) { protected װошибкаיзапускаיракетыװ(Exception err) {

View file

@ -0,0 +1,57 @@
package love.distributedrebirth.bassboon.jpp.util.concurrent.locks;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Condition;
import java.util.concurrent.locks.Lock;
import java.util.concurrent.locks.ReadWriteLock;
import love.distributedrebirth.bassboon.clazz.BãßBȍőnAuthor注;
import love.distributedrebirth.bassboon.clazz.BãßBȍőnDuytsFlüstern注;
@BãßBȍőnAuthor注(name = "للَّٰهِilLצسُو", copyright = "©Δ∞ 仙上主天")
@BãßBȍőnDuytsFlüstern注(purpose = "Disabling of locking with zero code injection.")
public final class DummyReadWriteLock implements ReadWriteLock {
private final static Lock LOCK_READ = new DummyLock();
private final static Lock LOCK_WRITE = new DummyLock();
@Override
public Lock readLock() {
return LOCK_READ;
}
@Override
public Lock writeLock() {
return LOCK_WRITE;
}
static final class DummyLock implements Lock {
@Override
public void lock() {
}
@Override
public void lockInterruptibly() throws InterruptedException {
}
@Override
public Condition newCondition() {
return null;
}
@Override
public boolean tryLock() {
return true;
}
@Override
public boolean tryLock(long arg0, TimeUnit arg1) throws InterruptedException {
return true;
}
@Override
public void unlock() {
}
}
}

View file

@ -28,7 +28,6 @@ import net.spookygames.gdx.nativefilechooser.NativeFileChooser;
@BãßBȍőnDuytsFlüstern注(purpose = "Main loop render dispatcher and bootup.") @BãßBȍőnDuytsFlüstern注(purpose = "Main loop render dispatcher and bootup.")
@BãßBȍőnExport注(group = "love.distributedrebirth.gdxapp4d.tos4") @BãßBȍőnExport注(group = "love.distributedrebirth.gdxapp4d.tos4")
public enum GDXAppTos4 implements BãßBȍőnAbacusInstanceMBeanʸᴰ<GDXAppTos4>, ApplicationListener, SystemGdxTerminal { public enum GDXAppTos4 implements BãßBȍőnAbacusInstanceMBeanʸᴰ<GDXAppTos4>, ApplicationListener, SystemGdxTerminal {
INSTANCE; INSTANCE;
private Screen screen; private Screen screen;